NVIDIA / AMGX

Distributed multigrid linear solver library on GPU
501 stars 143 forks source link

[Build] _NV_IF__NV_TARGET_BOOL_NV_PROVIDES_SM_90 is undefined #299

Closed dmikushin closed 8 months ago

dmikushin commented 8 months ago

By some reason, SM90-related constructs in cuda_fp16.hpp make the compilation to fail for me:

/usr/local/cuda/bin/../targets/x86_64-linux/include/cuda_fp16.hpp(1337): error: type name is not allowed
  unsigned int tmp; asm("cvt.rzi.s8.f16 %0, %1;" : "=r"(tmp) : "h"(*(reinterpret_cast<const unsigned short *>(&(h))))); const unsigned char u = static_cast<unsigned char>(tmp); i = static_cast<signed char>(u);
  ^

/usr/local/cuda/bin/../targets/x86_64-linux/include/cuda_fp16.hpp(1337): error: expected a ")"
  unsigned int tmp; asm("cvt.rzi.s8.f16 %0, %1;" : "=r"(tmp) : "h"(*(reinterpret_cast<const unsigned short *>(&(h))))); const unsigned char u = static_cast<unsigned char>(tmp); i = static_cast<signed char>(u);
           ^

/usr/local/cuda/bin/../targets/x86_64-linux/include/cuda_fp16.hpp(1337): error: identifier "_NV_IF__NV_TARGET_BOOL_NV_PROVIDES_SM_90" is undefined
  { _NV_IF__NV_TARGET_BOOL_NV_PROVIDES_SM_90(
    ^

I've tried CUDA 12.2 and 12.3, same issue. It occurs regardless of whether or not the 90 arch is actually requested for building. AMGX compilation only works with CUDA 11.8.0.

My distro is wsl-ubuntu 22.04, and GCC is 11.4.

It's quite surprising nobody else is getting this error anywhere. What am I missing?

dmikushin commented 8 months ago

This issue occurred as a result of the clash between the separate CUB & libcudacxx dependencies and the same headers provided by the CUDA Toolkit. So the solution is: do NOT use standalone CUB & libcudacxx for AMGX. If AMGX is not able to find them, do not try to provide them separately; instead fix AMGX to properly find CUB & libcudacxx in the CUDA Toolkit include directory.