a802f59f55
- cmd/fn/doctor.go - cmd/fn/main.go - cpp/apps/primitives_gallery/playground/tables/CMakeLists.txt - cpp/apps/primitives_gallery/playground/tables/data_table.cpp - cpp/apps/primitives_gallery/playground/tables/data_table_logic.cpp - cpp/apps/primitives_gallery/playground/tables/data_table_logic.h - cpp/apps/primitives_gallery/playground/tables/self_test.cpp - cpp/apps/primitives_gallery/playground/tables/tql.cpp - cpp/apps/primitives_gallery/playground/tables/viz.cpp - cpp/apps/primitives_gallery/playground/tables/viz.h - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.9 KiB
1.9 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cuda_available | function | py | ml | 1.0.0 | impure | def cuda_available() -> dict | Detecta si CUDA esta disponible via torch. Devuelve device_count, nombres de GPU y version de CUDA. Si torch no esta instalado, retorna available=False sin lanzar excepcion. |
|
false | error_go_core | dict con claves: available (bool), device_count (int), devices (list[str] con nombres de GPU), torch_version (str o 'not_installed'), cuda_version (str | None) | true |
|
python/functions/ml/tests/test_cuda_available.py | python/functions/ml/cuda_available.py |
Ejemplo
from ml.cuda_available import cuda_available
info = cuda_available()
# Sin GPU:
# {
# "available": False,
# "device_count": 0,
# "devices": [],
# "torch_version": "2.3.0",
# "cuda_version": None
# }
# Con GPU:
# {
# "available": True,
# "device_count": 1,
# "devices": ["NVIDIA RTX 4090"],
# "torch_version": "2.3.0",
# "cuda_version": "12.1"
# }
# Sin torch instalado:
# {
# "available": False,
# "device_count": 0,
# "devices": [],
# "torch_version": "not_installed",
# "cuda_version": None
# }
Notas
- Nunca lanza ImportError aunque torch no este instalado.
cuda_versiones la version de CUDA con la que fue compilado torch, no necesariamente la del sistema.- Usar junto a
torch_device_selectpara elegir device ygpu_infopara estadisticas de VRAM. - impure: depende del estado del hardware y de librerias del sistema en tiempo de ejecucion.