Question about global buffer used in multiple device funtions


I am translating a c code to CUDA kernel, it is a library with multiple interfaces, after translation, these interfaces should be device function calls. Some buffers are maintained inside library itself, these buffers could be used from calling of different interfaces. I curious about what method you commonly use for this situation. Allocate a buffer as a global variable?

I am relatively new in CUDA, and expect your kindly help very much~


As long as you keep a reference to the global memory you’ve defined (in your lib) you’ll be able to access it from multiple kernels/multiple times and

thus “share” the common data.