Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kingchc opened this issue Apr 17, 2018 · 8 comments
Closed

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

kingchc opened this issue Apr 17, 2018 · 8 comments

Comments

@kingchc
Copy link

kingchc commented Apr 17, 2018

What version of hwloc are you using?

From github source, commit 2742199

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,

@bgoglin
Copy link
Contributor

bgoglin commented Apr 17, 2018

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.

@kingchc
Copy link
Author

kingchc commented Apr 17, 2018

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,

@bgoglin
Copy link
Contributor

bgoglin commented Apr 18, 2018

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.

@YuhaoYHH
Copy link

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?

@bgoglin
Copy link
Contributor

bgoglin commented Oct 18, 2018

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

@kingchc
Copy link
Author

kingchc commented Oct 19, 2018

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.

@nemequ
Copy link

nemequ commented Nov 17, 2018

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

@bgoglin bgoglin changed the title Failed to configure with PGI and CUDA Failed to configure with PGI and CUDA unless CC=pg++ Nov 17, 2018
@bgoglin
Copy link
Contributor

bgoglin commented Mar 8, 2023

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 bgoglin closed this as completed Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants