You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
g++ version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the sourcefor copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
When I run make in CapelliniSpTRSV/CUDA/SyncFree_csc, I encountered the following problem
a) download source code gcc-10.5.0 (https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-10.5.0/)
b) tar -xvf gcc-10.5.0.tar.gz
c) Enter the gcc-10.5.0 directory and execute ./contrib/download_prerequisites
d) Create a directory in a parallel location, such as gcc10
e) Enter the newly created gcc10 directory and execute ../gcc-10.5.0/configure --prefix=/home/username/.local --enable-checking=release --enable-languages=c,c++ --disable-multilib. prefix set as local for your own user or anywhere you want.
f) Make && make install in the gcc10 directory. Finally, the new version of gcc is installed in /home/username/.local/bin, which is the subdirectory bin under the prefix set previously. (You can use the -j option of the make command, followed by the number of threads you want to use, to achieve multi-threaded compilation.)
write CMakeLists.txt (Remember to modify the gcc path, like /home/username/.local/bin/g++)
warning: Since we set prefix to ~/.local, it may be used as the default environment variable in the user's .profile file, so if you do not want the locally compiled gcc to affect the global environment, please comment out this in the .profile file part
# set PATH so it includes user's private bin if it existsif [ -d"$HOME/.local/bin" ] ;then
PATH="$HOME/.local/bin:$PATH"fi
The text was updated successfully, but these errors were encountered:
If you can modify the C++ header file, a simple solution is to comment out the following two "noexcept" lines in the /usr/include/c++/11/bits/std_function.h file.
Line 433+ (approximate):
template<typename _Functor,
typename _Constraints = _Requires<_Callable<_Functor>>>
function(_Functor&& __f)
//noexcept(_Handler<_Functor>::template _S_nothrow_init<_Functor>()) // CUDA BOTCHES THIS
: _Function_base()
Line 529+ (approximate):
template<typename _Functor>
_Requires<_Callable<_Functor>, function&>
operator=(_Functor&& __f)
//noexcept(_Handler<_Functor>::template _S_nothrow_init<_Functor>()) // CUDA BOTCHES THIS
{
function(std::forward<_Functor>(__f)).swap(*this);
return *this;
}
Clearly, this typically only affects compiler optimization, but indeed, it can resolve the issue.
In my experience, consolidating an entire project with CUDA into a single .cu file for compilation is not advisable. I have encountered numerous similar issues, and the handling of C++ code by nvcc is not as proficient as that of compilers like g++. It is better to split the code into multiple .cpp and .cu files, and then perform the linking. This approach proves to be a better choice as it helps avoid the majority of such situations.
cuda version
g++ version
When I run
make
inCapelliniSpTRSV/CUDA/SyncFree_csc
, I encountered the following problemMy solution is as follows:
CMakeLists.txt
(Remember to modify the gcc path, like/home/username/.local/bin/g++
)cmake_minimum_required(VERSION 3.10) project(MyCudaProject) set(CMAKE_CUDA_HOST_COMPILER gcc-10.5.0_path) enable_language(CUDA) set(CMAKE_CUDA_FLAGS "-O3 -w -m64 -Xptxas -dlcm=cg -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_61,code=compute_61") link_directories(/usr/local/cuda/lib64) include_directories(/usr/local/cuda/include) add_executable(main main.cu) target_link_libraries(main cusparse cudart)
mkdir build cd build cmake .. make
warning: Since we set prefix to
~/.local
, it may be used as the default environment variable in the user's.profile
file, so if you do not want the locally compiled gcc to affect the global environment, please comment out this in the.profile
file partThe text was updated successfully, but these errors were encountered: