diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 8708b4f..800b207 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -7,5 +7,6 @@ add_compile_options(-Wall -Wextra -Werror -Wdouble-promotion -Wfloat-conversion add_compile_options(-mavx) ## Compile +find_package(OpenMP) add_library(astaroth_utils STATIC config_loader.c memory.c verification.c modelsolver.c) -target_link_libraries(astaroth_utils PRIVATE astaroth_core m) +target_link_libraries(astaroth_utils PRIVATE astaroth_core m OpenMP::OpenMP_C) diff --git a/src/utils/memory.c b/src/utils/memory.c index d74d5a2..be22775 100644 --- a/src/utils/memory.c +++ b/src/utils/memory.c @@ -96,6 +96,7 @@ acMeshApplyPeriodicBounds(AcMesh* mesh) const int ny_max = info.int_params[AC_ny_max]; const int nz_max = info.int_params[AC_nz_max]; +#pragma omp parallel for for (int k_dst = start.z; k_dst < end.z; ++k_dst) { for (int j_dst = start.y; j_dst < end.y; ++j_dst) { for (int i_dst = start.x; i_dst < end.x; ++i_dst) { diff --git a/src/utils/modelsolver.c b/src/utils/modelsolver.c index 772799b..26d354a 100644 --- a/src/utils/modelsolver.c +++ b/src/utils/modelsolver.c @@ -924,8 +924,8 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt) // Boundconds acMeshApplyPeriodicBounds(&mesh); - // Alpha step - //#pragma omp parallel for +// Alpha step +#pragma omp parallel for for (int k = nz_min; k < nz_max; ++k) { for (int j = ny_min; j < ny_max; ++j) { for (int i = nx_min; i < nx_max; ++i) { @@ -934,8 +934,8 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt) } } - // Beta step - //#pragma omp parallel for +// Beta step +#pragma omp parallel for for (int k = nz_min; k < nz_max; ++k) { for (int j = ny_min; j < ny_max; ++j) { for (int i = nx_min; i < nx_max; ++i) {