-
Notifications
You must be signed in to change notification settings - Fork 242
Closed
Labels
cuda.bindingsEverything related to the cuda.bindings moduleEverything related to the cuda.bindings moduletriageNeeds the team's attentionNeeds the team's attention
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct
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.hheader directly - Passing a struct name to a function and calling
sizeofon 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
Metadata
Metadata
Assignees
Labels
cuda.bindingsEverything related to the cuda.bindings moduleEverything related to the cuda.bindings moduletriageNeeds the team's attentionNeeds the team's attention