Fix PyCUDA initialization to handle nodes without CUDA-capable devices
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
- Catch RuntimeError from cuda.init() when no GPU is available - Allow coordinator-api to start on nodes without GPUs (simulation mode) - gitea-runner node doesn't have GPU, needs simulation mode fallback
This commit is contained in:
@@ -19,13 +19,15 @@ from aitbc import get_logger
|
||||
# Try to import pycuda, fallback if not available
|
||||
try:
|
||||
import pycuda.driver as cuda
|
||||
# Try to initialize CUDA - will fail if no GPU available
|
||||
cuda.init()
|
||||
import pycuda.autoinit
|
||||
from pycuda.compiler import SourceModule
|
||||
CUDA_AVAILABLE = True
|
||||
except ImportError:
|
||||
except (ImportError, Exception) as e:
|
||||
CUDA_AVAILABLE = False
|
||||
logger = get_logger(__name__)
|
||||
logger.warning("PyCUDA not available. GPU optimization will run in simulation mode.")
|
||||
logger.warning(f"PyCUDA not available or no CUDA-capable device detected: {e}. GPU optimization will run in simulation mode.")
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user