Constant memory

Hi,
Can someone please explain how to allocate dynamic arrays in constant memory? I am able to use cudaMemcpyToSymbol on a pre-defined array
size, but what if I want to copy X floats to constant memory array, where X is determined in runtime, and I know it will be < 10K.

This is how I copy static size array:
#define CONST_KERNEL_PARAMS 14
constant int constKernelParams[ CONST_KERNEL_PARAMS ];

cudaMemcpyToSymbol( constKernelParams, &constHostKernelParams[0], CONST_KERNEL_PARAMS * sizeof( int ), 0 );

Thanks in advance
eyal

You calculate the size of the data you want to copy over. In your case that would be:

int size = sizeof(float) * X;

There is no way to dynamically allocate constant memory at runtime. However, since constant memory has a fixed maximum size (64Kb) you can just allocate an array of this size and then copy in the correct amount of data as suggested by the previous poster.

I see, thanks.

And if I want to put there more then one array? I just need to manage this as flat array?