33# SPDX-License-Identifier: Apache-2.0
44#
55# This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly.
6- # CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f00cb8d39c11e189440ba8c2bd91691d1c460547f22aca74a2c13962e89eac9b
6+ # CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=e15faefa1240f2ec7ced51fb23b040316662bfae80f9a045dd45639c8a7b98d3
77
88
99# <<<< PREAMBLE CONTENT >>>>
@@ -28736,7 +28736,7 @@ cpdef object system_get_hic_version():
2873628736 with nogil:
2873728737 __status__ = nvmlSystemGetHicVersion(<unsigned int*>hwbc_count, hwbc_entries_ptr)
2873828738 check_status(__status__)
28739- return hwbc_entries
28739+ return hwbc_entries[:hwbc_count[0]]
2874028740
2874128741
2874228742cpdef object system_get_topology_gpu_set(unsigned int cpu_number):
@@ -28762,7 +28762,7 @@ cpdef object system_get_topology_gpu_set(unsigned int cpu_number):
2876228762 with nogil:
2876328763 __status__ = nvmlSystemGetTopologyGpuSet(cpu_number, <unsigned int*>count, <nvmlDevice_t*>device_array_ptr)
2876428764 check_status(__status__)
28765- return device_array
28765+ return device_array[:count[0]]
2876628766
2876728767
2876828768cpdef unsigned int unit_get_count() except? 0:
@@ -28919,7 +28919,7 @@ cpdef object unit_get_devices(intptr_t unit):
2891928919 with nogil:
2892028920 __status__ = nvmlUnitGetDevices(<Unit>unit, <unsigned int*>device_count, <nvmlDevice_t*>devices_ptr)
2892128921 check_status(__status__)
28922- return devices
28922+ return devices[:device_count[0]]
2892328923
2892428924
2892528925cpdef unsigned int device_get_count_v2() except? 0:
@@ -29320,7 +29320,7 @@ cpdef object device_get_topology_nearest_gpus(intptr_t device, int level):
2932029320 with nogil:
2932129321 __status__ = nvmlDeviceGetTopologyNearestGpus(<Device>device, <_GpuTopologyLevel>level, <unsigned int*>count, <nvmlDevice_t*>device_array_ptr)
2932229322 check_status(__status__)
29323- return device_array
29323+ return device_array[:count[0]]
2932429324
2932529325
2932629326cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_index) except? -1:
@@ -29838,7 +29838,7 @@ cpdef object device_get_supported_memory_clocks(intptr_t device):
2983829838 with nogil:
2983929839 __status__ = nvmlDeviceGetSupportedMemoryClocks(<Device>device, <unsigned int*>count, clocks_m_hz_ptr)
2984029840 check_status(__status__)
29841- return clocks_m_hz
29841+ return clocks_m_hz[:count[0]]
2984229842
2984329843
2984429844cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int memory_clock_m_hz):
@@ -29865,7 +29865,7 @@ cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int
2986529865 with nogil:
2986629866 __status__ = nvmlDeviceGetSupportedGraphicsClocks(<Device>device, memory_clock_m_hz, <unsigned int*>count, clocks_m_hz_ptr)
2986729867 check_status(__status__)
29868- return clocks_m_hz
29868+ return clocks_m_hz[:count[0]]
2986929869
2987029870
2987129871cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device):
@@ -30702,7 +30702,7 @@ cpdef object device_get_encoder_sessions(intptr_t device):
3070230702 with nogil:
3070330703 __status__ = nvmlDeviceGetEncoderSessions(<Device>device, <unsigned int*>session_count, session_infos_ptr)
3070430704 check_status(__status__)
30705- return session_infos
30705+ return session_infos[:session_count[0]]
3070630706
3070730707
3070830708cpdef tuple device_get_decoder_utilization(intptr_t device):
@@ -30816,7 +30816,7 @@ cpdef object device_get_fbc_sessions(intptr_t device):
3081630816 with nogil:
3081730817 __status__ = nvmlDeviceGetFBCSessions(<Device>device, <unsigned int*>session_count, session_info_ptr)
3081830818 check_status(__status__)
30819- return session_info
30819+ return session_info[:session_count[0]]
3082030820
3082130821
3082230822cpdef tuple device_get_driver_model_v2(intptr_t device):
@@ -30901,7 +30901,7 @@ cpdef object device_get_compute_running_processes_v3(intptr_t device):
3090130901 with nogil:
3090230902 __status__ = nvmlDeviceGetComputeRunningProcesses_v3(<Device>device, <unsigned int*>info_count, infos_ptr)
3090330903 check_status(__status__)
30904- return infos
30904+ return infos[:info_count[0]]
3090530905
3090630906
3090730907cpdef object device_get_graphics_running_processes_v3(intptr_t device):
@@ -30926,7 +30926,7 @@ cpdef object device_get_graphics_running_processes_v3(intptr_t device):
3092630926 with nogil:
3092730927 __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(<Device>device, <unsigned int*>info_count, infos_ptr)
3092830928 check_status(__status__)
30929- return infos
30929+ return infos[:info_count[0]]
3093030930
3093130931
3093230932cpdef object device_get_mps_compute_running_processes_v3(intptr_t device):
@@ -30951,7 +30951,7 @@ cpdef object device_get_mps_compute_running_processes_v3(intptr_t device):
3095130951 with nogil:
3095230952 __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(<Device>device, <unsigned int*>info_count, infos_ptr)
3095330953 check_status(__status__)
30954- return infos
30954+ return infos[:info_count[0]]
3095530955
3095630956
3095730957cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0:
@@ -31024,7 +31024,7 @@ cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long las
3102431024 with nogil:
3102531025 __status__ = nvmlDeviceGetSamples(<Device>device, <_SamplingType>type, last_seen_time_stamp, &sample_val_type, <unsigned int*>sample_count, samples_ptr)
3102631026 check_status(__status__)
31027- return (<int>sample_val_type, samples)
31027+ return (<int>sample_val_type, samples[:sample_count[0]] )
3102831028
3102931029
3103031030cpdef object device_get_bar1_memory_info(intptr_t device):
@@ -31470,7 +31470,7 @@ cpdef object device_get_accounting_pids(intptr_t device):
3147031470 with nogil:
3147131471 __status__ = nvmlDeviceGetAccountingPids(<Device>device, <unsigned int*>count, pids_ptr)
3147231472 check_status(__status__)
31473- return pids
31473+ return pids[:count[0]]
3147431474
3147531475
3147631476cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0:
@@ -31516,7 +31516,7 @@ cpdef object device_get_retired_pages(intptr_t device, int cause):
3151631516 with nogil:
3151731517 __status__ = nvmlDeviceGetRetiredPages(<Device>device, <_PageRetirementCause>cause, <unsigned int*>page_count, addresses_ptr)
3151831518 check_status(__status__)
31519- return addresses
31519+ return addresses[:page_count[0]]
3152031520
3152131521
3152231522cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause):
@@ -31549,7 +31549,7 @@ cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause):
3154931549 with nogil:
3155031550 __status__ = nvmlDeviceGetRetiredPages_v2(<Device>device, <_PageRetirementCause>cause, <unsigned int*>page_count, addresses_ptr, timestamps_ptr)
3155131551 check_status(__status__)
31552- return (addresses, timestamps)
31552+ return (addresses[:page_count[0]] , timestamps[:page_count[0]] )
3155331553
3155431554
3155531555cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1:
@@ -31680,7 +31680,7 @@ cpdef object device_get_process_utilization(intptr_t device, unsigned long long
3168031680 with nogil:
3168131681 __status__ = nvmlDeviceGetProcessUtilization(<Device>device, utilization_ptr, <unsigned int*>process_samples_count, last_seen_time_stamp)
3168231682 check_status(__status__)
31683- return utilization
31683+ return utilization[:process_samples_count[0]]
3168431684
3168531685
3168631686cpdef unit_set_led_state(intptr_t unit, int color):
@@ -32530,7 +32530,7 @@ cpdef object device_get_supported_vgpus(intptr_t device):
3253032530 with nogil:
3253132531 __status__ = nvmlDeviceGetSupportedVgpus(<Device>device, <unsigned int*>vgpu_count, vgpu_type_ids_ptr)
3253232532 check_status(__status__)
32533- return vgpu_type_ids
32533+ return vgpu_type_ids[:vgpu_count[0]]
3253432534
3253532535
3253632536cpdef object device_get_creatable_vgpus(intptr_t device):
@@ -32556,7 +32556,7 @@ cpdef object device_get_creatable_vgpus(intptr_t device):
3255632556 with nogil:
3255732557 __status__ = nvmlDeviceGetCreatableVgpus(<Device>device, <unsigned int*>vgpu_count, vgpu_type_ids_ptr)
3255832558 check_status(__status__)
32559- return vgpu_type_ids
32559+ return vgpu_type_ids[:vgpu_count[0]]
3256032560
3256132561
3256232562cpdef str vgpu_type_get_class(unsigned int vgpu_type_id):
@@ -32802,7 +32802,7 @@ cpdef object device_get_active_vgpus(intptr_t device):
3280232802 with nogil:
3280332803 __status__ = nvmlDeviceGetActiveVgpus(<Device>device, <unsigned int*>vgpu_count, vgpu_instances_ptr)
3280432804 check_status(__status__)
32805- return vgpu_instances
32805+ return vgpu_instances[:vgpu_count[0]]
3280632806
3280732807
3280832808cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance):
@@ -33049,7 +33049,7 @@ cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance):
3304933049 with nogil:
3305033050 __status__ = nvmlVgpuInstanceGetEncoderSessions(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>session_count, session_info_ptr)
3305133051 check_status(__status__)
33052- return session_info
33052+ return session_info[:session_count[0]]
3305333053
3305433054
3305533055cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance):
@@ -33096,7 +33096,7 @@ cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance):
3309633096 with nogil:
3309733097 __status__ = nvmlVgpuInstanceGetFBCSessions(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>session_count, session_info_ptr)
3309833098 check_status(__status__)
33099- return session_info
33099+ return session_info[:session_count[0]]
3310033100
3310133101
3310233102cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) except? 0:
@@ -33408,7 +33408,7 @@ cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last
3340833408 with nogil:
3340933409 __status__ = nvmlDeviceGetVgpuUtilization(<Device>device, last_seen_time_stamp, &sample_val_type, <unsigned int*>vgpu_instance_samples_count, utilization_samples_ptr)
3341033410 check_status(__status__)
33411- return (<int>sample_val_type, utilization_samples)
33411+ return (<int>sample_val_type, utilization_samples[:vgpu_instance_samples_count[0]] )
3341233412
3341333413
3341433414cpdef object device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp):
@@ -33436,7 +33436,7 @@ cpdef object device_get_vgpu_process_utilization(intptr_t device, unsigned long
3343633436 with nogil:
3343733437 __status__ = nvmlDeviceGetVgpuProcessUtilization(<Device>device, last_seen_time_stamp, <unsigned int*>vgpu_process_samples_count, utilization_samples_ptr)
3343833438 check_status(__status__)
33439- return utilization_samples
33439+ return utilization_samples[:vgpu_process_samples_count[0]]
3344033440
3344133441
3344233442cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1:
@@ -33481,7 +33481,7 @@ cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance):
3348133481 with nogil:
3348233482 __status__ = nvmlVgpuInstanceGetAccountingPids(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>count, pids_ptr)
3348333483 check_status(__status__)
33484- return pids
33484+ return pids[:count[0]]
3348533485
3348633486
3348733487cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid):
@@ -33648,7 +33648,7 @@ cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, uns
3364833648 with nogil:
3364933649 __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(<Device>device, profile_id, placements_ptr, <unsigned int*>count)
3365033650 check_status(__status__)
33651- return placements
33651+ return placements[:count[0]]
3365233652
3365333653
3365433654cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0:
@@ -33839,7 +33839,7 @@ cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_
3383933839 with nogil:
3384033840 __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(<GpuInstance>gpu_instance, profile_id, placements_ptr, <unsigned int*>count)
3384133841 check_status(__status__)
33842- return placements
33842+ return placements[:count[0]]
3384333843
3384433844
3384533845cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0:
@@ -35528,8 +35528,8 @@ cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id):
3552835528 """Get GPU instances for given profile ID.
3552935529
3553035530 Unlike most array-returning MIG APIs, ``nvmlDeviceGetGpuInstances`` does
35531- not accept a NULL buffer to discover the count; the caller must size the
35532- buffer from the profile's ``instance_count`` up front .
35531+ not accept a NULL buffer to discover the count; use the number of possible
35532+ placements for the profile as a safe upper bound .
3553335533
3553435534 Args:
3553535535 device (intptr_t): The identifier of the target device.
@@ -35542,9 +35542,13 @@ cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id):
3554235542
3554335543 .. seealso:: `nvmlDeviceGetGpuInstances`
3554435544 """
35545- cdef object profile_info = device_get_gpu_instance_profile_info_by_id_v(device, profile_id)
35546- cdef unsigned int capacity = profile_info.instance_count
35547- cdef unsigned int[1] count = [capacity]
35545+ cdef unsigned int[1] count = [0]
35546+ with nogil:
35547+ __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(
35548+ <Device>device, profile_id, NULL, <unsigned int*>count
35549+ )
35550+ check_status(__status__)
35551+ cdef unsigned int capacity = count[0]
3554835552 cdef _cyb_view.array _gpu_instances_alloc_ = _cyb_view.array(shape=(max(capacity, 1),), itemsize=sizeof(intptr_t), format="q", mode="c")
3554935553 cdef intptr_t *gpu_instances_ptr = <intptr_t *>(_gpu_instances_alloc_.data)
3555035554 if capacity != 0:
@@ -35558,8 +35562,8 @@ cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned
3555835562 """Get compute instances for given profile ID.
3555935563
3556035564 Unlike most array-returning MIG APIs, ``nvmlGpuInstanceGetComputeInstances``
35561- does not accept a NULL buffer to discover the count; the caller must size
35562- the buffer from the profile's ``instance_count`` up front .
35565+ does not accept a NULL buffer to discover the count; use the number of
35566+ possible placements for the profile as a safe upper bound .
3556335567
3556435568 Args:
3556535569 gpu_instance (intptr_t): The identifier of the target GPU instance.
@@ -35572,12 +35576,13 @@ cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned
3557235576
3557335577 .. seealso:: `nvmlGpuInstanceGetComputeInstances`
3557435578 """
35575- # NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED: the only engine profile
35576- # currently defined, and the one nvmlGpuInstanceGetComputeInstances
35577- # itself has no way to select between.
35578- cdef object profile_info = gpu_instance_get_compute_instance_profile_info_v(gpu_instance, profile_id, 0)
35579- cdef unsigned int capacity = profile_info.instance_count
35580- cdef unsigned int[1] count = [capacity]
35579+ cdef unsigned int[1] count = [0]
35580+ with nogil:
35581+ __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(
35582+ <GpuInstance>gpu_instance, profile_id, NULL, <unsigned int*>count
35583+ )
35584+ check_status(__status__)
35585+ cdef unsigned int capacity = count[0]
3558135586 cdef _cyb_view.array _compute_instances_alloc_ = _cyb_view.array(shape=(max(capacity, 1),), itemsize=sizeof(intptr_t), format="q", mode="c")
3558235587 cdef intptr_t *compute_instances_ptr = <intptr_t *>(_compute_instances_alloc_.data)
3558335588 if capacity != 0:
0 commit comments