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) - 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 - 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",
"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.2.0.tar.gz
(14.1 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.2.0-py3-none-any.whl
(16.5 kB
view details)
File details
Details for the file ai_compat-0.2.0.tar.gz.
File metadata
- Download URL: ai_compat-0.2.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e4f8b2470280ddd580c71f695e7206269e545fad3247709934db2f07bc531c8
|
|
| MD5 |
36a1268bed2be52c5b91e52d1db7a28b
|
|
| BLAKE2b-256 |
54bdf6181f8f4384eb00ec0c9d2535b670e9c0ed93d95a0c5aacb104f9443ec6
|
File details
Details for the file ai_compat-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_compat-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.5 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 |
fa238ffee54262793952a940ee358df94c13b4d4637f195096be793dd494c7c2
|
|
| MD5 |
36b5441169a26f9c5766f7f9eec6aad9
|
|
| BLAKE2b-256 |
825a12c6d313c1cedf0c418659a3859b3d1135ce1631ff1c613cb9fa3839a920
|