Passing arrays in shared memory to Device functions


I’m quite new to Cuda programming, and I have a question about passing argument from shared memory.

The point is that I like to split my code into auxiliary functions. But it seems that shared memory access has not been intended for such a use.
I have a device function that should work on an array. I’d like to pass this array as an argument, without having to make the transfert from global memory to shared memory in this function. That means, this function could take a shared argument and modify it (and then return void).

For now, I used shared variable outside function for such purpose, and functions use this global variable to exchange argument. Although this solution work, my code look a bit ugly, and I am not sure it is understandable for anyone else.

Regards, Vincent.

I wish there were an easy answer. But trying to tell the compiler that a pointer points to shared memory and not global memory is sometimes difficult. See for example this recent thread: