Objective:
I am developing a scientific CUDA application, where I have several fields of data on the GPU. I develope in Visual Studio 15 and use the NVIDIAs Nsight 5.4 for debugging the GPU Code. I would like to be able to set breakpoints in the kernels and inspect the memory. I pass the device data pointers to the kernels via a structure holding the pointers.
What does work:
- I can break the code in the kernel.
- I can inspect local variables.
- I can inspect the device memory, if I got the pointer.
- I can print the pointers to the console.
- When I pass the device pointers directly (not as a struct) I can also inspect them.
What does not work:
- I cannot inspect the pointers inside the structure!
This screenshot shows my Visual Studio with the described problem.
Minimal working example:
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
struct Param {
int* a;
int* b;
};
__global__ void kernel(Param param)
{
*param.a = 5;
*param.b = -5;
printf("a: %p, b: %p\n", param.a, param.b);
}
int main()
{
Param param;
cudaMalloc( ¶m.a, sizeof(int) );
cudaMalloc( ¶m.b, sizeof(int) );
kernel<<<1,1>>>(param);
return 0;
}
I would be glad for all help. Maybe you can tryout if the problem does also appear on other configurations!
My Configuration:
- Win 10, 64 bit
- Visual Studio 15
- Nsight 5.4
- GeForce GTX 1080, Driver 385.41
- Cuda 8.0