glotzerlab / hoomd-blue

Molecular dynamics and Monte Carlo soft matter simulation on GPUs.
http://glotzerlab.engin.umich.edu/hoomd-blue
BSD 3-Clause "New" or "Revised" License
329 stars 127 forks source link

Hoomd v3.7.0 compile error with CUDA 12.0. #1450

Closed ETsingos closed 1 year ago

ETsingos commented 1 year ago

Description

Hoomd v3.7.0 fails to compile with CUDA 12.0. After downgrade to CUDA 11.7 it compiles fine.

System specs:

System: Kernel: 5.4.0-135-generic x86_64 bits: 64 compiler: gcc v: 9.4.0 Desktop: Cinnamon 5.2.7 wm: muffin dm: LightDM Distro: Linux Mint 20.3 Una base: Ubuntu 20.04 focal Machine: Type: Desktop Mobo: ASUSTeK model: PRIME Z370-P v: Rev X.0x serial: UEFI [Legacy]: American Megatrends v: 0405 date: 08/31/2017 CPU: Topology: 6-Core model: Intel Core i7-8700K bits: 64 type: MT MCP arch: Kaby Lake rev: A L2 cache: 12.0 MiB flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 88796 Speed: 800 MHz min/max: 800/3700 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 Graphics: Device-1: NVIDIA GP106 [GeForce GTX 1060 6GB] driver: nvidia v: 525.60.13 bus ID: 01:00.0 chip ID: 10de:1c03 Display: x11 server: X.Org 1.20.13 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa resolution: 1920x1080~60Hz OpenGL: renderer: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2 v: 4.6.0 NVIDIA 525.60.13 direct render: Yes Audio: Device-1: Intel 200 Series PCH HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1f.3 chip ID: 8086:a2f0 Device-2: NVIDIA GP106 High Definition Audio driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:10f1 Sound Server: ALSA v: k5.4.0-135-generic Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8169 v: kernel port: d000 bus ID: 04:00.0 chip ID: 10ec:8168 IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: Drives: Local Storage: total: 3.18 TiB used: 1.68 TiB (52.9%) ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO 1TB size: 931.51 GiB speed: 6.0 Gb/s serial: ID-2: /dev/sdb vendor: Western Digital model: WD5000AAKX-00ERMA0 size: 465.76 GiB speed: 6.0 Gb/s serial: ID-3: /dev/sdc type: USB vendor: Samsung model: Portable SSD T5 size: 1.82 TiB serial: Partition: ID-1: / size: 55.72 GiB used: 28.36 GiB (50.9%) fs: ext4 dev: /dev/sda7 Sensors: System Temperatures: cpu: 29.8 C mobo: 27.8 C gpu: nvidia temp: 28 C Fan Speeds (RPM): N/A gpu: nvidia fan: 25% Repos: No active apt repos in: /etc/apt/sources.list Active apt repos in: /etc/apt/sources.list.d/cuda-ubuntu2004-12-0-local.list 1: deb [signed-by=/usr/share/keyrings/cuda-5E22DB91-keyring.gpg] file: ///var/cuda-repo-ubuntu2004-12-0-local / Active apt repos in: /etc/apt/sources.list.d/inkscape_dev-stable-focal.list 1: deb http: //ppa.launchpad.net/inkscape.dev/stable/ubuntu focal main Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 1: deb http: //packages.linuxmint.com una main upstream import backport #id:linuxmint_main 2: deb http: //archive.ubuntu.com/ubuntu focal main restricted universe multiverse 3: deb http: //archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse 4: deb http: //archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse 5: deb http: //security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse 6: deb http: //archive.canonical.com/ubuntu/ focal partner Active apt repos in: /etc/apt/sources.list.d/teams.list 1: deb [arch=amd64] https: //packages.microsoft.com/repos/ms-teams stable main Active apt repos in: /etc/apt/sources.list.d/vscode.list 1: deb [arch=amd64,arm64,armhf] http: //packages.microsoft.com/repos/code stable main Info: Processes: 328 Uptime: 5m Memory: 15.56 GiB used: 4.03 GiB (25.9%) Init: systemd v: 245 runlevel: 5 target: graphical.target Compilers: gcc: 9.4.0 alt: 8/9 Client: Unknown python3.8 client inxi: 3.0.38

Output of nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Mon_Oct_24_19:12:58_PDT_2022 Cuda compilation tools, release 12.0, V12.0.76 Build cuda_12.0.r12.0/compiler.31968024_0

Script

mkdir venv

python3 -m venv venv --system-site-packages
source venv/bin/activate

git clone --recursive https://github.com/glotzerlab/hoomd-blue

cd hoomd-blue/
python3 install-prereq-headers.py 

mkdir build
cd build

export CMAKE_PREFIX_PATH=path/to/venv/

cmake ../ -DCMAKE_INSTALL_PREFIX=`python3 -c "import site; print(site.getsitepackages()[0])"` -DCMAKE_CXX_FLAGS=-march=native -DCMAKE_C_FLAGS=-march=native -DENABLE_GPU=ON -DENABLE_MPI=OFF -DPYTHON_EXECUTABLE=$(which python) -DHOOMD_GPU_PLATFORM=CUDA

make

Input files

No response

Output

[ 26%] Building CXX object hoomd/CMakeFiles/_hoomd.dir/Autotuned.cc.o
In file included from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime_api.h:344,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime.h:28,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime.h:58,
                 from /home/username/Desktop/hoomd-blue/hoomd/HOOMDMath.h:13,
                 from /home/username/Desktop/hoomd-blue/hoomd/ExecutionConfiguration.h:8,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuner.h:12,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuned.h:15,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuned.cc:4:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipBindTexture(size_t*, textureReference*, const void*, const hipChannelFormatDesc*, size_t)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1381:35: error: ‘cudaBindTexture’ was not declared in this scope; did you mean ‘hipBindTexture’?
 1381 |     return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size));
      |                                   ^~~~~~~~~~~~~~~
      |                                   hipBindTexture
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipGetTextureAlignmentOffset(size_t*, const textureReference*)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1417:35: error: ‘cudaGetTextureAlignmentOffset’ was not declared in this scope; did you mean ‘hipGetTextureAlignmentOffset’?
 1417 |     return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   hipGetTextureAlignmentOffset
In file included from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime_api.h:344,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime.h:28,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime.h:58,
                 from /home/username/Desktop/hoomd-blue/hoomd/HOOMDMath.h:13,
                 from /home/username/Desktop/hoomd-blue/hoomd/ExecutionConfiguration.h:8,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuner.h:12,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuned.h:15,
                 from /home/username/Desktop/hoomd-blue/hoomd/Action.h:14,
                 from /home/username/Desktop/hoomd-blue/hoomd/Analyzer.h:17,
                 from /home/username/Desktop/hoomd-blue/hoomd/Analyzer.cc:8:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipBindTexture(size_t*, textureReference*, const void*, const hipChannelFormatDesc*, size_t)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1381:35: error: ‘cudaBindTexture’ was not declared in this scope; did you mean ‘hipBindTexture’?
 1381 |     return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size));
      |                                   ^~~~~~~~~~~~~~~
      |                                   hipBindTexture
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipGetTextureAlignmentOffset(size_t*, const textureReference*)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1417:35: error: ‘cudaGetTextureAlignmentOffset’ was not declared in this scope; did you mean ‘hipGetTextureAlignmentOffset’?
 1417 |     return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   hipGetTextureAlignmentOffset
In file included from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime_api.h:344,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime.h:28,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime.h:58,
                 from /home/username/Desktop/hoomd-blue/hoomd/HOOMDMath.h:13,
                 from /home/username/Desktop/hoomd-blue/hoomd/ExecutionConfiguration.h:8,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuner.h:12,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuned.h:15,
                 from /home/username/Desktop/hoomd-blue/hoomd/Action.h:14,
                 from /home/username/Desktop/hoomd-blue/hoomd/Action.cc:4:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipBindTexture(size_t*, textureReference*, const void*, const hipChannelFormatDesc*, size_t)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1381:35: error: ‘cudaBindTexture’ was not declared in this scope; did you mean ‘hipBindTexture’?
 1381 |     return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size));
      |                                   ^~~~~~~~~~~~~~~
      |                                   hipBindTexture
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipGetTextureAlignmentOffset(size_t*, const textureReference*)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1417:35: error: ‘cudaGetTextureAlignmentOffset’ was not declared in this scope; did you mean ‘hipGetTextureAlignmentOffset’?
 1417 |     return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   hipGetTextureAlignmentOffset
