nvcc

Building GPL C program with CUDA module

て烟熏妆下的殇ゞ 提交于 2019-11-28 06:02:44
I am attempting to modify a GPL program written in C. My goal is to replace one method with a CUDA implementation, which means I need to compile with nvcc instead of gcc. I need help building the project - not implementing it (You don't need to know anything about CUDA C to help, I don't think). This is my first time trying to change a C project of moderate complexity that involves a .configure and Makefile. Honestly, this is my first time doing anything in C in a long time, including anything involving gcc or g++, so I'm pretty lost. I'm not super interested in learning configure and

Caffe compilation fails due to unsupported gcc compiler version

我的梦境 提交于 2019-11-28 04:35:34
问题 I struggle with Caffe compilation. Unfortunately I failed to compile it. Steps I followed: git clone https://github.com/BVLC/caffe.git cd caffe mkdir build cd build cmake .. make all Running make all fails with the following error message: [ 2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/util/cuda_compile_generated_im2col.cu.o In file included from /usr/include/cuda_runtime.h:59:0, from <command-line>:0: /usr/include/host_config.h:82:2: error: #error -- unsupported

How can I compile CUDA code then link it to a C++ project?

两盒软妹~` 提交于 2019-11-27 09:10:16
问题 I am looking for help getting started with a project involving CUDA. My goal is to have a project that I can compile in the native g++ compiler but uses CUDA code. I understand that I have to compile my CUDA code in nvcc compiler, but from my understanding I can somehow compile the CUDA code into a cubin file or a ptx file. Here are my questions: How do I use nvcc to compile into a cubin file or a ptx file? Don't I need a -c or something? Which file type do I want to use? What are the g++

Why is NVIDIA Pascal GPUs slow on running CUDA Kernels when using cudaMallocManaged

柔情痞子 提交于 2019-11-27 08:44:19
I was testing the new CUDA 8 along with the Pascal Titan X GPU and is expecting speed up for my code but for some reason it ends up being slower. I am on Ubuntu 16.04. Here is the minimum code that can reproduce the result: CUDASample.cuh class CUDASample{ public: void AddOneToVector(std::vector<int> &in); }; CUDASample.cu __global__ static void CUDAKernelAddOneToVector(int *data) { const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; const int mx = gridDim.x * blockDim.x; data[y * mx + x] = data[y * mx + x] + 1.0f; } void CUDASample:

CUDA: How to use -arch and -code and SM vs COMPUTE

喜夏-厌秋 提交于 2019-11-27 08:01:49
I am still not sure how to properly specify the architectures for code generation when building with nvcc. I am aware that there is machine code as well as PTX code embedded in my binary and that this can be controlled via the controller switches -code and -arch (or a combination of both using -gencode ). Now, according to this apart from the two compiler flags there are also two ways of specifying architectures: sm_XX and compute_XX , where compute_XX refers to a virtual and sm_XX to a real architecture. The flag -arch only takes identifiers for virtual architectures (such as compute_XX )

How to disable a specific nvcc compiler warnings

纵饮孤独 提交于 2019-11-27 05:37:19
问题 I want to disable a specific compiler warning with nvcc , specifically warning: NULL reference is not allowed The code I am working on uses NULL references are part of SFINAE, so they can't be avoided. An ideal solution would be a #pragma in just the source file where we want to disable the warnings, but a compiler flag would also be fine, if one exists to turn off only the warning in question. 回答1: It is actually possible to disable specific warnings on the device with NVCC. It took me ages

CUDA and nvcc: using the preprocessor to choose between float or double

情到浓时终转凉″ 提交于 2019-11-27 04:18:30
The problem : Having a .h, I want to define real to be double if compiling for c/c++ or for cuda with computing capability >= 1.3. If compiling for cuda with computing capability < 1.3 then define real to be float. After many hours I came to this (which does not work ) # if defined(__CUDACC__) # warning * making definitions for cuda # if defined(__CUDA_ARCH__) # warning __CUDA_ARCH__ is defined # else # warning __CUDA_ARCH__ is NOT defined # endif # if (__CUDA_ARCH__ >= 130) # define real double # warning using double in cuda # elif (__CUDA_ARCH__ >= 0) # define real float # warning using

Linking error: DSO missing from command line

北慕城南 提交于 2019-11-27 04:07:15
I am rather new to Linux (using Ubuntu 14.04 LTS 64bit), coming from Windows, and am attempting to port over an existing CUDA project of mine. When linking via /usr/local/cuda/bin/nvcc -arch=compute_30 -code=sm_30,compute_30 -o Main.o Display.o FileUtil.o Timer.o NeuralNetwork.o -L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/cuda/lib64 -lGLEW -lglfw3 -lGL -lGLU -lcuda -lcudart I encounter the following error: /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_clipboard.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding

Why can't nvcc find my Visual C++ installation?

本秂侑毒 提交于 2019-11-27 03:41:04
问题 I'm running Windows 7 Pro x64 on a Core i5 with a NVIDIA 3100m, which is CUDA compatible. I've tried installing both the 32-bit and 64-bit CUDA toolkits from NVIDIA, unfortunately from with either of them I cannot compile anything; nvcc says "cannot find a supported cl version. Only MSVC 8.0 and MSVC 9.0 are supported". I have the x86 and x86-64 compilers installed via the Windows 7 SDK (compiler version 15.00.30729.01 for both arches). Both compilers are operating correctly; I've built and

Why does nvcc fails to compile a CUDA file with boost::spirit?

怎甘沉沦 提交于 2019-11-27 02:24:49
I'm trying to integrate CUDA to an existing aplication wich uses boost::spirit. Isolating the problem, I've found out that the following code does not copile with nvcc: main.cu : #include <boost/spirit/include/qi.hpp> int main(){ exit(0); } Compiling with nvcc -o cudaTest main.cu I get a lot of errors that can be seen here . But if I change the filename to main.cpp , and compile again using nvcc , it works. What is happening here and how can I fix it? nvcc sometimes has trouble compiling complex template code such as is found in Boost, even if the code is only used in __host__ functions. When