dynamic - Is device memory allocated using CudaMalloc inaccessible on the device with free? -


i cannot deallocate memory on host i've allocated on device or deallocate memory on device allocated on host. i'm using cuda 5.5 vs2012 , nsight. because heap that's on host not transferred heap that's on device or other way around, dynamic allocations unknown between host , device?

if in documentation, not easy find. it's important note, error wasn't thrown until ran program cuda debugging , memory checker enabled. problem did not cause crash outside of cuda debugging, would've cause problems later if hadn't checked memory issues retroactively. if there's handy way copy heap/stack host device, that'd fantastic... hopes , dreams.

here's example question:

__global__ void kernel(char *ptr) {   free(ptr); }  void main(void) {   char *ptr;   cudamalloc((void **)&ptr, sizeof(char *), cudamemcpyhosttodevice);   kernel<<<1, 1>>>(ptr); } 

no can't this.

this topic covered in programming guide here

memory allocated via malloc() cannot freed using runtime (i.e., calling of free memory functions device memory). similarly, memory allocated via runtime (i.e., calling of memory allocation functions device memory) cannot freed via free().

it's in section b.18.2 of programming guide, within section b.18 "b.18. dynamic global memory allocation , operations".

the basic reason mechanism used reserve allocations using runtime (e.g. cudamalloc, cudafree) separate device code allocator, , in fact reserve out of logically separate regions of global memory.

you may want read entire b.18 section of programming guide, covers these topics on device dynamic memory allocation.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -