Files
egutierrez e3c8979e8d chore: auto-commit (95 archivos)
- 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>
2026-05-13 00:50:34 +02:00

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.
cuda
gpu
torch
pytorch
hardware
probe
ml
device
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
sin torch retorna available=False y torch_version=not_installed
con torch sin cuda retorna available=False y device_count=0
claves del dict siempre presentes
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_version es la version de CUDA con la que fue compilado torch, no necesariamente la del sistema.
  • Usar junto a torch_device_select para elegir device y gpu_info para estadisticas de VRAM.
  • impure: depende del estado del hardware y de librerias del sistema en tiempo de ejecucion.