1

I have 2 cpp files setup and functions, 6 .cu files main, flood, timestep, discharge, continuity and copy. I'm trying to compile this to the main call the cpp files and so the flood kernel global and then flood call timestep, discharge, continuity and copy kernels all device.

Something like this:

Main
~functions
~setup
~flood
~~timestep
~~discharge
~~continuity
~~copy

I'm using a GK110 board with CUDA 5.5, but i don't know how to compile in separate sources (I got an error, that device functions requires separation compile mode). I'm also dont know how to use -dc or -rtc={true} and flags for dynamic parallelism.

I tried to do this, but doesn't work:

g++  -c functions.cpp -std=c++0x 
g++  -c setup.cpp -std=c++0x  
nvcc -arch=sm_35 -dc timestep.cu copy.cu continuity.cu discharge.cu
nvcc -arch=sm_35 -dlink timestep.o copy.o continuity.o discharge.o -o link.o -lcudadevrt
nvcc -dc flood.cu -arch sm_35 

When i reach de fifth line I got the error message that the device function call cannot be configured.

Someone can help me?

Seffrin
  • 23
  • 5
  • You know there is CUDA [online documentation](http://docs.nvidia.com/cuda/index.html), and [code samples](http://docs.nvidia.com/cuda/cuda-samples/index.html#axzz2z0cavESl) including dynamic parallelism codes with makefiles that show how to compile? – Robert Crovella Apr 16 '14 at 01:36
  • I'll see this. I had found only for 5.0 and the example there was not helpful. Was only for a simple case. – Seffrin Apr 16 '14 at 02:24

1 Answers1

2

Try:

g++  -c functions.cpp -std=c++0x 
g++  -c setup.cpp -std=c++0x  
nvcc timestep.cu copy.cu continuity.cu discharge.cu flood.cu -arch=sm_35 -lcudadevrt -rdc=true -c
nvcc timestep.o copy.o continuity.o discharge.o flood.o -arch=sm_35 -lcudadevrt -dlink -o dlink.o 
g++ functions.o steup.o dlink.o -o a.out -std=c++0x -L/<path>/cuda/lib<64,32> -lcudart -lcudadevrt
gkanwar
  • 461
  • 1
  • 6
  • 12
user2076694
  • 806
  • 1
  • 6
  • 10
  • I do this, but included main.cu in the nvcc lines, but still have an error. ( a device call cannot be confiured in the line where my kernel - flood - call the other kernel - discharge -). – Seffrin Apr 16 '14 at 12:10
  • 1
    The device call cannot be configured is probably a syntax error in your code, not a problem with your compile sequence. Do you have a function defined somewhere like `__device__ void myfunction(...)` that you are trying to call from host code like `myfunction<<<...>>>(...);` ? – Robert Crovella Apr 16 '14 at 15:59
  • I put all .cu files in one and leftonly my functions.cpp separate. Doing this I was able to complile making a makefile. And the __device__ functions doesn't work, but converting to __global__ yes. – Seffrin Apr 19 '14 at 20:10
  • Couldyou show your newest error of compilation? – user2076694 Apr 21 '14 at 09:35