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)
|
add_compile_options(-mavx)
|
||||||
|
|
||||||
## Compile
|
## Compile
|
||||||
|
find_package(OpenMP)
|
||||||
add_library(astaroth_utils STATIC config_loader.c memory.c verification.c modelsolver.c)
|
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 ny_max = info.int_params[AC_ny_max];
|
||||||
const int nz_max = info.int_params[AC_nz_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 k_dst = start.z; k_dst < end.z; ++k_dst) {
|
||||||
for (int j_dst = start.y; j_dst < end.y; ++j_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) {
|
for (int i_dst = start.x; i_dst < end.x; ++i_dst) {
|
||||||
|
@@ -924,8 +924,8 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
|
|||||||
// Boundconds
|
// Boundconds
|
||||||
acMeshApplyPeriodicBounds(&mesh);
|
acMeshApplyPeriodicBounds(&mesh);
|
||||||
|
|
||||||
// Alpha step
|
// Alpha step
|
||||||
//#pragma omp parallel for
|
#pragma omp parallel for
|
||||||
for (int k = nz_min; k < nz_max; ++k) {
|
for (int k = nz_min; k < nz_max; ++k) {
|
||||||
for (int j = ny_min; j < ny_max; ++j) {
|
for (int j = ny_min; j < ny_max; ++j) {
|
||||||
for (int i = nx_min; i < nx_max; ++i) {
|
for (int i = nx_min; i < nx_max; ++i) {
|
||||||
@@ -934,8 +934,8 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Beta step
|
// Beta step
|
||||||
//#pragma omp parallel for
|
#pragma omp parallel for
|
||||||
for (int k = nz_min; k < nz_max; ++k) {
|
for (int k = nz_min; k < nz_max; ++k) {
|
||||||
for (int j = ny_min; j < ny_max; ++j) {
|
for (int j = ny_min; j < ny_max; ++j) {
|
||||||
for (int i = nx_min; i < nx_max; ++i) {
|
for (int i = nx_min; i < nx_max; ++i) {
|
||||||
|
Reference in New Issue
Block a user