You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Maxwell架构GPU(GTX980)上使用CuPy遇编译错误求助

问题:Maxwell架构GPU(GTX 980)使用CuPy执行array.mean()时JIT编译错误

使用计算能力5.2的GTX 980执行简单的array.mean()操作时,出现JIT编译错误,日志如下:

---------------------------------------------------
--- JIT compile log for cupy_jitify_exercise ---
---------------------------------------------------
cub/util_cpp_dialect.cuh(143): warning #161-D: unrecognized #pragma
       CUB_COMPILER_DEPRECATION_SOFT(C++14, C++11);
       ^

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

std/barrier(16): catastrophic error: #error directive: "CUDA synchronization primitives are only supported for sm_70 and up."
  #  error "CUDA synchronization primitives are only supported for sm_70 and up."
     ^

1 catastrophic error detected in the compilation of "cupy_jitify_exercise".
Compilation terminated.

---------------------------------------------------

当前环境:Ubuntu系统,nvidia-smi输出如下:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.23.08              Driver Version: 545.23.08    CUDA Version: 12.3     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce GTX 980         On  | 00000000:01:00.0 Off |                  N/A |
| 26%   33C    P8              13W / 180W |     57MiB /  4096MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A       979      G   /usr/lib/xorg/Xorg                           47MiB |
|    0   N/A  N/A      1384      G   /usr/bin/gnome-shell                          4MiB |
+---------------------------------------------------------------------------------------+

解决方案

错误核心原因是:CUDA 12.x引入的std/barrier同步原语仅支持Volta(sm_70)及以上架构,而GTX 980属于Maxwell架构(sm_52),不兼容该特性。以下是可行的解决办法:

  • 降级CUDA版本到11.x系列:CUDA 11.x对Maxwell架构仍提供完整支持,不会引入sm_70+专属的同步原语。推荐选择CUDA 11.7或11.8(CUDA 11的最后两个稳定版本),兼容性最佳。
  • 匹配对应CuPy版本:选择与CUDA 11.x兼容的CuPy版本,比如CuPy v11.x至v12.x的早期版本(需确保CuPy版本与CUDA版本匹配,例如CuPy 11.x对应CUDA 11.x)。避免使用最新版CuPy,其默认依赖CUDA 12的新特性。
  • 强制指定计算能力(可选,优先级低于前两项):如果不想更换环境,可尝试设置环境变量export CUPY_CUDA_COMPUTE_CAPABILITY=5.2,强制CuPy针对sm_52架构编译代码,避免触发高版本架构特性。但此方法可能存在其他潜在兼容性问题,仅作为临时方案。

无需立即更换GPU,通过降级CUDA和匹配对应CuPy版本,Maxwell架构仍可正常使用CuPy。

内容的提问来源于stack exchange,提问作者Stanley Powerlock

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 17:02:03