Is this a duplicate?
Area
cuda.bindings
Is your feature request related to a problem? Please describe.
NVML has a common pattern for specifying the version of struct passed to a function:
(<nvmlType_v2_t*>my_struct).version = sizeof(nvmlType_v2_t) | (2 << 24)
In the NVML header, this is handled by the NVML_STRUCT_VERSION macro:
#define NVML_STRUCT_VERSION(data, ver) (unsigned int)(sizeof(nvml ## data ## _v ## ver ## _t) | \
(ver << 24U))
We can't use this macro directly from cuda-bindings because:
- This is a macro and we don't include the
nvml.h header directly
- Passing a struct name to a function and calling
sizeof on it won't work in Cython
Describe the solution you'd like
There are still some ways this could be made slightly better and more obvious as to what is going on, however. Probably by adding an inline function that does:
nvmlStructVersion(unsigned int sizeof_struct, unsigned int ver)
Called like so:
version = nvmlStructVersion(sizeof(nvmlStruct_v2_t), 2))
Describe alternatives you've considered
No response
Additional context
No response
Is this a duplicate?
Area
cuda.bindings
Is your feature request related to a problem? Please describe.
NVML has a common pattern for specifying the version of struct passed to a function:
In the NVML header, this is handled by the
NVML_STRUCT_VERSIONmacro:We can't use this macro directly from cuda-bindings because:
nvml.hheader directlysizeofon it won't work in CythonDescribe the solution you'd like
There are still some ways this could be made slightly better and more obvious as to what is going on, however. Probably by adding an inline function that does:
Called like so:
Describe alternatives you've considered
No response
Additional context
No response