nvcc

Can't get rid of “warning: command line option ‘-std=c++11’” using nvcc/CUDA/cmake

一个人想着一个人 提交于 2020-01-02 08:49:29
问题 When I compile my cuda code with cmake, I can't seem to get the following warning to go away: cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C [enabled by default] I have reduced the problem to the compilation, not my source code. Here is a simplified (but working) example: main.cu: #include <iostream> int main(void) { std::cout << "test" << std::endl; } CMakeLists.txt: cmake_minimum_required(VERSION 3.0.3) project(a_test) find_package(CUDA REQUIRED)

nvlink, relocatable device code and static device libraries

可紊 提交于 2020-01-02 08:06:20
问题 While investigating some issues with relocatable device code, I stumbled upon something I don't quite understand. This is a use case for what is pictured on slide 6. I used an answer of Robert Crovella as a basis for a repro code. The idea is that we have some relocatable device code compiled into a static library (e.g. some math/toolbox library), and we want to use some functions of that precompiled library into another device library of our program: libutil.a ---> libtest.so ---> test_pgm

How do we use cuPrintf()?

家住魔仙堡 提交于 2020-01-01 16:25:11
问题 What do we have to do to use cuPrintf()? (device compute capability 1.2, Ubuntu 12) I couldn't find "cuPrintf.cu" and "cudaPrintf.cuh", so i downloaded their code and include them: #include "cuPrintf.cuh" #include "cuPrintf.cu" By the way this is the rest of the code: __global__ void hello_kernel (float f) { printf ("Thread number %d. f = %d\n", threadIdx.x, f); } int main () { dim3 gridSize = dim3 (1); dim3 blockSize = dim3 (16); cudaPrintfInit (); hello_kernel <<< gridSize, blockSize >>> (1

How do we use cuPrintf()?

大兔子大兔子 提交于 2020-01-01 16:24:07
问题 What do we have to do to use cuPrintf()? (device compute capability 1.2, Ubuntu 12) I couldn't find "cuPrintf.cu" and "cudaPrintf.cuh", so i downloaded their code and include them: #include "cuPrintf.cuh" #include "cuPrintf.cu" By the way this is the rest of the code: __global__ void hello_kernel (float f) { printf ("Thread number %d. f = %d\n", threadIdx.x, f); } int main () { dim3 gridSize = dim3 (1); dim3 blockSize = dim3 (16); cudaPrintfInit (); hello_kernel <<< gridSize, blockSize >>> (1

“warning: __host__ annotation on a defaulted function is ignored” <- why?

北战南征 提交于 2020-01-01 11:37:10
问题 Switching from CUDA 8.0 to CUDA 9.0 RC, I get a warning about: __host__ __device__ ~Foo() = default; The warning is: path/to/Foo.cuh(69): warning: __host__ annotation on a defaulted function("~Foo") is ignored which I didn't use to get before. Should I really be getting this warning? What's wrong with indicating you want the default destructor on both the device and the host side? 回答1: What's wrong with indicating you want the default destructor on both the device and the host side? But that

How do I use other c++ compilers with CUDA on Windows?

六眼飞鱼酱① 提交于 2019-12-29 01:43:33
问题 I'm trying to build a simple application with CUDA and I've been trying for hours on end and I just can't make it work on windows. nvcc absolutely refuses to compile without Visual Studio's compiler which doesn't support things I need. I tried building using nvcc with clang but It just asks me to use Visual Studio's compiler. I've also tried using clang directly since it now supports CUDA but I receive this error: clang++.exe: error: Unsupported CUDA gpu architecture: compute_52 This makes no

VS2010 compiler and cuda error: linkage specification is incompatible with previous “hypot”

邮差的信 提交于 2019-12-25 02:44:46
问题 When I try to build my project on a 64 bit Windows 7 using VS 2010 in Debug 64 bit configuration I get this error along with two other errors. error: linkage specification is incompatible with previous "hypot" in math.h line 161 error: linkage specification is incompatible with previous "hypotf" in math.h line 161 error: function "abs(long long)" has already been defined in math_functions.h line 534 I do not get these errors in the 32 bit build. Also, the 64 bit build worked in VS2008. Is

CUDA: How to link a specific obj, ptx, cubin from a separate compilation?

不打扰是莪最后的温柔 提交于 2019-12-25 02:16:04
问题 I have a fairly large CUDA/C++ project that compiles to a static library. The toolchain is CUDA Toolkit 9.0/9.2 and VS 2017. I cannot change the company toolchain. Our most expensive kernel was hit by a nvcc compiler regression introduced in the 9.0 Toolkit. I have filed this with the Nvidia developer's website, and received confirmation of the regression. That was about a year ago, and the ticket is still open. Maybe the 10.0 Toolkit will fix it. But I cannot wait. So my plan is to compile

CUDA compilation and Linking

强颜欢笑 提交于 2019-12-24 12:36:16
问题 I have host files (say h_A.cpp, etc) which can be compiled by host compiler ( g++ ), device files (say d_A.cu, etc) to be compiled by device compiler ( nvcc ) and host-device files i.e., host functions, kernel call, etc (say h_d_A.cu) to be compiled by device compiler ( nvcc ). Device side compilation nvcc -arch=sm_20 -dc d_A.cu -o d_A.o $(INCLUDES) /* -dc since the file may call / have relocatable device functions */ Host side compilation g++ -c h_A.cpp -o h_A.o $(INCLUDES, FLAGS) Device

Linking Cuda in C++ issue

江枫思渺然 提交于 2019-12-24 09:41:53
问题 I've searched existing questions, but I can't seem to solve this. I have a blur_mask.cc file with: #include <iostream> #include <ctime> #include <opencv2/highgui/highgui.hpp> #include <opencv2/gpu/gpu.hpp> #include <vector_types.h> #include <cuda.h> #include <cuda_runtime.h> extern "C" void gpuBlurMask(unsigned char* srcData, int srcStep, uchar3* dst, int dstStep, int width, int height, float *mask, int maskStep, int maskWidth, int maskHeight, int blockSize=16); using namespace std; using