Hey guys,
I’m new to this Forum. I want to ask you for help for a problem I’m facing with cuda. I googled but didn’t find anything about it. Someone had the same probs a few years ago but didn’t receive an solving answer.
If I simply want to allocate some device memory I get this error message:
*** glibc detected *** ./ParticleSystem: free(): invalid next size (normal): 0x0000000001d9c230 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x78a8f)[0x7fbe2ac9ea8f]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x73)[0x7fbe2aca28e3]
/lib/x86_64-linux-gnu/libc.so.6(fclose+0x155)[0x7fbe2ac8d235]
/usr/lib/nvidia-current/libcuda.so(+0x197505)[0x7fbe29c9c505]
/usr/lib/nvidia-current/libcuda.so(+0x199fc3)[0x7fbe29c9efc3]
/usr/lib/nvidia-current/libcuda.so(+0x148188)[0x7fbe29c4d188]
/usr/lib/nvidia-current/libcuda.so(+0x145227)[0x7fbe29c4a227]
/usr/lib/nvidia-current/libcuda.so(+0x145819)[0x7fbe29c4a819]
/usr/lib/nvidia-current/libcuda.so(+0xf5253)[0x7fbe29bfa253]
/usr/lib/nvidia-current/libcuda.so(+0xd9cc4)[0x7fbe29bdecc4]
/usr/lib/nvidia-current/libcuda.so(cuInit+0x4c)[0x7fbe29ba250c]
/usr/local/cuda/lib64/libcudart.so.3(+0xf573)[0x7fbe2b76a573]
/usr/local/cuda/lib64/libcudart.so.3(+0x10938)[0x7fbe2b76b938]
/usr/local/cuda/lib64/libcudart.so.3(cudaMalloc+0x57)[0x7fbe2b78fd07]
./ParticleSystem[0x4012a5]
./ParticleSystem[0x401186]
./ParticleSystem[0x401249]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xff)[0x7fbe2ac44eff]
./ParticleSystem[0x400f49]
======= Memory map: ========
00400000-00406000 r-xp 00000000 08:11 5505748 /home/smoes/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/ParticleSystem
00606000-00607000 r--p 00006000 08:11 5505748 /home/smoes/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/ParticleSystem
00607000-00608000 rw-p 00007000 08:11 5505748 /home/smoes/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/ParticleSystem
01d99000-01dba000 rw-p 00000000 00:00 0 [heap]
7fbe24000000-7fbe24021000 rw-p 00000000 00:00 0
7fbe24021000-7fbe28000000 ---p 00000000 00:00 0
etc etc.
The code snipet that causes the error is that one:
#include "ParticleSystem_kernel.h"
__constant__ int p1;
__constant__ int p2;
__constant__ int p3;
__device__ float * particles;
__device__ int * hash;
__shared__ uint particleAttributes;
__shared__ uint particleCount;
__shared__ uint timestep;
__constant__ float gravitation = 9.81f;
void initCudaMem(float f[], uint length, uint partAttr, uint time)
{
timestep = time;
particleCount = length;
particleAttributes = partAttr;
cutilSafeCall(cudaMalloc(&particles, length * partAttr * sizeof(float)));
//cudaMemcpy(&particles, f, length * particleAttributes * sizeof(float), cudaMemcpyHostToDevice);
//cudaThreadSynchronize ( ) ;
}
I checked the values that are incomming, length * partAttr * sizeof(float) arent bigger then 480 at the moment, if that is any information that can help :)
Thanks,
smoes