From 7644a264251e52071cc1ebe8480b65d744e29ebc Mon Sep 17 00:00:00 2001 From: Carl Johnsen Date: Thu, 19 Sep 2024 09:26:05 +0200 Subject: [PATCH] Fixed various compilation errors introduced by #12 and #34 --- src/lib/cpp/cpu_seq/morphology.cc | 5 ++--- src/lib/cpp/gpu/morphology.cc | 5 ++--- src/lib/cpp/include/boilerplate.hh | 4 ++-- src/lib/py/helpers.py | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/lib/cpp/cpu_seq/morphology.cc b/src/lib/cpp/cpu_seq/morphology.cc index 981aca3..8d8e4d6 100644 --- a/src/lib/cpp/cpu_seq/morphology.cc +++ b/src/lib/cpp/cpu_seq/morphology.cc @@ -76,7 +76,6 @@ namespace cpu_seq { // Apply the spherical kernel bool value = neutral; - #pragma omp simd collapse(3) reduction(op:value) for (int32_t pz = -radius; pz <= radius; pz++) { for (int32_t py = -radius; py <= radius; py++) { for (int32_t px = -radius; px <= radius; px++) { @@ -139,8 +138,8 @@ namespace cpu_seq { int64_t X[3] = {z, y, x}; int64_t limits[6]; for (int axis = 0; axis < 3; axis++) { - limits[(axis*2)] = -min(radius, X[axis]); - limits[(axis*2)+1] = min(radius, N[axis] - X[axis] - 1); + limits[(axis*2)] = -std::min(radius, X[axis]); + limits[(axis*2)+1] = std::min(radius, N[axis] - X[axis] - 1); } // Apply the spherical kernel diff --git a/src/lib/cpp/gpu/morphology.cc b/src/lib/cpp/gpu/morphology.cc index d4efa11..bed290b 100644 --- a/src/lib/cpp/gpu/morphology.cc +++ b/src/lib/cpp/gpu/morphology.cc @@ -84,7 +84,6 @@ namespace gpu { // Apply the spherical kernel bool value = neutral; - #pragma omp simd collapse(3) reduction(op:value) for (int32_t pz = -radius; pz <= radius; pz++) { for (int32_t py = -radius; py <= radius; py++) { for (int32_t px = -radius; px <= radius; px++) { @@ -155,8 +154,8 @@ namespace gpu { int64_t X[3] = {z, y, x}; int64_t limits[6]; for (int axis = 0; axis < 3; axis++) { - limits[(axis*2)] = -min(radius, X[axis]); - limits[(axis*2)+1] = min(radius, N[axis] - X[axis] - 1); + limits[(axis*2)] = -std::min(radius, X[axis]); + limits[(axis*2)+1] = std::min(radius, N[axis] - X[axis] - 1); } // Apply the spherical kernel diff --git a/src/lib/cpp/include/boilerplate.hh b/src/lib/cpp/include/boilerplate.hh index 953d5e0..b90c13b 100644 --- a/src/lib/cpp/include/boilerplate.hh +++ b/src/lib/cpp/include/boilerplate.hh @@ -79,7 +79,7 @@ #define FOR_BLOCK_BEGIN(ARR) \ for (int64_t ARR##_buffer_start = 0; ARR##_buffer_start < ARR##_length; ARR##_buffer_start += acc_block_size) { \ ARR##_type *ARR##_buffer = (ARR##_type *) ARR.data + ARR##_buffer_start; \ - ssize_t ARR##_buffer_length = min(acc_block_size, ARR##_length-ARR##_buffer_start); \ + ssize_t ARR##_buffer_length = std::min(acc_block_size, ARR##_length-ARR##_buffer_start); \ PRAGMA(acc data copy(ARR##_buffer[:ARR##_buffer_length])) \ { @@ -139,7 +139,7 @@ for (int64_t ARR_IN##_buffer_start = 0; ARR_IN##_buffer_start < ARR_IN##_length; ARR_IN##_buffer_start += acc_block_size / 2) { \ ARR_IN##_type *ARR_IN##_buffer = (ARR_IN##_type *) ARR_IN.data + ARR_IN##_buffer_start; \ ARR_OUT##_type *ARR_OUT##_buffer = (ARR_OUT##_type *) ARR_OUT.data + ARR_IN##_buffer_start; \ - ssize_t ARR_IN##_buffer_length = min(acc_block_size, ARR_IN##_length - ARR_IN##_buffer_start); \ + ssize_t ARR_IN##_buffer_length = std::min(acc_block_size, ARR_IN##_length - ARR_IN##_buffer_start); \ PRAGMA(acc data copyin(ARR_IN##_buffer[:ARR_IN##_buffer_length]) copy(ARR_OUT##_buffer[:ARR_IN##_buffer_length])) \ { diff --git a/src/lib/py/helpers.py b/src/lib/py/helpers.py index 1559bc2..61b0199 100644 --- a/src/lib/py/helpers.py +++ b/src/lib/py/helpers.py @@ -9,7 +9,7 @@ from config.paths import binary_root, hdf5_root import h5py -import lib.gpu.bitpacking as lib_bitpacking +import lib.cpp.gpu.bitpacking as lib_bitpacking import lib.cpp.cpu.io as lib_io import lib.cpp.cpu.general as lib_general import lib.cpp.gpu.morphology as lib_morphology