nvcc 致命:不支持的 GPU 架构“compute_30”

如何解决nvcc 致命:不支持的 GPU 架构“compute_30”

我正在使用此 GitHub 存储库 https://github.com/davidstutz/mesh-fusion 并且我正在遵循其说明。我在 cmake .. 之后得到的错误如下。我该如何解决?

Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed

CMakeError.log 中的错误是:

/usr/bin/ld: cannot find -lpthreads

我遵循了这个答案:https://stackoverflow.com/a/31948969/2414957

我确实有以下几点:

$ ls /usr/lib/x86_64-linux-gnu/libpthread.so
lrwxrwxrwx 1 root root 37 Aug 17 16:02 /usr/lib/x86_64-linux-gnu/libpthread.so -> /lib/x86_64-linux-gnu/libpthread.so.0

$ nm /lib/x86_64-linux-gnu/libpthread.so.0 | grep "pthread_create"
00000000000098d0 t __pthread_create_2_1
0000000000007af7 t __pthread_create_2_1.cold
00000000000098d0 T pthread_create@@GLIBC_2.2.5

我有:

[3645:3637 0:2047] 10:00:46 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/build
$ cmake ..
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal,direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file,but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda-11.2 (found suitable version "11.2",minimum required is "6.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mona/mesh-fusion/libfusiongpu/build

CMakeError.log 是:

[3645:3637 0:2051] 10:03:13 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/build/CMakeFiles
$ cat CMakeError.log 
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_d8db1/fast && /usr/bin/make -f CMakeFiles/cmTC_d8db1.dir/build.make CMakeFiles/cmTC_d8db1.dir/build
make[1]: Entering directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_d8db1.dir/src.c.o
/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_d8db1.dir/src.c.o   -c /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_d8db1
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d8db1.dir/link.txt --verbose=1
/usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_d8db1.dir/src.c.o  -o cmTC_d8db1 
/usr/bin/ld: CMakeFiles/cmTC_d8db1.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_d8db1.dir/build.make:87: cmTC_d8db1] Error 1
make[1]: Leaving directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_d8db1/fast] Error 2


Source file was:
#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread,NULL,test_func,NULL);
  pthread_detach(thread);
  pthread_join(thread,NULL);
  pthread_atfork(NULL,NULL);
  pthread_exit(NULL);

  return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_4d856/fast && /usr/bin/make -f CMakeFiles/cmTC_4d856.dir/build.make CMakeFiles/cmTC_4d856.dir/build
make[1]: Entering directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_4d856.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_4d856.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_4d856
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4d856.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_4d856.dir/CheckFunctionExists.c.o  -o cmTC_4d856  -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_4d856.dir/build.make:87: cmTC_4d856] Error 1
make[1]: Leaving directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_4d856/fast] Error 2

我有:

$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

这是 CMakeLists.txt 文件(我添加了前两行):

cmake_minimum_required (VERSION 2.8.7) ## added by mona
find_package(Threads) ## added by mona

cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_STANDARD 11)

# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2 -msse3 -msse4.2 -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -msse4.2 -fPIC")

find_package(CUDA 6.5 REQUIRED)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES -Wall")

set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; -gencode=arch=compute_30,code=sm_30")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; -gencode=arch=compute_30,code=compute_30")

set(FUSION_GPU_SRC
  fusion.cu
  fusion_zach_tvl1.cu
)

cuda_add_library(fusion_gpu SHARED ${FUSION_GPU_SRC})
target_link_libraries(fusion_gpu ${CUDA_LIBRARIES})

稍后,如果我运行 make 命令,我将收到此错误:

[3645:3637 0:2070] 10:33:37 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/build
$ make
[ 33%] Building NVCC (Device) object CMakeFiles/fusion_gpu.dir/fusion_gpu_generated_fusion_zach_tvl1.cu.o
nvcc fatal   : Unsupported gpu architecture 'compute_30'
CMake Error at fusion_gpu_generated_fusion_zach_tvl1.cu.o.Release.cmake:220 (message):
  Error generating
  /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/fusion_gpu.dir//./fusion_gpu_generated_fusion_zach_tvl1.cu.o


make[2]: *** [CMakeFiles/fusion_gpu.dir/build.make:72: CMakeFiles/fusion_gpu.dir/fusion_gpu_generated_fusion_zach_tvl1.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:75: CMakeFiles/fusion_gpu.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

解决方法

我使用了这段代码的第 77-83 行:https://github.com/baidu-research/warp-ctc/blob/master/CMakeLists.txt

在我的 CMakeLists.txt 文件中:

##set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; -gencode=arch=compute_30,code=sm_30")
##set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; -gencode=arch=compute_30,code=compute_30")

IF ((CUDA_VERSION VERSION_GREATER "10.0") OR (CUDA_VERSION VERSION_EQUAL "10.0"))
    set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_75,code=sm_75")
ENDIF()

IF ((CUDA_VERSION VERSION_GREATER "11.0") OR (CUDA_VERSION VERSION_EQUAL "11.0"))
    set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_80,code=sm_80")
ENDIF()

并且 make 成功。显然,可以忽略您在 cmake ..

处看到的错误

原因是代码很旧并且使用的是旧版本的 CUDA,而我的 CUDA 版本要新得多。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-