nanoporetech / dorado

Oxford Nanopore's Basecaller
https://nanoporetech.com/
Other
495 stars 59 forks source link

If CXX=nvc++, then CMAKE_CXX_COMPILER_ID=NVHPC, so cmake fails #728

Closed aowenson-imm closed 6 months ago

aowenson-imm commented 6 months ago

When loading CUDA via a GNU environment module, it is standard practice to map compiler environment variables to Nvidia compilers, e.g.:

CXX=nvc++

cmake handles this fine, setting CMAKE_CXX_COMPILER_ID = NVHPC. But Dorado's cmake logic does not expect this:

Unknown compiler: NVHPC

To get this error message requires patch #726, otherwise syntax error.

Steps to reproduce the issue:

Assume CUDA paths loaded in environment, e.g.: module load cuda/12

export CXX=nvc++
cmake -S . -B cmake-build

Run environment:

Possible solution

Editing Warnings/cmake to treat NVHPC as Clang allows command to complete. But is this the correct solution?

HalfPhoton commented 6 months ago

Thanks @aowenson-imm, your merge request was merged and it will be in the next dorado release.

blawrence-ont commented 6 months ago

Hi @aowenson-imm,

The NVHPC compiler is unsupported in dorado and probably won't result in any performance improvements over regular GCC/clang since all the CUDA kernels are precompiled. I would advise building without setting CC or CXX so that GCC/clang are used (assuming that either is installed). We could accept a patch to Warnings.cmake to take the clang path for NVHPC, but since we don't use it internally there's no guarantee that we won't break it in the future when adding warnings to the clang path.

Thanks, Ben

aowenson-imm commented 6 months ago

I tried CC=gcc CXX=g++, which allows the compilation to progress much further than with nvc++, but it fails to find a CUDA library:

[ 73%] Built target dorado_io_lib
gmake[2]: *** No rule to make target '/path/to/ourmodules/cuda/12.2/cuda/12.2/lib64/libcufft_static_nocallback.a', needed by 'bin/dorado'.  Stop.

The library does exist, just not where gmake is looking. Using nvc++ finds it, but then there are other undefined errors - I will try to fix these.

HalfPhoton commented 6 months ago

https://github.com/nanoporetech/dorado/issues/675

What's your cmake version? It needs to be CMake >= 3.23

aowenson-imm commented 6 months ago

Thanks @HalfPhoton , that was my mistake. Latest cmake and forcing CC=gcc CXX=g++ allows build to complete.