Coverage for cuda / core / system / _process.pxi: 50.00%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-29 01:27 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4  

5  

6class ProcessInfo: 

7 """ 

8 Information about running compute processes on the GPU. 

9 """ 

10 def __init__(self, device: "Device", process_info: nvml.ProcessInfo): 

11 self._device = device 1a

12 self._process_info = process_info 1a

13  

14 @property 

15 def pid(self) -> int: 

16 """ 

17 The PID of the process. 

18 """ 

19 return self._process_info.pid 1a

20  

21 @property 

22 def used_gpu_memory(self) -> int: 

23 """ 

24 The amount of GPU memory (in bytes) used by the process. 

25 """ 

26 return self._process_info.used_gpu_memory 1a

27  

28 @property 

29 def gpu_instance_id(self) -> int: 

30 """ 

31 The GPU instance ID for MIG devices. 

32  

33 Only valid for processes running on MIG devices. 

34 """ 

35 if not self._device.mig.is_mig_device: 1a

36 raise nvml.NotSupportedError(nvml.Return.ERROR_NOT_SUPPORTED) 1a

37 return self._process_info.gpu_instance_id 

38  

39 @property 

40 def compute_instance_id(self) -> int: 

41 """ 

42 The Compute instance ID for MIG devices. 

43  

44 Only valid for processes running on MIG devices. 

45 """ 

46 if not self._device.mig.is_mig_device: 1a

47 raise nvml.NotSupportedError(nvml.Return.ERROR_NOT_SUPPORTED) 1a

48 return self._process_info.compute_instance_id