AMReX-Combustion / PeleC

An AMR code for compressible reacting flow simulations
https://amrex-combustion.github.io/PeleC
Other
159 stars 71 forks source link

CMake configure failure for CUDA build on Polaris #823

Open wyphan opened 1 month ago

wyphan commented 1 month ago

On the latest development branch (commit cd601a2b4b92118d659fd11ca90a4775e24ff707), configuring a PeleC build using CMake with CUDA enabled fails due to a build target name clash between AMReX and SUNDIALS. This happens regardless of compiler toolchain (tested both NVHPC and GCC, with and without Cray wrapper) and CUDA toolkit version.

CMake Error at Submodules/PelePhysics/Submodules/sundials/cmake/SundialsSetupTesting.cmake:167 (add_custom_target):
  add_custom_target cannot create target "test_install" because another
  target with the same name already exists.  The existing target is a custom
  target created in source directory
  "/home/wyphan/work/PeleC/Submodules/PelePhysics/Submodules/amrex".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  Submodules/PelePhysics/Submodules/sundials/CMakeLists.txt:210 (include)

Minimal reproducer:

module reset
git clone --recursive https://github.com/AMReX-Combustion/PeleC.git
mkdir -p PeleC/build && cd PeleC/build
cmake -DENABLE_CUDA=ON ..
baperry2 commented 1 month ago

To enable CUDA with cmake, use cmake -DPELE_ENABLE_CUDA=ON .. rather than cmake -DENABLE_CUDA=ON ...

However, for most use cases, it may be more convenient to build with GNU Make rather than cmake: https://github.com/AMReX-Combustion/PeleC?tab=readme-ov-file#getting-started