Skip to content

Sixty-four heterogeneous aerosol boxes on one GPU

View code · Download Python script · Download complete 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.population.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 0.56 ms  (cached)
Module particula.gpu.kernels.condensation 2c7d291 load on device 'cuda:0' took 0.34 ms  (cached)
Module particula.gpu.kernels.environment e11375e load on device 'cuda:0' took 0.31 ms  (cached)
Module particula.gpu.kernels._condensation_native 354bfec load on device 'cuda:0' took 0.35 ms  (cached)
Module particula.gpu.kernels.dilution 0472484 load on device 'cuda:0' took 0.39 ms  (cached)
Module particula.gpu.kernels._population_validation c29373d load on device 'cuda:0' took 0.40 ms  (cached)
Module particula.gpu.kernels.thermodynamics 563d292 load on device 'cuda:0' took 0.39 ms  (cached)
Module particula.execution.prepared_guards 5366864 load on device 'cuda:0' took 0.44 ms  (cached)
Module warp.utils f35afd3 load on device 'cuda:0' took 0.47 ms  (cached)
Module warp.math edde159 load on device 'cuda:0' took 0.24 ms  (cached)
Module warp.marching_cubes fb6e712 load on device 'cuda:0' took 0.48 ms  (cached)
Module particula.gpu.kernels._coagulation_budget b4a3978 load on device 'cuda:0' took 0.44 ms  (cached)
Module particula.execution.communication 2909959 load on device 'cuda:0' took 0.42 ms  (cached)
Module particula.gpu.kernels.communication ac9b2a2 load on device 'cuda:0' took 1.63 ms  (cached)
Module particula.gpu.properties.gas_properties edde159 load on device 'cuda:0' took 0.25 ms  (cached)
Module particula.gpu.properties.particle_properties edde159 load on device 'cuda:0' took 0.22 ms  (cached)
Module particula.gpu.dynamics.coagulation_funcs edde159 load on device 'cuda:0' took 0.22 ms  (cached)
Module particula.gpu.dynamics.condensation_funcs edde159 load on device 'cuda:0' took 0.22 ms  (cached)
Module particula.gpu.kernels._condensation_parallel edde159 load on device 'cuda:0' took 0.22 ms  (cached)
Module particula.gpu.kernels.exhaustion 616f81d load on device 'cuda:0' took 1.09 ms  (cached)
Module particula.gpu.kernels.slot_management 0375e2c load on device 'cuda:0' took 0.44 ms  (cached)
Module particula.gpu.kernels.nucleation 1124f09 load on device 'cuda:0' took 2.00 ms  (cached)
Module particula.execution.gpu_resources 30f296c load on device 'cuda:0' took 0.26 ms  (cached)
Module particula.gpu.warp_types edde159 load on device 'cuda:0' took 0.23 ms  (cached)
Module particula.execution.prepared_diagnostics f551690 load on device 'cuda:0' took 0.31 ms  (cached)
Module particula.gpu.kernels.condensation c7ee7df load on device 'cuda:0' took 0.33 ms  (cached)
Module particula.gpu.kernels.condensation 57dfed0 load on device 'cuda:0' took 0.33 ms  (cached)
Module particula.gpu.kernels.condensation 90d906f load on device 'cuda:0' took 0.74 ms  (cached)
Module particula.gpu.kernels._condensation_native 6810d06 load on device 'cuda:0' took 0.32 ms  (cached)
Module particula.gpu.kernels.condensation ad1042e load on device 'cuda:0' took 0.78 ms  (cached)
Module particula.gpu.kernels._condensation_parallel e1c32d8 load on device 'cuda:0' took 1.71 ms  (cached)
Module particula.gpu.kernels._condensation_parallel 78c2c8b load on device 'cuda:0' took 1.17 ms  (cached)
Module particula.gpu.kernels.condensation 988653c load on device 'cuda:0' took 0.87 ms  (cached)
Module particula.gpu.kernels._condensation_native 84b8bd7 load on device 'cuda:0' took 520.21 ms  (compiled)
Module particula.gpu.kernels._condensation_parallel c23a90a load on device 'cuda:0' took 1.93 ms  (cached)
Module particula.gpu.kernels._condensation_parallel 0ab75ea load on device 'cuda:0' took 1.82 ms  (cached)
Module particula.gpu.kernels._condensation_parallel 127d4da load on device 'cuda:0' took 1.84 ms  (cached)
Module particula.gpu.kernels.condensation 6eb1df8 load on device 'cuda:0' took 0.67 ms  (cached)
Module particula.gpu.kernels.condensation c2ff18f load on device 'cuda:0' took 0.66 ms  (cached)
Module particula.gpu.kernels.condensation 04fd3c4 load on device 'cuda:0' took 0.67 ms  (cached)
Module particula.gpu.kernels._condensation_native 374cc9c load on device 'cuda:0' took 481.71 ms  (compiled)
Module particula.gpu.kernels.ion_condensation 79e70b9 load on device 'cuda:0' took 0.47 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