gpt4 book ai didi

ubuntu - nvcc 致命 : Unsupported gpu architecture 'compute_30'

转载 作者:行者123 更新时间:2023-12-04 18:37:22 24 4
gpt4 key购买 nike

我正在使用这个 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, 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 版本要新得多。

关于ubuntu - nvcc 致命 : Unsupported gpu architecture 'compute_30' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65695117/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com