hwloc icon indicating copy to clipboard operation
hwloc copied to clipboard

Failed to configure with PGI and CUDA unless CC=pg++

Open kingchc opened this issue 7 years ago • 7 comments

What version of hwloc are you using?

From github source, commit 27421999c8c97399403e198864b2f4515bc7766d

Which operating system and hardware are you running on?

CentOS $ uname -a Linux xxx 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

CPU: Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz (Haswell)

Details of the problem

I'm trying to use PGI compiler to build hwloc with CUDA support. I got an error message during configuration. Followings are command line I used and the output.

$ ./configure CC=pgcc 'CPP=pgcc -E' CXX=pgc++ F77=pgf77 FC=pgf90 --enable-cuda CPPFLAGS=-I/usr/local/cuda-9.0/include CFLAGS="-I/usr/local/cuda-9.0/include"
...<skip>...
checking cuda.h usability... yes
checking cuda.h presence... yes
checking for cuda.h... yes
checking if CUDA_VERSION >= 3020... yes
checking for cuInit in -lcuda... yes
checking cuda_runtime_api.h usability... no
checking cuda_runtime_api.h presence... no
checking for cuda_runtime_api.h... no
configure: WARNING: Specified --enable-cuda switch, but could not
configure: WARNING: find appropriate support
configure: error: Cannot continue

Here it shows it cannot find cuda_runtime_api.h, but I have confirmed that the file is there at /usr/local/cuda-9.0/include. I have tried different version of PGI (17.10, 18.1, 18.3), but none of them work. However, it works fine with GNU compiler.

Any suggestion is appreciated. Thanks,

kingchc avatar Apr 17 '18 16:04 kingchc

Hello Look for cuda_runtime_api.h in config.log to find out the entire compile line that failed. In theory, your CFLAGS isn't needed (it's only for compiler flags), only CPPFLAGS should contain -I/path/to/foo/bar. You could also try setting INCLUDE_PATH=/usr/local/cuda-9.0/include and/or C_INCLUDE_PATH=/usr/local/cuda-9.0/include but I don't know if pgcc honors these variables.

bgoglin avatar Apr 17 '18 18:04 bgoglin

Thanks for the reply. I have tried INCLUDE_PATH and C_INCLUDE_PATH, unfortunately, none of them works. Looking into the config.log, I found that it's using pgcc instead of pgc++ when processing cuda-related stuff. I guess pgcc somehow is not compatible to CUDA.

configure:24319: result: no
configure:24319: checking cuda_runtime_api.h presence
configure:24319: pgcc -E -I/opt/cuda/9.0/include conftest.c
PGC-F-0249-#error --  --- !!! UNKNOWN COMPILER: please provide a CUDA compatible definition for '__align__' !!! --- (/opt/cuda/9.0/include/crt/host_defines.h: 133)
PGC/x86-64 Linux 17.10-0: compilation aborted

I did some search and apply the following patch to make it work.

$ git diff
diff --git a/config/hwloc.m4 b/config/hwloc.m4
index 63bf11d6..dd9c150c 100644
--- a/config/hwloc.m4
+++ b/config/hwloc.m4
@@ -826,6 +826,7 @@ return clGetDeviceIDs(0, 0, 0, NULL, NULL);
     # CUDA support
     hwloc_have_cuda=no
     hwloc_have_cudart=no
+    AC_LANG_PUSH([C++])
     if test "x$enable_io" != xno && test "x$enable_cuda" != "xno"; then
       AC_CHECK_HEADERS([cuda.h], [
         AC_MSG_CHECKING(if CUDA_VERSION >= 3020)
@@ -860,6 +861,7 @@ return clGetDeviceIDs(0, 0, 0, NULL, NULL);
           ])
         ])
       ])
+    AC_LANG_POP([C++])

       AS_IF([test "$enable_cuda" = "yes" -a "$hwloc_have_cudart" = "no"],
             [AC_MSG_WARN([Specified --enable-cuda switch, but could not])

I hope this will not broke anything. Thanks,

kingchc avatar Apr 17 '18 22:04 kingchc

If pgcc doesn't support cuda_runtime_api.h, then some parts of hwloc itself won't build with pgcc (at least topology-cuda.c and tests/hwloc/cuda*.c), and you would need to use CC=pg++ for building hwloc.

bgoglin avatar Apr 18 '18 06:04 bgoglin

I'm having the same issue. I checked PGI's installation guide and found that any version pf PGI doesn't support Intel Xeon CPU... Have you solved the issue yet?

YuhaoYHH avatar Jun 25 '18 20:06 YuhaoYHH

Hello @chingking and @YuhaoYHH Does this problem still occur?

bgoglin avatar Oct 18 '18 13:10 bgoglin

Hello @chingking and @YuhaoYHH Does this problem still occur?

I applied the above-mentioned patch to my local repo and proceed. I have confirmed that using CC=pg++ also works. Hope this helps.

kingchc avatar Oct 19 '18 16:10 kingchc

FWIW, it's pretty straightforward to add a PGI build to Travis; see https://github.com/nemequ/pgi-travis

nemequ avatar Nov 17 '18 06:11 nemequ

This bug is very old and building with your configure line works fine now (just tested with PG compilers 22.3-0). Hence I am closing this.

bgoglin avatar Mar 08 '23 09:03 bgoglin