In file included from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime_api.h:344,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime.h:28,
                 from /home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/hip_runtime.h:58,
                 from /home/username/Desktop/hoomd-blue/hoomd/HOOMDMath.h:13,
                 from /home/username/Desktop/hoomd-blue/hoomd/ExecutionConfiguration.h:8,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuner.h:12,
                 from /home/username/Desktop/hoomd-blue/hoomd/Autotuned.h:15,
                 from /home/username/Desktop/hoomd-blue/hoomd/Action.h:14,
                 from /home/username/Desktop/hoomd-blue/hoomd/module.cc:4:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipBindTexture(size_t*, textureReference*, const void*, const hipChannelFormatDesc*, size_t)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1381:35: error: ‘cudaBindTexture’ was not declared in this scope; did you mean ‘hipBindTexture’?
 1381 |     return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size));
      |                                   ^~~~~~~~~~~~~~~
      |                                   hipBindTexture
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h: In function ‘hipError_t hipGetTextureAlignmentOffset(size_t*, const textureReference*)’:
/home/username/Desktop/hoomd-blue/hoomd/extern/HIP/include/hip/nvcc_detail/hip_runtime_api.h:1417:35: error: ‘cudaGetTextureAlignmentOffset’ was not declared in this scope; did you mean ‘hipGetTextureAlignmentOffset’?
 1417 |     return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   hipGetTextureAlignmentOffset
make[2]: *** [hoomd/CMakeFiles/_hoomd.dir/build.make:89: hoomd/CMakeFiles/_hoomd.dir/Autotuned.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [hoomd/CMakeFiles/_hoomd.dir/build.make:76: hoomd/CMakeFiles/_hoomd.dir/Action.cc.o] Error 1
make[2]: *** [hoomd/CMakeFiles/_hoomd.dir/build.make:102: hoomd/CMakeFiles/_hoomd.dir/Analyzer.cc.o] Error 1
make[2]: *** [hoomd/CMakeFiles/_hoomd.dir/build.make:63: hoomd/CMakeFiles/_hoomd.dir/module.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1054: hoomd/CMakeFiles/_hoomd.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Expected output

According to changelog, CUDA 12.0 compatibility has been fixed since version 3.5.0, so it should compile without errors.

Platform

Linux

Installation method

Compiled from source

HOOMD-blue version

3.7.0

Python version

3.8.10

joaander commented 1 year ago

The claim of CUDA 12 support in 3.5 comes from a patch submitted by NVIDIA tested with internal CUDA 12 release candidates #1403.

These compile errors come from the embedded HIP headers HOOMD uses to support both AMD and NVIDIA GPUs. HOOMD does not use hipBindTexture, so these methods can be removed from the headers.

I will be able to provide fully tested CUDA 12 support once NVIDIA provides a CUDA 12 docker container: https://hub.docker.com/r/nvidia/cuda

ejmeitz commented 1 year ago

I am also having issues with this header. I will make a separate post though as they arise in a different place.

ejmeitz commented 1 year ago

Just a note, downgrading to CUDA 11.5.2 fixed this for me, but also required me to use gcc-10 to avoid a bug in gcc-11 with CUDA 11.

joaander commented 1 year ago

I tested HOOMD v3.7.0 with gcc11 and CUDA 11.7. More recently, I added gcc11 and CUDA 11.8 to the test matrix. I also test CUDA 10, 11.1, 11.2, 11.3, 11.4, 11.5, and 11.6 with compiler versions as provided in the NVIDIA CUDA docker containers.

joaander commented 1 year ago

Fixed in #1453.