device function return type

Hi ,
Can a device function return a 2d array ?

sure, one approach would be to pass a pointer to the device function, that points to the 2D array. Then the device function can “return” the data that way. Alternatively the device function could return a pointer.

It’s probably also possible to return a 2D array.

Anything you can do in C++, you can do in CUDA device code. (with some exceptions, but this is not one of them)

So can you write a function in C++ that returns a 2D array? If so, you are well on your way to doing it in a CUDA device function. If you don’t know how to do that, you should probably start by learning that first.

Ok , Thank you !