I am checking correctness through cuda-gdb, and in which I found that it is not working as I was expecting. after calling xyz() from global *temp1 should be globalHead1. but debugger shows that temp1 cannot be dereferenced , illegal memory reference. So can anybody point out that where exactly I am missing something.
The code is incomplete, so maybe I am wrong, but I don’t see the point where you will assign any value (reference) to globalHead1 or globalHead2.
As the partial code is, globalHead1 is an non-initialized pointer to Node structure, containing anything but a correct memory reference (probably pointing to adress 0).
Here i am not able to dereference temp1 or temp2. the effect of call xyz() should be like, temp1 = &node1, so *temp1 will automatically points to node1. but when I debug it, temp1 remains some garbage value like 0x02 instead &temp1. so it cannot dereference it. i am not able to see what is the problem. i guess it is somehow related to double pointer, though not sure.
Can I explicitly allocate that variable to a global memory? if I use device then only one shared copy will be created, so is there any support like volatile in ptx.