运行时
标题
2023-12-29 15:34:50
232

小白求助:

我们正希望把一个CUDA软件编译在DCU上运行。该软件在原始CUDA环境下可以编译成功,但在DCU Docker镜像(23.10, CentOS 7.6)上使用 "/opt/dtk/cuda/bin/nvcc"  无法编译成功,出现以下Warning和Error:

$ python setup_cuda.py bdist_wheel
running bdist_wheel
running build
running build_py
running egg_info
writing xxx.egg-info/PKG-INFO
writing dependency_links to xxxb.egg-info/dependency_links.txt
writing requirements to xxx.egg-info/requires.txt
writing top-level names to xxx.egg-info/top_level.txt
reading manifest file 'xxx.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'xxx.egg-info/SOURCES.txt'
running build_ext
install_dir /home/project/xxx/build/lib.linux-x86_64-cpython-310
-DPYTHON_LIBRARY=/usr/local/lib -DPYTHON_INCLUDE_DIR=/usr/local/include/python3.10 -DCMAKE_INSTALL_PREFIX=/home/project/xxx/build/lib.linux-x86_64-cpython-310 -DPython_INCLUDE_DIRS=/usr/local/include/python3.10 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/lib/python3.10/site-packages/pybind11-2.11.1-py3.10.egg/pybind11/share/cmake -DCUDA_TOOLKIT_ROOT_DIR=/opt/dtk/cuda -DCMAKE_CUDA_FLAGS=-arch=sm_86 
-- Using CMake version 3.21.0
-- Found pybind11: /usr/local/lib/python3.10/site-packages/pybind11-2.11.1-py3.10.egg/pybind11/include (found version "2.11.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/project/xxx-v0.1.10/build/temp.linux-x86_64-cpython-310
[  9%] Building CXX object CMakeFiles/gpu_ops.dir/lib/gpu_ops.cc.o
In file included from /home/project/xxx/lib/kernel_helpers_random.cuh:8:0,
                 from /home/project/xxx/lib/gpu_jitconn_event_matvec.cuh:10,
                 from /home/project/xxx/lib/gpu_ops.cc:11:
/opt/dtk/cuda/targets/x86_64-linux/include/curand_kernel.h:73:0: warning: "CURAND_PHILOX4x32_DEFAULT_SEED" redefined
 \#define CURAND_PHILOX4x32_DEFAULT_SEED 0ULL
 
In file included from /opt/dtk/cuda/targets/x86_64-linux/include/curand_kernel.h:36:0,
                 from /home/project/xxx/lib/kernel_helpers_random.cuh:8,
                 from /home/project/xxx/lib/gpu_jitconn_event_matvec.cuh:10,
                 from /home/project/xxx/lib/gpu_ops.cc:11:
/opt/dtk/cuda/targets/x86_64-linux/include/curand_philox4x32_x.h:77:0: note: this is the location of the previous definition
 \#define CURAND_PHILOX4x32_DEFAULT_SEED 0xdeadbeefdeadbeefULL
 
In file included from /opt/dtk/cuda/targets/x86_64-linux/include/cuda_fp16.h:103:0,
                 from /opt/dtk/cuda/targets/x86_64-linux/include/curand_uniform.h:33,
                 from /opt/dtk/cuda/targets/x86_64-linux/include/curand_kernel.h:43,
                 from /home/project/xxx/lib/kernel_helpers_random.cuh:8,
                 from /home/project/xxx/lib/gpu_jitconn_event_matvec.cuh:10,
                 from /home/project/xxx/lib/gpu_ops.cc:11:
/opt/dtk/cuda/targets/x86_64-linux/include/fp16_internal.h:19:13: error: ‘_Float16’ does not name a type; did you mean ‘float1’?
     typedef _Float16 _Float16_2 __attribute__((ext_vector_type(2)));
             ^~~~~~~~
             float1

在DCU Docker镜像上,该软件使用镜像自带的cmake 3.21.0编译,我只把CMakeList.txt中指向"/usr/local/cuda"的部分都换成了"/opt/dtk/cuda"。

我看到程序适配手册上说这种问题的原因是“在用 g++编译器编译 cu 代码,此时将编译器调整为 nvcc 即可解决”。但请问为什么在原始CUDA环境下就不会有这个问题?另外怎样把编译器调整为nvcc?我试过加入“-DCMAKE_CXX_COMPILER=/opt/dtk/cuda/bin/nvcc  ”,但这样会使CMake在更早的时候就报错退出。

全部评论(2)
只看楼主
T
tianlh
1楼

是否已提前source DTK目录下的cuda/env.sh,DTK cuda兼容性使用说明请参考以下链接:

https://download.sourcefind.cn:65024/directlink/1/DTK-23.10/Document/DTK%2023.10%20CUDA%20%E7%A8%8B%E5%BA%8F%E9%80%82%E9%85%8D%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C.pdf

以及

https://www.hpccube.com/ac/learning/index.html;jsessionid=B99732192D213E44A880BDDBC8779A36?tenantId=ghdev#/course/detail?id=1670615103336161281&courseCode=cudamocker

2024/1/2
网
网友O2WUEE
回复 @tianlh
谢谢!已提前source DTK目录下的cuda/env.sh。第二个课程我看看
2024/1/4
没有更多内容了
--
楼主
Level.4
0 帖子
楼主热帖
暂无数据