void pathFinder::constructPath(Point& currentPoint) { std::vector<Point> path; while (searchKeys(currentPoint).first==true) { currentPoint = searchKeys(currentPoint).second->second; path.push_back(currentPoint); } for (Point p : path) { p.setDisplayCharacter('*'); world::putElement(p); std::cout << p.getX() << " " << p.getY() << "\n"; } }
double MgpuBenchmark(searchEngine_t engine, int count, CuDeviceMem* values, searchType_t type, CuDeviceMem* btree, int numIterations, int numQueries, CuDeviceMem* keys, CuDeviceMem* indices, const T* valuesHost, const T* keysHost) { CuEventTimer timer; timer.Start(); int size = (SEARCH_TYPE_INT32 == type) ? 4 : 8; int offset = 0; for(int it(0); it < numIterations; ++it) { offset += RoundUp(numQueries, 32); if(offset + numQueries > MaxQuerySize) offset = 0; searchStatus_t status = searchKeys(engine, count, type, values->Handle(), SEARCH_ALGO_LOWER_BOUND, keys->Handle() + offset * size, numQueries, btree->Handle(), indices->Handle()); if(SEARCH_STATUS_SUCCESS != status) { printf("FAIL!\n"); exit(0); } } double elapsed = timer.Stop(); double throughput = (double)numQueries * numIterations / elapsed; // Verify the results for the last set of queries run. std::vector<uint> results(numQueries); indices->ToHost(results); for(int i(0); i < numQueries; ++i) { const T* lower = std::lower_bound(valuesHost, valuesHost + count, keysHost[offset + i]); if((lower - valuesHost) != results[i]) { printf("Failure in MGPU Search.\n"); exit(0); } } return throughput; }