Open yanggthomas opened 2 years ago
Thanks for reporting this, not sure why this is happening. I don't have access to a system with nvcc
yet, maybe I can set up one in a VM, but I need more informations like the version of nvcc
and the OS to at least try to replicate it.
hope these could help you
Sorry, it took more time than expected to look into this. I had a test installing nvidia-cuda-toolkit
on my 20.04 Ubuntu, that gives me:
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
So sadly not exactly the same conditions.
I then made a build folder and from there simply tried:
$ nvcc ../test/filesystem_test.cpp -I ../include/
It ran without any error and the resulting a.out
of that test gave me:
$ ./a.out
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.out is a Catch v2.13.7 host application.
Run with -? for options
[... cut expected warning output for things that can vary on platforms ...]
===============================================================================
All tests passed (1081 assertions in 70 test cases)
So my OS is newer but the CUDA toolkit is older, but I have the feeling something else is leading to those errors and I would need some reproducible example with the compile parameters.
I'm by no means a CUDA expert and don't use it in any project, so any help is welcome.
Sorry for the late reply.
It could be because nvcc is actually passing the pure cpp/c
source file to g++/gcc on linux. As you can see in https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#supported-host-compilers, which says "During non-CUDA phases (except the run phase), because these phases will be forwarded by nvcc to this compiler.". Here the host compiler means gcc on Linux.
As for this particular case, the error occurs if I put some code of filesystem in *.cu
file, which will be processed by nvcc
first. However, basiclly filesystem is not required on device(GPU) since generally this is not the part we want to accelerate via GPU and CUDA. Actually, this is a supported feature of nvcc
that host only code in *.cu
will be forward to host compiler.
So personally speaking, I tend to regard this problem as a bug of nvcc
. Probably add a hint in the documentation to suggest others to use "forward/implementation" style with CUDA, in this way, the filesystem code will be processed only by host compiler and nvcc will stop complaining.
Additionally, to reproduce the error, maybe I can write some small examples. But I am relative new to github and I am not sure how to pass the code properly.
Describe the bug Hi. I get a compile error when I compile with nvcc(cuda).
To Reproduce single header mode
I could fix this bug by using forward/implementation in my project.