Fix multi-GPU with lazy CuPy init + rendering improvements

GPU fix:
- Revert to CUDA_VISIBLE_DEVICES approach but with lazy CuPy init
- gpu.py: CuPy is no longer imported at module level; _init_gpu()
  imports it lazily on first to_gpu() call. This allows workers to
  set CUDA_VISIBLE_DEVICES before CuPy creates a CUDA context.
- gpu.py: detect GPU count via nvidia-smi (no CUDA context needed)
- pipeline.py: each worker sets CUDA_VISIBLE_DEVICES=N before CuPy
  init, so each process uses only its assigned GPU

Rendering improvements:
- Title: split into bold title (14pt) + italic description (10pt)
  instead of single 15pt bold block
- North arrow: moved inside data area (top-right corner) with
  semi-transparent white background for readability over data
- Colorbar: full height (no gap for compass rose), added
  ScalarFormatter(useOffset=False) to avoid scientific notation
- Colorbar compass rose gap removed since north arrow is now
  inside the data area
This commit is contained in:
Antoine Jacquin
2026-05-15 12:24:57 +02:00
parent b4a0e384c9
commit a3f7b44874
3 changed files with 58 additions and 48 deletions

View File

@ -537,10 +537,9 @@ def _process_file_standalone(laz_file_str, input_dir, output_dir, resolution, fo
Each worker gets its own temp directory to avoid file conflicts.
When multiple GPUs are available, each worker is assigned a GPU via
CUDA_VISIBLE_DEVICES to balance load across GPUs.
CuPy's Device API to balance load across GPUs.
"""
# Assign GPU FIRST — before any CuPy import happens
# This sets CUDA_VISIBLE_DEVICES and resets lazy CuPy init
# Assign GPU to this worker using CuPy's Device API
if gpu_id is not None and gpu_id >= 0:
from .gpu import set_active_gpu
set_active_gpu(gpu_id)