GPU Utilities#
GPU detection and locking utilities used during pipeline startup.
thesis.core.gpu#
GPU availability detection for the thesis framework.
Provides a single check_gpu() function that tests whether a compatible
GPU probtrackx2 binary and a suitable CUDA runtime are available on the
current system. This check is intended to run once at CLI startup so
that every downstream tool sees a consistent config.hardware.gpu_enabled
value, rather than each interface performing its own ad-hoc detection.
Typical usage:
from thesis.core.gpu import check_gpu
status = check_gpu()
if status.available:
print(f"GPU ready: {status.reason}")
else:
print(f"GPU unavailable: {status.reason}")
- class thesis.core.gpu.GPUStatus[source]#
Bases:
NamedTupleResult of a GPU availability check.
- Variables:
available –
Trueif a compatible GPU binary and CUDA runtime were both found.binary – Name of the selected GPU binary (e.g.
"probtrackx2_gpu11.0"), orNoneif unavailable.cuda_version –
(major, minor)of the detected CUDA runtime, orNone.reason – Human-readable one-liner describing the outcome (suitable for log messages and user-facing warnings).
- Parameters:
- thesis.core.gpu.check_gpu()[source]#
Check whether a compatible GPU probtrackx2 binary is available.
Performs three checks in sequence:
Binary presence — looks for each candidate in
$FSLDIR/bin/then$PATH.CUDA runtime — calls
nvidia-smito determine the maximum CUDA version supported by the installed driver.Version compatibility — for versioned binaries (e.g.
probtrackx2_gpu11.0) the CUDA runtime must be ≥ the encoded version; unversioned binaries (probtrackx2_gpu) only require that some CUDA runtime is present.
The first binary that passes all three checks is selected.
- thesis.core.gpu.present_gpu_binaries()[source]#
Return the subset of
GPU_BINARIESfound on$FSLDIR/binor$PATH.Candidates are returned in
GPU_BINARIESpreference order. This is a presence check only — CUDA compatibility is validated separately bycheck_gpu().- Return type: