GPU and TPU compatibility toolkit for AI frameworks
Project description
ai-compat
AI GPU and TPU compatibility toolkit that inspects, tests, and auto-fixes CUDA/driver mismatches and TPU configurations for major AI frameworks.
Features
GPU Support
- GPU + CUDA detection (
nvidia-smi, CUDA paths, cuDNN) - Framework scanner for PyTorch, TensorFlow, ONNX Runtime, diffusers, transformers
- Compatibility checker with JSON rules
- Auto-fix suggestions + optional pip installs
- GPU diagnostics (PyTorch/TensorFlow/ONNX/VRAM tests)
TPU Support
- Cloud TPU detection via
gcloudCLI - Edge TPU detection (USB/PCIe devices, pycoral)
- TensorFlow TPU compatibility checking
- TPU diagnostics (Cloud TPU, Edge TPU, TensorFlow TPU)
- Auto-fix suggestions for TPU setup
General
- Environment file exporter (
gpu-env.txtortpu-env.txt) - System resource snapshot (RAM + disk usage)
- CLI entry point:
ai-compat - Works with both GPU and TPU simultaneously
Quickstart
pip install ai-compat
ai-compat scan # Scan system for GPU and TPU
ai-compat check # Check compatibility issues
ai-compat fix --apply # Auto-fix issues
ai-compat test # Run all tests (GPU + TPU)
ai-compat test --gpu-only # Run only GPU tests
ai-compat test --tpu-only # Run only TPU tests
ai-compat export --output env.txt
Example Output
ai-compat check
{
"issues": [
{
"framework": "PyTorch",
"message": "PyTorch 2.2.1 requires CUDA ['12.1', '12.2'] but system has 11.8",
"severity": "error",
"suggestion": "Install CUDA 12.1/12.2 or install PyTorch wheel matching CUDA 11.8"
}
],
"summary": "Detected 1 issue(s)",
"metadata": {
"gpu_count": 1,
"cuda_version": "11.8",
"driver_version": "535.104"
}
}
Architecture
ai_compat/
cli.py # command-line interface
scanner.py # system + framework inspection
gpu.py # low-level GPU detection
tpu.py # TPU detection (Cloud + Edge)
checker.py # rules-based compatibility engine
fixer.py # auto-fix planner
tester.py # GPU + TPU diagnostics
exporter.py # environment generator
rules/
cuda_rules.json
pytorch_rules.json
tensorflow_rules.json
tpu_rules.json
TPU Detection
Cloud TPU
- Requires
gcloudCLI installed and configured - Detects TPU via
gcloud compute tpus list - Checks connectivity and TensorFlow TPUClusterResolver access
Edge TPU
- Detects USB/PCIe Edge TPU devices
- Checks for
/dev/apex_0device - Requires
pycoralfor full functionality
Limitations
- Requires
nvidia-smifor NVIDIA GPU detection - Cloud TPU detection requires
gcloudCLI - Edge TPU detection requires
pycoralfor full functionality - System resource snapshot uses
psutilwhen available (falls back to/proc/sysconf) - Auto-fix commands run via
pip;--applyexecutes them (use with caution) - VRAM stress test relies on PyTorch
- Rules JSON provides conservative reference mappings; update as needed
Example: GPU + TPU Detection
$ ai-compat scan
{
"platform": "Linux 5.15.0",
"python_version": "3.10.12",
"resources": {
"ram_total_gb": 12.7,
"ram_available_gb": 11.4,
"disk_total_gb": 107.7,
"disk_used_gb": 38.9,
"disk_free_gb": 68.8
},
"gpu": {
"gpu_count": 1,
"gpus": [{"name": "NVIDIA RTX 4090", "memory_total_gb": 24.0}],
"cuda": {"version": "12.1", "cudnn_version": "8.9"}
},
"tpu": {
"tpu_count": 1,
"has_cloud_tpu": true,
"has_edge_tpu": false,
"cloud_tpu_available": true,
"tpus": [{"type": "cloud", "accelerator_type": "v2-8"}]
},
"frameworks": {
"tensorflow": {
"version": "2.16.0",
"gpu_available": true,
"tpu_available": true
}
}
}
Contributions welcome!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ai_compat-0.3.0.tar.gz
(15.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ai_compat-0.3.0-py3-none-any.whl
(17.2 kB
view details)
File details
Details for the file ai_compat-0.3.0.tar.gz.
File metadata
- Download URL: ai_compat-0.3.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d163d10988c894a6224bdba1e343732b3e5b99397557bfbe05f7ed1bc9f2f74
|
|
| MD5 |
4d7d1eb7622c0ba53e0364aaed045e92
|
|
| BLAKE2b-256 |
063e08703f6a3db764fd05a499b8ed72873e7b995db6d016d47cb018f2dbff01
|
File details
Details for the file ai_compat-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ai_compat-0.3.0-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b02a505d703e14ef813011810a823581897de2e4dc99547d9cd3db7f21c26574
|
|
| MD5 |
2dfd583e6e100d2bb1f72b2d380e0d07
|
|
| BLAKE2b-256 |
2cbc01593ab21e82e5ab6b6fff841c5677375e764681f2176f9fc9da8bdaf2e4
|