Skip to content

Sixty-four heterogeneous aerosol boxes on one GPU

Download Python script · Download script with helper and data files (.zip)

Sixty-four heterogeneous aerosol boxes on one GPU

Section titled “Sixty-four heterogeneous aerosol boxes on one GPU”

What does an ensemble average hide when every box starts under different conditions? Here you will compare per-box inventories and distributions without mistaking co-varying inputs for isolated causes. Read the prepared quick start for state ownership first.

Each box contains 4,096 slots, with 75% initially active: 196,608 resolved particles in total. Temperature varies from 275 to 310 K, pressure from 85 to 105 kPa, relative humidity from 0.8 to 1.8, and physical volume by a factor of sixteen. Water fraction also varies with box and particle radius. These inputs co-vary deliberately; this is a heterogeneous response study, not an isolated estimate of temperature sensitivity.

Water condensation and dilution evolve for 6,000 steps of 1 microsecond (0.006 s total), with four condensation substeps per step. Two particle materials map into three gases, including an inert lane. At twelve observation times, detached snapshots check each box’s particle-plus-gas water and dry inventory against the independent exponential dilution factor. The reusable study helpers are included in the downloadable ZIP; they are also used by the controlled benchmark campaign. The same trajectory is repeated at half the timestep: every particle’s final total mass must change by less than 1%, and each box’s final water vapor by less than 0.1%. Conservation cannot detect an unstable integration; the former coarse timestep produced oscillations.

Python · section 1
"""Manually refreshed heterogeneous CUDA condensation study."""
import matplotlib.pyplot as plt
import warp as wp
from scripts.docs_gpu_figures import history_figures
from scripts.gpu_studies.cases import StudyCase, build_case
from scripts.gpu_studies.trajectories import run_trajectory
def run_example():
"""Execute the full declared workload and all inventory assertions."""
case = StudyCase(
"heterogeneous-evolution",
"condensation",
64,
4096,
occupancy=0.75,
time_step=1e-6,
steps=6000,
heterogeneous=True,
experiment="heterogeneous",
)
initial, process, processes = build_case(case)
report = run_trajectory(case, initial, process, processes)
history_figures(
report,
"64 heterogeneous boxes · " + wp.get_device("cuda:0").name,
forcing=False,
)
print("Active particles:", int(initial.particles.concentration.sum()))
print("Timestep refinement:", report["refinement"])
plt.show()
return report

The first panel compares final particle water uptake across the heterogeneous boxes. The saturation histories show gas depletion and equilibration; the distribution panels expose broadening and growth that a total-mass curve would hide. The heatmap retains every box rather than averaging their different initial conditions into one apparent population.

This complete CUDA workload is refreshed deliberately. CI checks its source and saved outputs without rerunning it. Reproduction requires the matching development version of Particula and an available CUDA GPU.

Python · section 2
if __name__ == "__main__":
run_example()
Explicit cuda invocation
result = run_example()
Warp 1.11.1 initialized:
   CUDA Toolkit 12.9, Driver 13.4
   Devices:
     "cpu"      : "CPU"
     "cuda:0"   : "NVIDIA GeForce RTX 5060" (8 GiB, sm_120, mempool enabled)
   Kernel cache:
     ~/.cache/warp/1.11.1
Module particula.gpu.kernels.condensation 14a649a load on device 'cuda:0' took 1.52 ms  (cached)
Module particula.gpu.kernels.condensation 2c7d291 load on device 'cuda:0' took 1.82 ms  (cached)
Module particula.gpu.kernels.environment e11375e load on device 'cuda:0' took 1.94 ms  (cached)
Module particula.gpu.kernels._condensation_native 34375de load on device 'cuda:0' took 1.28 ms  (cached)
Module particula.gpu.kernels.dilution 0472484 load on device 'cuda:0' took 0.50 ms  (cached)
Module particula.gpu.kernels._population_validation 65eaa49 load on device 'cuda:0' took 1.46 ms  (cached)
Module particula.gpu.kernels.thermodynamics 563d292 load on device 'cuda:0' took 1.90 ms  (cached)
Module particula.execution.prepared_guards e16d312 load on device 'cuda:0' took 1.36 ms  (cached)
Module warp.utils f35afd3 load on device 'cuda:0' took 1.18 ms  (cached)
Module warp.math edde159 load on device 'cuda:0' took 0.23 ms  (cached)
Module warp.marching_cubes fb6e712 load on device 'cuda:0' took 1.06 ms  (cached)
Module particula.execution.communication 2909959 load on device 'cuda:0' took 1.43 ms  (cached)
Module particula.gpu.kernels.communication ac9b2a2 load on device 'cuda:0' took 2.39 ms  (cached)
Module particula.gpu.properties.gas_properties edde159 load on device 'cuda:0' took 2.13 ms  (cached)
Module particula.gpu.properties.particle_properties edde159 load on device 'cuda:0' took 2.18 ms  (cached)
Module particula.gpu.dynamics.coagulation_funcs edde159 load on device 'cuda:0' took 2.19 ms  (cached)
Module particula.gpu.dynamics.condensation_funcs edde159 load on device 'cuda:0' took 2.19 ms  (cached)
Module particula.gpu.kernels._condensation_parallel edde159 load on device 'cuda:0' took 2.20 ms  (cached)
Module particula.gpu.kernels.exhaustion ccbadfa load on device 'cuda:0' took 1.50 ms  (cached)
Module particula.gpu.kernels.slot_management 0375e2c load on device 'cuda:0' took 0.99 ms  (cached)
Module particula.gpu.kernels.nucleation 1124f09 load on device 'cuda:0' took 2.77 ms  (cached)
Module particula.execution.gpu_resources 30f296c load on device 'cuda:0' took 1.97 ms  (cached)
Module particula.gpu.warp_types edde159 load on device 'cuda:0' took 2.15 ms  (cached)
Module particula.execution.prepared_diagnostics ca06582 load on device 'cuda:0' took 1.85 ms  (cached)
Module particula.gpu.kernels.condensation c7ee7df load on device 'cuda:0' took 1.72 ms  (cached)
Module particula.gpu.kernels.condensation 57dfed0 load on device 'cuda:0' took 1.39 ms  (cached)
Module particula.gpu.kernels.condensation 532e336 load on device 'cuda:0' took 1.49 ms  (cached)
Module particula.gpu.kernels._condensation_native 9623455 load on device 'cuda:0' took 3.37 ms  (cached)
Module particula.gpu.kernels.condensation 6dcf18e load on device 'cuda:0' took 1.52 ms  (cached)
Module particula.gpu.kernels._condensation_parallel e3b5b03 load on device 'cuda:0' took 1.50 ms  (cached)
Module particula.gpu.kernels._condensation_parallel 27b2aba load on device 'cuda:0' took 2.48 ms  (cached)
Module particula.gpu.kernels.condensation 2720b0c load on device 'cuda:0' took 1.31 ms  (cached)
Module particula.gpu.kernels._condensation_native a7ac5d1 load on device 'cuda:0' took 1.34 ms  (cached)
Module particula.gpu.kernels._condensation_parallel ffc25c8 load on device 'cuda:0' took 1.45 ms  (cached)
Module particula.gpu.kernels._condensation_parallel 14f65ff load on device 'cuda:0' took 1.51 ms  (cached)
Module particula.gpu.kernels._condensation_parallel 80fa1cf load on device 'cuda:0' took 1.25 ms  (cached)
Module particula.gpu.kernels.condensation b8d2505 load on device 'cuda:0' took 2.14 ms  (cached)
Module particula.gpu.kernels.condensation bda5d03 load on device 'cuda:0' took 2.53 ms  (cached)
Module particula.gpu.kernels.condensation 3ac4759 load on device 'cuda:0' took 2.64 ms  (cached)
Module particula.gpu.kernels._condensation_native d1db25a load on device 'cuda:0' took 3.61 ms  (cached)
Maximum per-box, per-material inventory relative error: 1.7763568394002505e-14
Active particles: 196608
Timestep refinement: {'coarse_time_step_s': 1e-06, 'fine_time_step_s': 5e-07, 'max_particle_total_mass_relative_change': 0.0012557827568553392, 'max_water_vapor_relative_change': 1.427947553533926e-07, 'fine_inventory_relative_error': 4.04121180963557e-14, 'same_physical_duration_and_forcing': True}
Sixty-four heterogeneous aerosol boxes on one GPU: saved scientific figure
Sixty-four heterogeneous aerosol boxes on one GPU · saved execution output

Preserve the differences that matter to your question

Section titled “Preserve the differences that matter to your question”

Keeping each box visible lets this calculation expose heterogeneous response that a pooled size distribution would obscure. The independent dilution ledger checks inventory; the halved timestep checks selected final values. Neither turns the co-varying temperature, pressure, water fraction, and volume into a causal estimate of any one parameter.

For a temperature-sensitivity study, keep initial number density, composition, pressure, and saturation definition controlled while varying temperature. Compare the water uptake per box and size-resolved growth, then refine both timestep and parameter spacing. The environment sweep provides a more controlled route through environmental comparisons.

Explore this topic: Prepared simulations