is it possible to modify or even destroy constant memory in cuda?

sorry for my silly question as beginner… is it possible to modify or even destroy constant memory in cuda? can i do it with [font=monospace]cudaDeviceReset ?[/font]

You can modify contents of constant memory using cudaMemcpyToSymbol().

i still dont get it… if i have already copy the memory from host to device

is it possible if I set it to be zero memory again and then use it later for another different kernel?

“The global, constant, and texture memory spaces are persistent across kernel launches by the same application.” (Programming guide)

This is: your host code can do whatever it likes with the constant memory (i.e. modifying it), but you can not do any dynamic allocation/freeing.

example:

alloc constant mem
memcpytosymbol //fill constant with some values
launch kernel
memcpytosymbol //fill constant with other values
launch another kernel

so it means that the memory will be the all the time either i use it or not, doesnt it?

thanks for enlightenment

Yes the constant memory is always 64 KB. All reads from constant memory are cached.

But constant memory is local to each .cu module. So if your application consists of several kernels distributed over multiple .cu files, each one has its own 64 KB.

When doing a kernel call the CUDA API automatically takes the necessary steps to make that module’s 64kb page of memory cached.

While multiple .cu modules may share other global device variables through extern declarations, this is not possible with constant memory.

Christian