Added CPU parallelization to make CPU integration and boundconds faster
This commit is contained in:
@@ -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)
|
||||
|
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user