taeda 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taeda/__init__.py +3 -0
- taeda/tflops.py +58 -0
- taeda-0.1.0.dist-info/METADATA +82 -0
- taeda-0.1.0.dist-info/RECORD +6 -0
- taeda-0.1.0.dist-info/WHEEL +5 -0
- taeda-0.1.0.dist-info/top_level.txt +1 -0
taeda/__init__.py
ADDED
taeda/tflops.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
import torch
|
|
3
|
+
import pynvml
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_tflops(device_num=0):
|
|
7
|
+
"""
|
|
8
|
+
Estimate theoretical FP32 GPU performance in TFLOPS.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
if not torch.cuda.is_available():
|
|
12
|
+
return None
|
|
13
|
+
|
|
14
|
+
if not 0 <= device_num < torch.cuda.device_count():
|
|
15
|
+
raise ValueError("Invalid GPU index")
|
|
16
|
+
|
|
17
|
+
pynvml.nvmlInit()
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
gpu = torch.cuda.get_device_properties(device_num)
|
|
21
|
+
handle = pynvml.nvmlDeviceGetHandleByIndex(device_num)
|
|
22
|
+
|
|
23
|
+
# CUDA cores per SM depends on GPU architecture.
|
|
24
|
+
cores_per_sm = {
|
|
25
|
+
(5, 0): 128,
|
|
26
|
+
(5, 2): 128,
|
|
27
|
+
(5, 3): 128,
|
|
28
|
+
(6, 0): 64,
|
|
29
|
+
(6, 1): 128,
|
|
30
|
+
(6, 2): 128,
|
|
31
|
+
(7, 0): 64,
|
|
32
|
+
(7, 5): 64,
|
|
33
|
+
(8, 0): 64,
|
|
34
|
+
(8, 6): 128,
|
|
35
|
+
(8, 9): 128,
|
|
36
|
+
(9, 0): 128,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
capability = (gpu.major, gpu.minor)
|
|
40
|
+
cores = cores_per_sm.get(capability)
|
|
41
|
+
|
|
42
|
+
if cores is None:
|
|
43
|
+
raise NotImplementedError(
|
|
44
|
+
f"Unknown CUDA architecture: {capability}"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
cuda_cores = gpu.multi_processor_count * cores
|
|
48
|
+
|
|
49
|
+
clock_mhz = pynvml.nvmlDeviceGetClockInfo(
|
|
50
|
+
handle, pynvml.NVML_CLOCK_SM
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
clock_ghz = clock_mhz / 1000
|
|
54
|
+
|
|
55
|
+
return cuda_cores * clock_ghz * 2 / 1000
|
|
56
|
+
|
|
57
|
+
finally:
|
|
58
|
+
pynvml.nvmlShutdown()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: taeda
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A torch utils library
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: torch
|
|
9
|
+
Requires-Dist: nvidia-ml-py
|
|
10
|
+
|
|
11
|
+
# Taeda
|
|
12
|
+
|
|
13
|
+
**A lightweight Python library for GPU utilities and performance estimation.**
|
|
14
|
+
|
|
15
|
+
Taeda is a Python package built with PyTorch and NVIDIA Management Library (NVML) to retrieve GPU information and estimate theoretical floating-point performance (TFLOPS).
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Detect available NVIDIA CUDA GPUs.
|
|
20
|
+
- Retrieve GPU clock speeds in real time.
|
|
21
|
+
- Calculate CUDA core counts.
|
|
22
|
+
- Estimate theoretical FP32 TFLOPS.
|
|
23
|
+
- Support multiple NVIDIA GPUs.
|
|
24
|
+
- Simple Python API.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install taeda
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- Python 3.9+
|
|
35
|
+
- PyTorch
|
|
36
|
+
- NVIDIA GPU
|
|
37
|
+
- NVIDIA drivers
|
|
38
|
+
- `nvidia-ml-py`
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import taeda
|
|
44
|
+
|
|
45
|
+
tflops = taeda.get_tflops(0)
|
|
46
|
+
|
|
47
|
+
print(f"GPU Performance: {tflops:.3f} TFLOPS")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Example output:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
GPU Performance: 0.622 TFLOPS
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### `get_tflops(device_num=0)`
|
|
59
|
+
|
|
60
|
+
Estimates the theoretical FP32 performance of an NVIDIA GPU.
|
|
61
|
+
|
|
62
|
+
| Parameter | Description |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `device_num` | CUDA GPU index (default: `0`) |
|
|
65
|
+
|
|
66
|
+
**Returns:** Estimated FP32 performance in TFLOPS (`float`), or `None` if CUDA is unavailable.
|
|
67
|
+
|
|
68
|
+
**Raises:** `ValueError` if the GPU index is invalid.
|
|
69
|
+
|
|
70
|
+
The clock speed is retrieved dynamically through NVML.
|
|
71
|
+
|
|
72
|
+
## Limitations
|
|
73
|
+
|
|
74
|
+
- TFLOPS values are theoretical estimates, not measured benchmark results.
|
|
75
|
+
- Clock speeds fluctuate depending on GPU load, temperature and power limits.
|
|
76
|
+
- CUDA core counts depend on GPU architecture.
|
|
77
|
+
- Currently intended for supported NVIDIA CUDA GPUs.
|
|
78
|
+
- Actual application performance depends on memory bandwidth, workload and other hardware limitations.
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT License.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
taeda/__init__.py,sha256=o9zKyMRoNJDe8U0tfTTI2EPguXZ1t0Lbc8gxNII-AMg,49
|
|
2
|
+
taeda/tflops.py,sha256=3y1oV11hwLfaegnEj9w31z47SLkstV5qKF2Fy3fbIK4,1417
|
|
3
|
+
taeda-0.1.0.dist-info/METADATA,sha256=JiZQ5yb8DdDIUNyobHtIKa8W0TANc7MBbIdx5YtagHU,1881
|
|
4
|
+
taeda-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
taeda-0.1.0.dist-info/top_level.txt,sha256=oSzjuexM7IPB2lL236IuexsuGoG1XdLvp6R1FHWjhUE,6
|
|
6
|
+
taeda-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
taeda
|