hello,I am new to cuda, and there is a compile error which i dont know how to resolve. could anyone help?
I am trying to use 1. Introduction — CUDA C Programming Guide in my code.but compile error.
after some try, i simplify my code, is it a cuda BUG? my code:
// CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(cuda-practice_v1 LANGUAGES CXX CUDA)
file(GLOB srcs ${CMAKE_CURRENT_SOURCE_DIR}/*.cu)
add_library(all_in_one SHARED ${srcs})
target_include_directories(all_in_one PUBLIC .)
set_target_properties(all_in_one PROPERTIES CUDA_ARCHITECTURES "86")
--- ---
// k.cu
#include <cuda/pipeline>
--- ---
// t.cu
#include <cuda/pipeline>
cmake version 3.26.4
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0
shell run:
root@/home/Workspace/cuda-practice/cuda-playground/stage_memacc/_/src# cmake -S . -B build && cmake --build build
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/Workspace/cuda-practice/cuda-playground/stage_memacc/_/src/build
[ 33%] Linking CUDA shared library liball_in_one.so
/usr/bin/ld: CMakeFiles/all_in_one.dir/t.cu.o: in function `cuda::__4::pipeline<(cuda::std::__4::__detail::thread_scope)2>::__barrier_try_wait_parity(cuda::__4::barrier<(cuda::std::__4::__detail::thread_scope)2, cuda::std::__4::__empty_completion>&, bool)':
tmpxft_0005f3da_00000000-6_t.cudafe1.cpp:(.text+0x1a): multiple definition of `cuda::__4::pipeline<(cuda::std::__4::__detail::thread_scope)2>::__barrier_try_wait_parity(cuda::__4::barrier<(cuda::std::__4::__detail::thread_scope)2, cuda::std::__4::__empty_completion>&, bool)'; CMakeFiles/all_in_one.dir/k.cu.o:tmpxft_0005f396_00000000-6_k.cudafe1.cpp:(.text+0x1a): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/all_in_one.dir/build.make:117: liball_in_one.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/all_in_one.dir/all] Error 2
make: *** [Makefile:91: all] Error 2