Commit 82dba48d authored by Yaroslav Gevorkov's avatar Yaroslav Gevorkov
Browse files

adding parallelity to init phase

parent be66f4ab
...@@ -51,6 +51,7 @@ endif(PINKINDEXER_BUILD_EXECUTABLE) ...@@ -51,6 +51,7 @@ endif(PINKINDEXER_BUILD_EXECUTABLE)
if(OpenMP_CXX_FOUND) if(OpenMP_CXX_FOUND)
target_link_libraries(pinkIndexer PUBLIC OpenMP::OpenMP_CXX) target_link_libraries(pinkIndexer PUBLIC OpenMP::OpenMP_CXX)
add_definitions(-DOPENMP_AVAILABLE) add_definitions(-DOPENMP_AVAILABLE)
add_definitions(-D_GLIBCXX_PARALLEL)
endif(OpenMP_CXX_FOUND) endif(OpenMP_CXX_FOUND)
if(EIGEN3_FOUND) if(EIGEN3_FOUND)
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
#include <algorithm> #include <algorithm>
#include <numeric> #include <numeric>
//#include <execution>
using namespace std; using namespace std;
using namespace Eigen; using namespace Eigen;
...@@ -34,9 +35,13 @@ namespace pinkIndexer ...@@ -34,9 +35,13 @@ namespace pinkIndexer
sortIndices.resize(reflections.cols()); sortIndices.resize(reflections.cols());
iota(sortIndices.begin(), sortIndices.end(), 0); iota(sortIndices.begin(), sortIndices.end(), 0);
sort(sortIndices.begin(), sortIndices.end(), [&norms](uint32_t i, uint32_t j) { return norms[i] < norms[j]; }); sort(sortIndices.begin(), sortIndices.end(), [&norms](uint32_t i, uint32_t j) { return norms[i] < norms[j]; });
//only with c++17 support:
//sort(execution::par_unseq, sortIndices.begin(), sortIndices.end(), [&norms](uint32_t i, uint32_t j) { return norms[i] < norms[j]; });
reflectionsDirections_sorted.resize(3, reflections.cols() - 1); // leave out reflection (0,0,0) reflectionsDirections_sorted.resize(3, reflections.cols() - 1); // leave out reflection (0,0,0)
norms_sorted.resize(reflections.cols()); norms_sorted.resize(reflections.cols());
#pragma omp parallel for
for (int i = 1; i < reflections.cols(); ++i) for (int i = 1; i < reflections.cols(); ++i)
{ {
uint32_t sortIndex = sortIndices[i]; uint32_t sortIndex = sortIndices[i];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment