KCL-BMEIS / niftyreg

This project contains command line tools to perform rigid, affine and non-linear registration of nifti or analyse images as well as utilities
BSD 3-Clause "New" or "Revised" License
141 stars 42 forks source link

GCC 9 Fails to build due to OpenMP changes #74

Closed ashgillman closed 3 years ago

ashgillman commented 4 years ago

Hi,

It seems OpenMP has some different defaults for OpenMP. See: https://gcc.gnu.org/gcc-9/porting_to.html#ompdatasharing

I was able to compile with the following changes, but I'm not familiar enough to know whether the default(none) was important...

diff --git a/reg-lib/cpu/_reg_mind.cpp b/reg-lib/cpu/_reg_mind.cpp
index 294d21c..11666a7 100644
--- a/reg-lib/cpu/_reg_mind.cpp
+++ b/reg-lib/cpu/_reg_mind.cpp
@@ -134,7 +134,7 @@ void GetMINDImageDesciptor_core(nifti_image* inputImage,
    int mindIndex;
    DTYPE meanValue, max_desc, descValue;
 #if defined (_OPENMP)
-#pragma omp parallel for default(none) \
+#pragma omp parallel for \
    shared(samplingNbr, maskPtr, meanImgDataPtr, \
    MINDImgDataPtr) \
    private(voxelIndex, meanValue, max_desc, descValue, mindIndex)
@@ -294,7 +294,7 @@ void GetMINDSSCImageDesciptor_core(nifti_image* inputImage,
    int mindIndex;
    DTYPE meanValue, max_desc, descValue;
 #if defined (_OPENMP)
-#pragma omp parallel for default(none) \
+#pragma omp parallel for \
    shared(lengthDescriptor, samplingNbr, maskPtr, meanImgDataPtr, \
    MINDSSCImgDataPtr) \
    private(voxelIndex, meanValue, max_desc, descValue, mindIndex)
diff --git a/reg-lib/cpu/_reg_ssd.cpp b/reg-lib/cpu/_reg_ssd.cpp
index 98d1e20..c7d980f 100755
--- a/reg-lib/cpu/_reg_ssd.cpp
+++ b/reg-lib/cpu/_reg_ssd.cpp
@@ -820,7 +820,7 @@ void GetDiscretisedValueSSD_core3D_2(nifti_image *controlPointGridImage,

    // Loop over all control points
 #if defined (_OPENMP)
-#pragma omp parallel for default(none) \
+#pragma omp parallel for \
    shared(controlPointGridImage, refImage, warImage, grid2img_vox, blockSize, \
    padding_value, refBlockValue, mask, refImgPtr, warImgPtr, discretise_radius, \
    discretise_step, discretisedValue) \