0
votes

I wrote a simple code using CUDA Thrust. I need to allocate a 2D vector on the GPU, but I am getting error MSB3721

D:\Cuda\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include\thrust/device_vector.h(52): error : External calls are not supported (found non-inlined call to _ZN6thrust6detail11vector_baseIiNS_23device_malloc_allocatorIiEEED2Ev) kernel.cu C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 6.0.targets(597,9): error MSB3721: The command ""D:\Cuda\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2012 -ccbin "D:\Microsoft Visual Studio 11.0\VC\bin\x86_amd64" -I"D:\Cuda\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -I"D:\Cuda\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj "D:\VS Codes\Projects\CUDASimpleImageProcessing\CUDASimpleImageProcessing\kernel.cu"" exited with code 2. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

The code is

#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
using namespace thrust;
int main()
{
int height = 5, width = 5;
device_vector<device_vector<int>> d_ndata (height, device_vector<int> (width, 0));
//  d_ndata.resize(newheight, vector<uchar> (newwidth, 0));

return 0;
}

Help pls...

1

1 Answers

1
votes

Thrust doesn't enable to deal with vectors of vectors. You should flatten your matrix to a single vector like the following example:

#include <thrust/host_vector.h>
#include <thrust/device_vector.h>

using namespace thrust;

int main()
{
    int height = 5, width = 5;
    device_vector<int> d_ndata(height*width);

    return 0;
}