Hello,
the following simple program gives me a segmentation fault
__global__ void foo(float a, float b, float c) {}
int main(int argc, char* argv[])
{
int i;
for (i=0; i<11; i++)
foo<<<4, 256>>>(1.0, 2.0, 3.0);
return 0;
}
when I compile it with the following command:
nvcc --compiler-bindir=/usr/bin/gcc-4.3 --device-emulation -g -O3 -o test test.cu
Some more info on my environment:
(uname) Linux 2.6.31-19-generic #56-Ubuntu SMP x86_64 GNU/Linux
(nvcc --version) Cuda compilation tools, release 2.3, V0.2.1221
Note I’m using gcc-4.3 due to problems with CUDA on gcc-4.4 and I’m using the device emulation mode. Also the segfault only occurs when compiling with -O3.
Excerpts from valgrind output (not sure if this helps):
==5022== Conditional jump or move depends on uninitialised value(s)
==5022== at 0x4C271E3: memcpy (mc_replace_strmem.c:77)
==5022== by 0x4E49D7E: (within /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x4E462BE: cudaLaunch (in /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x400C15: main (cuda_runtime.h:713)
==5022==
==5022== Conditional jump or move depends on uninitialised value(s)
==5022== at 0x4C271F8: memcpy (mc_replace_strmem.c:402)
==5022== by 0x4E49D7E: (within /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x4E462BE: cudaLaunch (in /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x400C15: main (cuda_runtime.h:713)
==5022==
==5022== Conditional jump or move depends on uninitialised value(s)
==5022== at 0x4C27245: memcpy (mc_replace_strmem.c:402)
==5022== by 0x4E49D7E: (within /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x4E462BE: cudaLaunch (in /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x400C15: main (cuda_runtime.h:713)
==5022==
==5022== Use of uninitialised value of size 8
==5022== at 0x4C27264: memcpy (mc_replace_strmem.c:402)
==5022== by 0x4E49D7E: (within /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x4E462BE: cudaLaunch (in /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x400C15: main (cuda_runtime.h:713)
==5022==
==5022== Process terminating with default action of signal 11 (SIGSEGV)
==5022== Bad permissions for mapped region at address 0x65B1D2E
==5022== at 0x4C27264: memcpy (mc_replace_strmem.c:402)
==5022== by 0x4E49D7E: (within /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x4E462BE: cudaLaunch (in /home/graviton/software/cuda/lib64/libcudart.so.2.3)
==5022== by 0x400C15: main (cuda_runtime.h:713)
Thanks,
graviton