Page 1 of 1

culaDeviceSgesvd cause nvcc compile error

PostPosted: Sun May 22, 2011 4:55 am
by larsroholm
Hi!

I'm trying to compile the following __device__ function with nvcc:

Code: Select all
__device__ void foo(..., int n) {
    culaDeviceFloat* A = (culaDeviceFloat*)malloc(3 * n * 9 * sizeof(culaDeviceFloat));
    int lda = 3 * n;

    // Fill A with values...
   
    culaDeviceFloat *s, *u, *vt;
    culaDeviceSgesvd('N', 'S', 3 * n, 9, A, lda, s, u, 0, vt, 9);
   
    // Do stuff with vt..
}


If I remove the line with the culaDeviceSgesvd call everything compiles and runs, if I include the line, i get:

Code: Select all
Error   1   error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2008 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin" -I"C:\Program Files (x86)\CULA\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include"    --keep-dir "Release" -maxrregcount=64  --machine 32 --compile    -use_fast_math  -Xcompiler "/EHsc /nologo /Ox /Zi  /MD " -o "Release\gaze_device_functions.cu.obj" "C:\Users\lr\Documents\My Dropbox\Thesis\GPUEyeTracker\GPUEyeTrackerModel\gaze_device_functions.cu"" exited with code 2.


Any ideas for solutions would be much appreciated.

Kind regards,

Lars

Re: culaDeviceSgesvd cause nvcc compile error

PostPosted: Sun May 22, 2011 3:47 pm
by kyle
CULA can't be called inside a device function.

From the looks of your code, you'll probably want to re-factor your code as a series of calls from the host. You can use the __host__ identifier if you'd like to be explicit or just remove the __device__.

Re: culaDeviceSgesvd cause nvcc compile error

PostPosted: Mon May 23, 2011 12:29 am
by larsroholm
Ok, that is too bad. I will have to find a different alternative then.

I am launching a number of kernels in which i need to perform SVDs of small matrices. It is not a possibility to do the SVD call from the host.

Re: culaDeviceSgesvd cause nvcc compile error

PostPosted: Mon May 23, 2011 5:18 am
by kyle
As we've mentioned in other posts, we are working on a batch interface that will allow for you to solve a number of small problems on the GPU. This will be more appropriate for your problem.