A little Question to CudaMemCopy


i am very new in this Buisness and I have an, i think quiet easy problem, but i cant come over this.

I try to write a little particle application and now i need to bring some data about the particlesdirection, their speed, lifetime and so on to my Geforce 8800.

The positions work well, ich use the VertexBuffer from the SimpleD3D Example for them. But now i need the particledirections and i thought i just copy them to the Device and can then use them in my Kernel, but the following code always craches on the “cudaMalloc” or “cudaMemcpy” and i dont know why :(

float3 *dev_CudaDirections;

float3 *host_CudaDirections;

host_CudaDirections= new float3[maxPart];


        for (int i = 0; i < maxPart; i++)


  host_CudaDirections[i].x = RANDOM->getFloat(-1.0f,1.0f);

  host_CudaDirections[i].y = RANDOM->getFloat(-1.0f,1.0f);

  	host_CudaDirections[i].z = RANDOM->getFloat(-1.0f,1.0f);


	cudaMalloc( (void**)&dev_CudaDirections , maxPart*sizeof(float3) );

	cudaMemcpy( dev_CudaDirections, host_CudaDirections,maxPart*sizeof(float3), 

        cudaMemcpyHostToDevice );

I am calling this code from C++, might this be my problem perhaps ?

I have no idea.

I would be happy about some help :)

( I am using the

2.0 Beta CUDA

Windows Vista

Visual Studio 2005)