Commit f55b9832 authored by Tobias Lasser's avatar Tobias Lasser
Browse files

enable OpenMP for operators and projectors

parent c126101f
Pipeline #155900 failed with stages
in 17 seconds
...@@ -25,6 +25,13 @@ add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME}) ...@@ -25,6 +25,13 @@ add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} elsa_core elsa_logging) target_link_libraries(${ELSA_MODULE_TARGET_NAME} elsa_core elsa_logging)
# use OpenMP is available
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PRIVATE OpenMP::OpenMP_CXX)
endif()
target_include_directories(${ELSA_MODULE_TARGET_NAME} target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}> $<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
......
...@@ -102,6 +102,7 @@ namespace elsa ...@@ -102,6 +102,7 @@ namespace elsa
IndexVector_t decrementedCoefficients = numberOfCoefficients - IndexVector_t decrementedCoefficients = numberOfCoefficients -
IndexVector_t::Ones(this->getRangeDescriptor().getNumberOfDimensions()); IndexVector_t::Ones(this->getRangeDescriptor().getNumberOfDimensions());
#pragma omp parallel
for (int currDim = 0; currDim < numDim; ++currDim) { for (int currDim = 0; currDim < numDim; ++currDim) {
if (!_activeDims[currDim]) if (!_activeDims[currDim])
continue; continue;
...@@ -109,6 +110,7 @@ namespace elsa ...@@ -109,6 +110,7 @@ namespace elsa
index_t modulus = numberOfCoefficients.head(currDim + 1).prod(); index_t modulus = numberOfCoefficients.head(currDim + 1).prod();
index_t divisor = numberOfCoefficients.head(currDim).prod(); index_t divisor = numberOfCoefficients.head(currDim).prod();
#pragma omp for nowait
for (index_t id = 0; id < sizeOfDomain; ++id) { for (index_t id = 0; id < sizeOfDomain; ++id) {
index_t icCount = (id % modulus) / divisor; //_domainDescriptor.index(id, ic); index_t icCount = (id % modulus) / divisor; //_domainDescriptor.index(id, ic);
index_t ir = id + _dimCounter[currDim] * _coordDelta[currDim]; index_t ir = id + _dimCounter[currDim] * _coordDelta[currDim];
...@@ -147,6 +149,7 @@ namespace elsa ...@@ -147,6 +149,7 @@ namespace elsa
IndexVector_t numberOfCoefficients = this->getDomainDescriptor().getNumberOfCoefficientsPerDimension(); IndexVector_t numberOfCoefficients = this->getDomainDescriptor().getNumberOfCoefficientsPerDimension();
IndexVector_t decrementedCoefficients = numberOfCoefficients - IndexVector_t::Ones(numDim); IndexVector_t decrementedCoefficients = numberOfCoefficients - IndexVector_t::Ones(numDim);
#pragma omp parallel
for (index_t currDim = 0; currDim < numDim; ++currDim) { for (index_t currDim = 0; currDim < numDim; ++currDim) {
if (!_activeDims[currDim]) if (!_activeDims[currDim])
continue; continue;
...@@ -154,6 +157,7 @@ namespace elsa ...@@ -154,6 +157,7 @@ namespace elsa
index_t modulus = numberOfCoefficients.head(currDim + 1).prod(); index_t modulus = numberOfCoefficients.head(currDim + 1).prod();
index_t divisor = numberOfCoefficients.head(currDim).prod(); index_t divisor = numberOfCoefficients.head(currDim).prod();
#pragma omp for nowait
for (index_t id = 0; id < sizeOfDomain; ++id) { for (index_t id = 0; id < sizeOfDomain; ++id) {
index_t icCount = (id % modulus) / divisor; index_t icCount = (id % modulus) / divisor;
index_t ir = id + _dimCounter[currDim] * _coordDelta[currDim]; index_t ir = id + _dimCounter[currDim] * _coordDelta[currDim];
......
...@@ -35,6 +35,14 @@ add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME}) ...@@ -35,6 +35,14 @@ add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} elsa_core elsa_logging) target_link_libraries(${ELSA_MODULE_TARGET_NAME} elsa_core elsa_logging)
# use OpenMP is available
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PRIVATE OpenMP::OpenMP_CXX)
endif()
target_include_directories(${ELSA_MODULE_TARGET_NAME} target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}> $<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
......
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