Questions tagged [nvcc]

"nvcc" is NVIDIA's LLVM-based C/C++ compiler for targeting GPUs with CUDA.

This tag refers to NVIDIA’s compiler toolchain nvcc for the parallel computing architecture (CUDA). Documentation for nvcc is included with the CUDA Toolkit.

You should ask questions about CUDA here on Stack Overflow, but if you have bugs to report you should discuss them on the CUDA forums or report them via the registered developer portal. You may want to cross-link to any discussion here on Stack Overflow.

688 questions
6
votes
1 answer

nvcc + c2hs on OS X 10.9.5

I'm building a software that needs nvcc for compilation. I don't have a CUDA-capable GPU, but actually I don't need that – a friend is building the exact same software on Linux, he has no CUDA GPU, but everything's fine. I installed the newest CUDA…
kgadek
  • 1,446
  • 1
  • 17
  • 18
6
votes
1 answer

CUDA 6.0 Linking error: undefined reference to `__cudaUnregisterFatBinary'

I am trying to compile a simple CUDA program in Eclipse. g++ -L/opt/cuda/lib64 -o "cuda_esn" ./cu_cuda_test.o ./main.o -lcuda -lstdc++ As you can see I am linking -lcuda and set the library path -L/opt/cuda/lib64. But unfortunately I have no idea…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
6
votes
0 answers

nvlink error when linking CUDA code against CUDA static library - CMake

I create a static library, which contains some CUDA code and some regular C++ code. The CMakeLists.txt for this static library looks like this: SET(TARGET_H some_header.h) SET(CUDA_SRC cudaclass1.cu cudaclass2.cu) SET(TARGET_SRC cppclass1.cpp…
m.s.
  • 16,063
  • 7
  • 53
  • 88
6
votes
2 answers

CUDA invalid device symbol error

the code below compiles just fine. But when i try to run it, i got GPUassert: invalid device symbol file.cu 114 When i comment lines marked by (!!!) the error wont show up. My question is what is causing this error because it gives me no…
user3390078
  • 75
  • 1
  • 1
  • 4
6
votes
1 answer

CUDA/PTX 32-bit vs. 64-bit

CUDA compilers have options for producing 32-bit or 64-bit PTX. What is the difference between these? Is it like for x86, NVidia GPUs actually have 32-bit and 64-bit ISAs? Or is it related to host code only?
zlatanski
  • 815
  • 1
  • 8
  • 13
6
votes
4 answers

Cannot run CUDA code that queries NVML - error regarding libnvidia-ml.so

Recently a colleague needed to use NVML to query device information, so I downloaded the Tesla development kit 3.304.5 and copied the file nvml.h to /usr/include. To test, I compiled the example code in tdk_3.304.5/nvml/example and it worked…
Brian R
  • 785
  • 1
  • 6
  • 13
6
votes
3 answers

Why do gcc and NVCC (g++) see two different structure sizes?

I am trying to add CUDA to an existing single threaded C program that was written sometime in the late 90s. To do this I need to mix two languages, C and C++ (nvcc is a c++ compiler). The problem is that the C++ compiler sees a structure as a…
Mikhail
  • 7,749
  • 11
  • 62
  • 136
6
votes
1 answer

Can I get CUDA Compute capability (version) in compile time by #define?

How can I get CUDA Compute capability (version) in compile time by #define? For example, if I use __ballot and compile with nvcc -c -gencode arch=compute_20,code=sm_20 \ -gencode arch=compute_13,code=sm_13 source.cu can I get…
Alex
  • 12,578
  • 15
  • 99
  • 195
5
votes
3 answers

nvcc: Combine extern and constant

I would like to organise my CUDA code into separate object files to be linked at the end of compiling, as in C++. To that end I'd like to be able to declare an extern pointer to __constant__ memory in a header file, and put the definition in one of…
Rolf Andreassen
  • 450
  • 1
  • 5
  • 9
5
votes
1 answer

Using C++20 in the nvcc compiler for cuda

I'm trying to use the std::countr_zero() function from the library, but I'm not sure how I'm supposed to configure my nvcc compiler as I'm sure it's not using the C++20 version.
Existentialist
  • 177
  • 2
  • 9
5
votes
1 answer

main.obj : fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section 0x6

I am on a Windows 10 machine, I have 2 files, main.cpp and cuda.cu (I have built this project on Ubuntu successfully I am trying to get it to build on Windows). I compiled both of them to make object files of 64 bit architecture. I have MS Visual…
dtn34-
  • 321
  • 3
  • 11
5
votes
1 answer

How to hide NVCC's "function was declared but never referenced" warnings?

When compiling CUDA programs which use Google Test, nvcc will emit false-positive warnings: function was declared but never referenced An MCVE: // test.cu #include namespace { __global__ void a_kernel() { …
gflegar
  • 1,583
  • 6
  • 22
5
votes
1 answer

Cuda code #define error, expected a ")"

In the following code, if I bring the #define N 65536 above the #if FSIZE, then I get the following error: #if FSIZE==1 __global__ void compute_sum1(float *a, float *b, float *c, int N) { #define N 65536 int majorIdx = blockIdx.x; …
0fnt
  • 8,211
  • 9
  • 45
  • 62
5
votes
1 answer

nvcc warning in cuda 8.0

I am getting this warning when I try to execute nvcc. I have cuda toolket 8.0 I have Nvidia GTX 480 in my system. nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use…
Vraj Pandya
  • 591
  • 1
  • 9
  • 13
5
votes
1 answer

nvcc compiler recognizes static constexpr as undefined in device code

This question is a follow-up question of this one. It is about the nvcc compiler recognizing a static constexpr class variable as undefined in device code, if the variable is odr-used. However, I could not find a reason, why it should not work. The…
marlam
  • 590
  • 5
  • 14