Repository navigation
Troubleshooting and FAQ
Back to Home · Previous: Architecture Overview
Your Python environment lacks development headers (common on minimal Slurm/compute nodes).
-
Ubuntu/Debian:
sudo apt-get install python3.12-dev -
Conda:
conda install python=3.12inside the active environment includesPython.h. -
Container alternative: run
docker/Dockerfileordocker/21cmcu.defwhere headers,libgsl-dev, andlibfftw3-devare pre-installed.
Install single-precision FFTW3 (libfftw3-dev on Ubuntu, providing libfftw3f.so.3) and GSL (libgsl-dev), or point LD_LIBRARY_PATH / PKG_CONFIG_PATH / CPATH to your HPC module or Conda environment, then re-run ./scripts/install.sh.
By default, USE_CUDA=False (strict mode) to match upstream 21cmFAST behavior. Either wrap your code in with py21cmcu.use_mode("fast"): or export P21_USE_CUDA=1 P21_CUDA_MODE=fast. Verify with 21cmcu doctor that compiled=True and available=True.
In 21cmFAST v4.3, astrophysical parameters split into ACG (atomic cooling galaxies) and MCG (molecular cooling minihaloes):
- Use
F_STAR10_ACG,F_ESC10_ACG,ALPHA_STAR_ACG, andLX_OVER_SFR_ACGwhen callingInputParameters.evolve_input_structs(...). - Note:
21cmcu batchCLI automatically maps legacy names in CSV/JSON parameter tables to their_ACG/_MCGcounterparts.
When USE_TS_FLUCT=True or inhomogeneous recombinations are enabled, node_redshifts must span from above Z_HEAT_MAX down to your target output redshift, e.g.:
inputs = p21.InputParameters(
random_seed=42,
node_redshifts=[8.0, 9.5, 11.0, 12.5],
).evolve_input_structs(USE_TS_FLUCT=True, Z_HEAT_MAX=12.0)
coeval = p21.run_coeval(inputs=inputs, out_redshifts=[8.0])[0]In v4.3, pass PERTURB_ALGORITHM="2LPT" or PERTURB_ALGORITHM="ZELDOVICH" to evolve_input_structs(...).
- Reduce device cache budget:
export P21_CUDA_REGISTRY_MB=2048. - Call
py21cmcu.cleanup_cuda()between unrelated simulation dimensions. - Use
PERTURB_ON_HIGH_RES=False(loperturbation onHII_DIM³rather thanDIM³). - For
1536³–2048³, assign multiple GPUs (set_cuda_devices([0, 1, 2])).
At 2048³ (8.590 B voxels), Zel'dovich fits natively inside 3× 24 GB VRAM via single-work-slab streaming (58.467 s, ~72 GB host RAM budget). Standard in-memory 2LPT requires ~235 GiB host RAM; to run 2048³ 2LPT under <160 GiB host RAM, enable Direction P host streaming (export P21_CUDA_MGPU_2LPT_HOST_STREAM=1).
21cmCU resolves libnccl.so.2 (>= 2.7) via dlopen without build-time linking. If your HPC module puts NCCL in a non-standard library directory, set:
export P21_NCCL_LIB=/path/to/libnccl.so.2To bypass NCCL and use direct P2P or pinned host-bounce transposes, set P21_CUDA_MGPU_BACKEND=p2p or host.
- In
run_batch(..., resume=True), eachtask_idvalidates a SHA-256 fingerprint covering simulation inputs and analysis options (wedge_filter,noise_sigma_mk,ps_n_bins, etc.). Changing parameters, seeds, or analysis settings with the sametask_idautomatically recomputes rather than returning stale outputs. - In
NativeNestedSampler/NativeEnsembleMCMC,Likelihood21cmcheckpoints store full input/data/covariance SHA-256 fingerprints automatically; custom Python callables (andJointLikelihoodcontaining custom callables) require an explicit matchingmodel_id="..."onresume=Trueand raiseValueErrorif missing or mismatched (alongside stratified 32-point probe checks) so localized likelihood edits can never silently resume stalelogZor MCMC states.
Always pass an explicit out_redshift=... (matching your data_pk) when base_inputs.node_redshifts has more than one entry so single evaluations (simulate()) and batched evaluations (simulate_batch()) target the exact intended redshift slice. If a required observed NaN/inf from the forward model, Likelihood21cm strictly returns -inf rather than dropping bins.
21cmCU v1.0.0 · Native C/CUDA + cuFFT Engine for 21cmFAST v4 · See CHANGELOG.md and BENCHMARKS.md in the main repository.
Getting Started
Simulation & Science Pipelines
- Precision Modes & Calibration
- Multi-GPU & Large Grids
- Distributed NCCL & Multi-Node
- Residency & I/O
- SBI & Batch Pipeline
- Bayesian Inference & Samplers
- Multi-Probe, Fisher & Topology
- Interferometer Mock & Forecast
- Lightcone Optimization & 3D Viz
Reference