Memory Calculator¶
To aid you in the planning and setup of your simulation PIConGPU provides python tools for educated guesses on simulation parameters.
They can be found under lib/python/picongpu/utils
.
Calculate the memory requirement per device.
from picongpu.utils import MemoryCalculator
-
class
picongpu.utils.memory_calculator.
MemoryCalculator
(n_x, n_y, n_z, precision_bits=32)¶ Memory requirement calculation tool for PIConGPU
Contains calculation for fields, particles, random number generator and the calorimeter plugin. In-situ methods other than the calorimeter so far use up negligible amounts of memory on the device.
-
__init__
(n_x, n_y, n_z, precision_bits=32)¶ Class constructor
- Parameters
n_x (int) – number of cells in x direction (per device)
n_y (int) – number of cells in y direction (per device)
n_z (int) – number of cells in z direction (per device)
precision_bits (int) – floating point precision for PIConGPU run
-
mem_req_by_calorimeter
(n_energy, n_yaw, n_pitch, value_size=None)¶ Memory required by the particle calorimeter plugin. Each of the (
n_energy
xn_yaw
xn_pitch
) bins requires a value (32/64 bits). The whole calorimeter is represented twice on each device, once for particles in the simulation and once for the particles that leave the box.- Parameters
n_energy (int) – number of bins on the energy axis
n_yaw (int) – number of bins for the yaw angle
n_pitch (int) – number of bins for the pitch angle
value_size (int) – value size in particle calorimeter {unit: byte} (default: 4)
- Returns
req_mem – required memory {unit: bytes} per device
- Return type
int
-
mem_req_by_fields
(n_x=None, n_y=None, n_z=None, field_tmp_slots=1, particle_shape_order=2, sim_dim=3, pml_n_x=0, pml_n_y=0, pml_n_z=0)¶ Memory reserved for fields on each device
- Parameters
n_x (int) – number of cells in x direction (per device)
n_y (int) – number of cells in y direction (per device)
n_z (int) – number of cells in z direction (per device)
field_tmp_slots (int) – number of slots for temporary fields (see PIConGPU
memory.param
:fieldTmpNumSlots
)particle_shape_order (int) – numerical order of the assignment function of the chosen particle shape CIC : order 1 TSC : order 2 PQS : order 3 PCS : order 4 (see PIConGPU
species.param
)sim_dim (int) – simulation dimension (available for PIConGPU: 2 and 3)
pml_n_x (int) – number of PML cells in x direction, combined for both sides
pml_n_y (int) – number of PML cells in y direction, combined for both sides
pml_n_z (int) – number of PML cells in z direction, combined for both sides
- Returns
req_mem – required memory {unit: bytes} per device
- Return type
int
-
mem_req_by_particles
(target_n_x=None, target_n_y=None, target_n_z=None, num_additional_attributes=0, particles_per_cell=2, sim_dim=3)¶ Memory reserved for all particles of a species on a device. We currently neglect the constant species memory.
- Parameters
target_n_x (int) – number of cells in x direction containing the target
target_n_y (int) – number of cells in y direction containing the target
target_n_z (int) – number of cells in z direction containing the target
num_additional_attributes (int) – number of additional attributes like e.g.
boundElectrons
particles_per_cell (int) – number of particles of the species per cell
sim_dim (int) – simulation dimension (available for PIConGPU: 2 and 3)
- Returns
req_mem – required memory {unit: bytes} per device and species
- Return type
int
-
mem_req_by_rng
(n_x=None, n_y=None, n_z=None, generator_method='XorMin')¶ Memory reserved for the random number generator state on each device.
Check
random.param
for a choice of random number generators. If you find that your required RNG state is large (> 300 MB) please seememory.param
for a possible adjustment of thereservedGpuMemorySize
.- Parameters
n_x (int) – number of cells in x direction (per device)
n_y (int) – number of cells in y direction (per device)
n_z (int) – number of cells in z direction (per device)
generator_method (str) – random number generator method - influences the state size per cell possible options: “XorMin”, “MRG32k3aMin”, “AlpakaRand” - (GPU default: “XorMin”) - (CPU default: “AlpakaRand”)
- Returns
req_mem – required memory {unit: bytes} per device
- Return type
int
-