Loading test_set.hpp +10 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ #include "Triangle.hpp" #include <TNL/Algorithms/ParallelFor.h> #include <TNL/Containers/StaticArray.h> #include <iomanip> Loading Loading @@ -65,8 +66,13 @@ S<T, Device> build_table(const Array<T, Device>& values, int toAdd) { << "\t\t\tNumber of iterations: " << nIterations << std::endl; Array<T, Device> arr(toAdd); for (int i = 0; i < toAdd; i++) arr.setElement(i, values.getElement(i)); auto aView = arr.getView(); auto vView = values.getConstView(); //TODO move this to outer level to not affect performance before the actual build auto copy_arr = [aView, vView] __cuda_callable__ (int i) mutable { aView[i] = vView[i]; }; TNL::Algorithms::ParallelFor<Device>::exec(0, toAdd, copy_arr); return S<T, Device>(arr); } Loading Loading @@ -219,6 +225,7 @@ void test(std::string fileName, bool testRandom = true) { std::vector<T> cpuValues; auto values = get_data<T>(fileName, cpuValues); auto table = test_building<S, T>(values); //table.debug_print(); test_correct_query<S, T>(table, cpuValues, cpuValues.size()); test_wrong_query<S, T>(table, cpuValues, cpuValues.size()); if (testRandom) Loading Loading @@ -284,7 +291,7 @@ void run() { std::string dataFile = "data/cube1m_" + std::to_string(i) + "_cells.txt"; test_class<CuckooHashSet>("CuckooHashSet", dataFile); test_class<HashGraphV1Set>("HashGraphV1Set", dataFile); //test_class<HashGraphV1Set>("HashGraphV1Set", dataFile); //test_class<StdSetWrapper>("std::set", dataFile); } print_results_table(); Loading Loading
test_set.hpp +10 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ #include "Triangle.hpp" #include <TNL/Algorithms/ParallelFor.h> #include <TNL/Containers/StaticArray.h> #include <iomanip> Loading Loading @@ -65,8 +66,13 @@ S<T, Device> build_table(const Array<T, Device>& values, int toAdd) { << "\t\t\tNumber of iterations: " << nIterations << std::endl; Array<T, Device> arr(toAdd); for (int i = 0; i < toAdd; i++) arr.setElement(i, values.getElement(i)); auto aView = arr.getView(); auto vView = values.getConstView(); //TODO move this to outer level to not affect performance before the actual build auto copy_arr = [aView, vView] __cuda_callable__ (int i) mutable { aView[i] = vView[i]; }; TNL::Algorithms::ParallelFor<Device>::exec(0, toAdd, copy_arr); return S<T, Device>(arr); } Loading Loading @@ -219,6 +225,7 @@ void test(std::string fileName, bool testRandom = true) { std::vector<T> cpuValues; auto values = get_data<T>(fileName, cpuValues); auto table = test_building<S, T>(values); //table.debug_print(); test_correct_query<S, T>(table, cpuValues, cpuValues.size()); test_wrong_query<S, T>(table, cpuValues, cpuValues.size()); if (testRandom) Loading Loading @@ -284,7 +291,7 @@ void run() { std::string dataFile = "data/cube1m_" + std::to_string(i) + "_cells.txt"; test_class<CuckooHashSet>("CuckooHashSet", dataFile); test_class<HashGraphV1Set>("HashGraphV1Set", dataFile); //test_class<HashGraphV1Set>("HashGraphV1Set", dataFile); //test_class<StdSetWrapper>("std::set", dataFile); } print_results_table(); Loading