Added CPU parallelization to make CPU integration and boundconds faster

This commit is contained in:
jpekkila
2019-12-14 15:45:42 +02:00
parent ff35d78509
commit 8bd81db63c
3 changed files with 7 additions and 5 deletions

View File

@@ -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)

View File

@@ -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) {

View File

@@ -925,7 +925,7 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
acMeshApplyPeriodicBounds(&mesh);
// Alpha step
//#pragma omp parallel for
#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) {
@@ -935,7 +935,7 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
}
// Beta step
//#pragma omp parallel for
#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) {