Using Cuda compilation tools, release 9.2, V9.2.148
Using latest Nsight (5.6.0.18146)
Using MSVC 2015
The following snippet hangs indefinitely when I try to compile it. Can you all confirm?
This is roughly based on c++ - segmentation fault on resizing a vector of large structures - Stack Overflow and I was trying to recreate a stack overflow I saw with thrust in real code.
Consider the following:
Kernel.cuh:
struct tmp_t {
int a_data[100000000];
};
int doAdd();
Kernel.cu:
#include “kernel.cuh”
#include <thrust/host_vector.h>
int doAdd()
{
thrust::host_vector<tmp_t> v_tmp;
v_tmp.resize(1);
return v_tmp.size();
}
Main.cpp:
#include “kernel.cuh”
void main() {
int ret = doAdd();
}
The following command hangs indefinitely and chews up memory:
1> C:\Users.…\CuTest>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin\nvcc.exe” -gencode=arch=compute_37,code="sm_37,compute_37" --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\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 /Fdx64\Debug\vc140.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj “C:\Users.…\CuTest\kernel.cu”