Skip to content

Commit acf5a22

Browse files
committed
fixup
1 parent 640f554 commit acf5a22

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

runs/icon_etopo_global.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
#!/usr/bin/env python3
2+
"""
3+
ICON ETOPO Global Processing Script
4+
5+
IMPORTANT: Thread control environment variables must be set BEFORE numpy/numba import
6+
to prevent thread over-subscription with Dask workers.
7+
"""
8+
import os
9+
10+
# ============================================================================
11+
# CRITICAL: Set thread limits BEFORE importing numpy/numba/scipy
12+
# This prevents thread over-subscription when using Dask with threads_per_worker > 1
13+
# ============================================================================
14+
os.environ['OMP_NUM_THREADS'] = '1'
15+
os.environ['MKL_NUM_THREADS'] = '1'
16+
os.environ['OPENBLAS_NUM_THREADS'] = '1'
17+
os.environ['NUMEXPR_NUM_THREADS'] = '1'
18+
os.environ['NUMBA_NUM_THREADS'] = '1' # Critical: prevents Numba parallel=True conflicts
19+
os.environ['VECLIB_MAXIMUM_THREADS'] = '1'
20+
121
import numpy as np
222
import matplotlib
323
matplotlib.use('Agg') # Use non-GUI backend for parallel processing
@@ -527,7 +547,7 @@ def parallel_wrapper(grid, params, reader, writer, chunk_output_dir, clat_rad, c
527547
'description': 'Generic laptop (16 threads, 16GB RAM)'
528548
},
529549
'dkrz_hpc': {
530-
'total_cores': 8,
550+
'total_cores': 250,
531551
'total_memory_gb': 240.0,
532552
'netcdf_chunk_size': 100,
533553
'memory_per_cpu_mb': None, # SLURM quota on interactive partition

0 commit comments

Comments
 (0)