omicverse.settings.cpu_gpu_mixed_init

omicverse.settings.cpu_gpu_mixed_init#

settings.cpu_gpu_mixed_init(devices=None)[源代码]#

Initialize CPU-GPU mixed mode for accelerated single-cell analysis.

参数:

devices (int | str | None, optional) – CUDA device to pin for the torch-backed mixed-mode kernels. Accepts an index (1), a string ("1" or "cuda:1"), or a single-element list. None (default) keeps the previous behaviour of using torch’s current device. On a shared multi-GPU server this lets you route omicverse to a free GPU (e.g. GPU 1 while another user holds GPU 0) without touching CUDA_VISIBLE_DEVICES. The selected device is pinned via torch.cuda.set_device so downstream kernels that resolve a bare "cuda" (through current_device) land on it, and is recorded in ov.settings.device.

返回:

  • None – Sets self.mode to 'cpu-gpu-mixed' and reports detected accelerators.

  • Examples – >>> import omicverse as ov >>> # Initialize mixed mode for better performance >>> ov.settings.cpu_gpu_mixed_init() >>> # Pin GPU 1 on a shared multi-GPU server >>> ov.settings.cpu_gpu_mixed_init(devices=1) >>> adata = ov.pp.qc(adata) # Automatically uses mixed mode on GPU 1