Skip to content

Make device properties prettier #210

Closed
@leofang

Description

@leofang
Member

Similar to #205 but for Device properties. Currently we return all of them at once, with the C enumerator names as the keys

@property
def properties(self) -> dict:
# TODO: pythonize the key names
return handle_return(cudart.cudaGetDeviceProperties(self._id))

We should perhaps make the returned object a Python class instead of dict, with nice, pythonic attributes.

Activity

added
cuda.coreEverything related to the cuda.core module
enhancementAny code-related improvements
P0High priority - Must do!
on Nov 1, 2024
added this to the cuda.core beta 2 milestone on Nov 1, 2024
leofang

leofang commented on Nov 1, 2024

@leofang
MemberAuthor

xref: our C++ counterpart (cudax) NVIDIA/cccl#2084

added
P1Medium priority - Should do
and removed
P0High priority - Must do!
on Nov 14, 2024
ksimpson-work

ksimpson-work commented on Jan 18, 2025

@ksimpson-work
Contributor

Piotr suggested we base the exposure on cudaDeviceAttribtues rather than cudaDeviceProperties to reduce the minor version compatibility considerations. WDYT @leofang

leofang

leofang commented on Jan 18, 2025

@leofang
MemberAuthor

Inside you DeviceProperties class we could consider using that. But I don't know how does this help with

to reduce the minor version compatibility considerations

ksimpson-work

ksimpson-work commented on Jan 20, 2025

@ksimpson-work
Contributor

I guess if cuda 13.x.y came out and .y had some great new property we wanted to expose, we would have to wait for 13.z if we used the property struct in the backend, whereas we could expose it right away if we used the attributes. I will look into it and wee what the trade-offs are

leofang

leofang commented on Jan 20, 2025

@leofang
MemberAuthor

Yeah followed-up internally, the device prop struct is frozen by major.0, so any new attributes added in major.minor will not be exposed to the prop struct until the next major release, whereas the attribute query API can immediately gain support by the minor release that adds the new attribute. Let's move away from the device prop struct, and query & cache the attributes lazily (on the as-needed basis).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Medium priority - Should docuda.coreEverything related to the cuda.core moduleenhancementAny code-related improvements

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @leofang@ksimpson-work

    Issue actions

      Make device properties prettier · Issue #210 · NVIDIA/cuda-python