Ubuntu nvcc致命:不支持的gpu体系结构';计算30';

Ubuntu nvcc致命:不支持的gpu体系结构';计算30';,ubuntu,cmake,pthreads,gpu,nvidia,Ubuntu,Cmake,Pthreads,Gpu,Nvidia,我正在使用这个GitHub回购协议,并遵循它的指示。我在cmake..之后得到的错误如下。我该怎么修 Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed CMakeError.log中的错误为: /usr/bin/ld: cannot find -lpthreads [3645:3637 0:2051] 10:03:13 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/buil

我正在使用这个GitHub回购协议,并遵循它的指示。我在
cmake..
之后得到的错误如下。我该怎么修

Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
CMakeError.log
中的错误为:

/usr/bin/ld: cannot find -lpthreads
[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
我的回答如下:

我有以下几点:

$ 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
$ 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
CMakeError.log
是:

/usr/bin/ld: cannot find -lpthreads
[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
下面是
CMakeLists.txt
文件(我添加了前两行):

稍后,如果我运行
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行:

在我的
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版本更新得多。

正如您所发现的,
CMAKE\u have\u LIBC\u PTHREAD
与您的问题没有任何共同之处。您是否可以编辑您的问题帖子及其标题,以删除与您的问题无关的部分?关于行
--执行测试CMAKE\u HAVE\u LIBC\u PTHREAD-失败
请参见以下问题:。感谢您的建议。我接着改变了标题。