Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get allocated memory size for CUDA buffer

Tags:

cuda

Is it possible to get the size of allocated memory buffer by pointer?

All I found are cudaPointerGetAttributes function and cudaPointerAttributes structure, but latter has no field size or something useful to define the size.

like image 786
Tomilov Anatoliy Avatar asked Sep 08 '26 21:09

Tomilov Anatoliy


1 Answers

Yes. cuMemGetAddressRange() from the Driver API allows you to retrieve base address and size for any device pointer from a CUDA allocation.

like image 171
tera Avatar answered Sep 13 '26 22:09

tera