# cupy 该仓库克隆自官方仓库,并整合了依赖的第三方依赖 #编译方法 ```sh export CUPY_INSTALL_USE_HIP=1 export ROCM_HOME=/opt/dtk export HCC_AMDGPU_TARGET=gfx936 export CXXFLAGS="-fpermissive" export CFLAGS="-fpermissive" pip install wheel pip install fastrlock==0.8.3 numpy==1.26.4 git clone http://developer.sourcefind.cn/codes/songlinfeng/cupy.git cd cupy python setup.py bdist_wheel ``` 如果使用dtk-2604以上版本需要修改/opt/dtk/include/thrust/version.h,添加#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP ```sh #pragma once #include #define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP #if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA #include #endif ``` 验证 ```sh >>> import cupy >>> print(cupy.show_config()) OS : Linux-4.18.0-372.9.1.el8.x86_64-x86_64-with-glibc2.28 Python Version : 3.10.12 CuPy Version : 12.3.0 CuPy Platform : AMD ROCm NumPy Version : 1.26.4 SciPy Version : None Cython Build Version : 0.29.37 Cython Runtime Version : None CUDA Root : /opt/dtk/ hipcc PATH : /opt/dtk/bin/hipcc CUDA Build Version : 60326045 CUDA Driver Version : 60326045 CUDA Runtime Version : 60326045 cuBLAS Version : (available) cuFFT Version : 10028 cuRAND Version : 300200 cuSOLVER Version : (3, 20, 0) cuSPARSE Version : (available) NVRTC Version : (9, 0) Thrust Version : 200302 CUB Build Version : 300300 Jitify Build Version : None cuDNN Build Version : None cuDNN Version : None NCCL Build Version : 22203 NCCL Runtime Version : 22203 cuTENSOR Version : None cuSPARSELt Build Version : None Device 0 Name : BW200 Device 0 Arch : gfx936:sramecc+:xnack- Device 0 PCI Bus ID : 0000:9f:00.0 Device 1 Name : BW200 Device 1 Arch : gfx936:sramecc+:xnack- Device 1 PCI Bus ID : 0000:56:00.0 Device 2 Name : BW200 Device 2 Arch : gfx936:sramecc+:xnack- Device 2 PCI Bus ID : 0000:5d:00.0 Device 3 Name : BW200 Device 3 Arch : gfx936:sramecc+:xnack- Device 3 PCI Bus ID : 0000:05:00.0 Device 4 Name : BW200 Device 4 Arch : gfx936:sramecc+:xnack- Device 4 PCI Bus ID : 0000:e8:00.0 Device 5 Name : BW200 Device 5 Arch : gfx936:sramecc+:xnack- Device 5 PCI Bus ID : 0000:c1:00.0 Device 6 Name : BW200 Device 6 Arch : gfx936:sramecc+:xnack- Device 6 PCI Bus ID : 0000:ca:00.0 Device 7 Name : BW200 Device 7 Arch : gfx936:sramecc+:xnack- Device 7 PCI Bus ID : 0000:b1:00.0 None ```