Hello,
From what I understand, passing pointer arguments to a cuda kernel with the runtime api will just copy the value of the pointer (the address it points to) to the gpu memory, similar to the treatment of arguments passed by reference (where the value is copied). I notice (by accident) that the following piece of code works in Volta to my surprise.
#include <stdio.h>
#include <stdlib.h>
#include<cuda_runtime.h>
global void myKernel(int a, int b, int* v)
{
printf(“Hello a:%d b:%d \n”,a,b);
*v = 1;
}
int main(int argc, char *argv)
{
int v=0;
myKernel<<<1,1>>>(1,2,&v);
if (cudaSuccess != cudaDeviceSynchronize()) {
printf(" Error \n");
exit(1);
}
fflush(stdout);
printf(" after myKernel: v:%d \n",v);
return 0;
}
It does not work in Pascal, as I would expect. Can someone explain if this is expected behavior in Volta and where in the documentation it is explained.