device memory collison from cudaHostGetDevicePointer
Device memory address collision between cudaMalloc allocation and
cudaHostGetDevicePointer used to get the device address for some pinned host memory
- Did a
HANDLE_ERROR( cudaMalloc( (void**)&dev_S , nScn * sizeof (struct Sdef)));
HANDLE_ERROR( cudaMemcpy( dev_S, *S, nScn * sizeof (struct Sdef),cudaMemcpyHostToDevice ) );
to reserve some global device memory for some stuff.
printf("%s:%ld Scn set (in %p ,dev global out %p)\n", FILE,LINE, *S,dev_S);
tdgpu.cu:602 Scn set (in 0000000000670040 ,dev global out 000000FC00200000)
SO this dev_S is the address in the global memory space to use.
THEN allcated some pinned host memory
HANDLE_ERROR (cudaHostAlloc( (void**) &PB->P, sz2,cudaHostAllocMapped));
HANDLE_ERROR( cudaHostGetDevicePointer(&PB->devP, PB->P, 0));
got the device pointer to it in devP
printf("%s:%ld (P,O):(%p,%p)->(%p,%p) ok\n", FILE,LINE, PB->P,PB->O, PB->devP,PB->devO);
tdgpu.cu:214 (P,O):(0000000008B10000,000000000A1A0000)->(000000FC00200000,000000FC018A0000) ok
P O -> devP, devO
the value I get in device address space for this P is the SAME as the address I got when I did the
cudaMalloc for my scenario’s both 000000FC00200000.