Skip to content

Commit 43ab96a

Browse files
committed
Address comments from Copilot
1 parent d71888c commit 43ab96a

4 files changed

Lines changed: 44 additions & 43 deletions

File tree

cuda_bindings/cuda/bindings/_nvml.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26829,7 +26829,7 @@ cpdef object device_get_topology_nearest_gpus(intptr_t device, unsigned int leve
2682926829
check_status_size(__status__)
2683026830
if count[0] == 0:
2683126831
return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0]
26832-
cdef view.array deviceArray = view.array(shape=(deviceCount[0],), itemsize=sizeof(intptr_t), format="P", mode="c")
26832+
cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c")
2683326833
with nogil:
2683426834
__status__ = nvmlDeviceGetTopologyNearestGpus(
2683526835
<Device>device,

cuda_core/cuda/core/system/_device.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ClocksEventReasons = nvml.ClocksEventReasons
2121
ClockType = nvml.ClockType
2222
CoolerControl = nvml.CoolerControl
2323
CoolerTarget = nvml.CoolerTarget
24+
FanControlPolicy = nvml.FanControlPolicy
2425
FieldId = nvml.FieldId
2526
GpuP2PCapsIndex = nvml.GpuP2PCapsIndex
2627
GpuP2PStatus = nvml.GpuP2PStatus
@@ -723,7 +724,7 @@ cdef class Device:
723724

724725
On Pascal™ and newer hardware, Auto Boosted clocks are controlled
725726
through application clocks. Use :meth:`set_application_clocks` and
726-
:methd:`reset_application_clocks` to control Auto Boost behavior.
727+
:meth:`reset_application_clocks` to control Auto Boost behavior.
727728

728729
Returns
729730
-------
@@ -1170,6 +1171,7 @@ __all__ = [
11701171
"Device",
11711172
"DeviceArchitecture",
11721173
"DeviceAttributes",
1174+
"FanControlPolicy",
11731175
"FanInfo",
11741176
"FieldId",
11751177
"FieldValue",

cuda_core/docs/source/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ CUDA system information and NVIDIA Management Library (NVML)
9999
system.CoolerTarget
100100
system.DeviceArchitecture
101101
system.DeviceAttributes
102+
system.FanControlPolicy
102103
system.FanInfo
103104
system.FieldId
104105
system.FieldValue

cuda_core/tests/system/test_system_device.py

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -529,47 +529,45 @@ def test_clock():
529529
clock = device.clock(clock_type)
530530
assert isinstance(clock, system.ClockInfo)
531531

532-
for clock_type in system.ClockType:
533-
try:
534-
current_mhz = clock.get_current_mhz()
535-
except system.NotSupportedError:
536-
continue
537-
assert isinstance(current_mhz, int)
538-
assert current_mhz >= 0
539-
540-
current_mhz = clock.get_current_mhz(system.ClockId.CURRENT)
541-
assert isinstance(current_mhz, int)
542-
assert current_mhz >= 0
543-
544-
max_mhz = clock.get_max_mhz()
545-
assert isinstance(max_mhz, int)
546-
assert max_mhz >= 0
547-
548-
try:
549-
max_customer_boost = clock.get_max_customer_boost_mhz()
550-
except system.NotSupportedError:
551-
pass
552-
else:
553-
assert isinstance(max_customer_boost, int)
554-
assert max_customer_boost >= 0
555-
556-
pstate = device.performance_state
557-
558-
min_, max_ = clock.get_min_max_clock_of_pstate_mhz(pstate)
559-
assert isinstance(min_, int)
560-
assert min_ >= 0
561-
assert isinstance(max_, int)
562-
assert max_ >= 0
532+
try:
533+
current_mhz = clock.get_current_mhz()
534+
except system.NotSupportedError:
535+
continue
536+
assert isinstance(current_mhz, int)
537+
assert current_mhz >= 0
538+
539+
current_mhz = clock.get_current_mhz(system.ClockId.CURRENT)
540+
assert isinstance(current_mhz, int)
541+
assert current_mhz >= 0
542+
543+
max_mhz = clock.get_max_mhz()
544+
assert isinstance(max_mhz, int)
545+
assert max_mhz >= 0
563546

564-
try:
565-
offsets = clock.get_offsets(pstate)
566-
except system.InvalidArgumentError:
567-
offsets = system.ClockOffsets(nvml.ClockOffset_v1())
568-
else:
569-
assert isinstance(offsets, system.ClockOffsets)
570-
assert isinstance(offsets.clock_offset_mhz, int)
571-
assert isinstance(offsets.max_offset_mhz, int)
572-
assert isinstance(offsets.min_offset_mhz, int)
547+
try:
548+
max_customer_boost = clock.get_max_customer_boost_mhz()
549+
except system.NotSupportedError:
550+
pass
551+
else:
552+
assert isinstance(max_customer_boost, int)
553+
assert max_customer_boost >= 0
554+
555+
pstate = device.performance_state
556+
557+
min_, max_ = clock.get_min_max_clock_of_pstate_mhz(pstate)
558+
assert isinstance(min_, int)
559+
assert min_ >= 0
560+
assert isinstance(max_, int)
561+
assert max_ >= 0
562+
563+
try:
564+
offsets = clock.get_offsets(pstate)
565+
except system.InvalidArgumentError:
566+
offsets = system.ClockOffsets(nvml.ClockOffset_v1())
567+
assert isinstance(offsets, system.ClockOffsets)
568+
assert isinstance(offsets.clock_offset_mhz, int)
569+
assert isinstance(offsets.max_offset_mhz, int)
570+
assert isinstance(offsets.min_offset_mhz, int)
573571

574572

575573
def test_clock_event_reasons():
@@ -624,7 +622,7 @@ def test_cooler():
624622
assert isinstance(cooler_info, system.CoolerInfo)
625623

626624
signal_type = cooler_info.signal_type
627-
assert isinstance(signal_type, system.CoolerSignalType)
625+
assert isinstance(signal_type, system.CoolerControl)
628626

629627
target = cooler_info.target
630628
assert all(isinstance(t, system.CoolerTarget) for t in target)

0 commit comments

Comments
 (0)