JeffersonLab / qphix

QCD for Intel Xeon Phi and Xeon processors
http://jeffersonlab.github.io/qphix/
Other
13 stars 11 forks source link

Build error, cannot find “posix_memalign” #47

Closed martin-ueding closed 7 years ago

martin-ueding commented 7 years ago

I have tried to compile the devel version of QPhiX on JURECA (Haswell) and Marconi A2 (KNL). Since I use the same compilation script, it should still work. I get the following error message on both systems:

In file included from /homec/hbn28/hbn28e/qphix-twisted-test/sources/qphix/include/qphix/geometry.h(4),
                 from /homec/hbn28/hbn28e/qphix-twisted-test/sources/qphix/tests-gtest/tolerance.h(3),
                 from /homec/hbn28/hbn28e/qphix-twisted-test/sources/qphix/tests-gtest/clover_product.cc(4):
/homec/hbn28/hbn28e/qphix-twisted-test/sources/qphix/include/qphix/dslash_utils.h(82): error: identifier "posix_memalign" is undefined
        ok = posix_memalign((void **)&v, alignment, size);
             ^

Looking at the history of that file, it seems that the only changes in the year 2017 were made by me, it is the addition of the QPHIX_MESSAGE macro. The changes look innocent:

@@ -4,6 +4,7 @@

 #include <cerrno>
+#include "qphix/diagnostics.h"
 #include "qphix/qphix_config.h"

 #ifdef QPHIX_USE_QDPXX_ALLOC
@@ -218,7 +219,7 @@ ALIGNED_FREE(void *addr)
 #endif // __MIC__

 #if defined(QPHIX_MIC_SOURCE)
-#warning including barrier
+QPHIX_MESSAGE("including barrier")
 #include "qphix/Barrier_mic.h"
 #else
 #include "qphix/Barrier_stubs.h"
martin-ueding commented 7 years ago

There has been an update to the Intel compiler on both machines. With man 3 posix_memalign I found that it is defined in stdlib.h. The following test program compiles on JURECA:

#include <cstdlib>

int main() {
    void *ptr;
    posix_memalign(&ptr, 128, 1024);
}

Moving the #include of cstdlib out of the conditional fixes this particular problem.