Skip to content

Commit

Permalink
add smilei_omp_threads in namelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Perez committed Apr 25, 2024
1 parent 4564449 commit 1fc01c7
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 39 deletions.
2 changes: 1 addition & 1 deletion benchmarks/gpu/tst3d_gpu_o2_thermal_plasma_medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def InitialChargeDensity(x, y, z):
number_of_patches = kPatchPerGridDimension,
EM_boundary_conditions = [ ["periodic"] ],
print_every = 10,
random_seed = smilei_mpi_rank)
)

Vectorization(mode = "off")

Expand Down
1 change: 0 additions & 1 deletion benchmarks/gpu/tst3d_gpu_o2_thermal_plasma_short.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
gpu_computing = True,

# random_seed = 0xDEADBEEF,
random_seed = smilei_mpi_rank,
)

Vectorization(
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/gpu/tst3d_v_o2_thermal_plasma_medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def InitialChargeDensity(x, y, z):
number_of_patches = kPatchPerGridDimension,
EM_boundary_conditions = [ ["periodic"] ],
print_every = 10,
random_seed = smilei_mpi_rank)
)

Vectorization(mode = "on")

Expand Down
1 change: 0 additions & 1 deletion benchmarks/gpu/tst3d_v_o2_thermal_plasma_short.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
gpu_computing = False,

# random_seed = 0xDEADBEEF,
random_seed = smilei_mpi_rank,
)

Vectorization(
Expand Down
1 change: 0 additions & 1 deletion benchmarks/tst2d_18_em_pml.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
['PML','PML'],
],
number_of_pml_cells = [[10,10],[10,10]],
random_seed = smilei_mpi_rank
)

Antenna(
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst2d_s_o4_laser_wake_vay.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

solve_poisson = False,
print_every = 100,

random_seed = smilei_mpi_rank
)

MovingWindow(
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst2d_s_o4_radiation_pressure_acc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
['silver-muller'],
['periodic'],
],

random_seed = smilei_mpi_rank
)

Vectorization(
Expand Down
1 change: 0 additions & 1 deletion benchmarks/tst2d_tasks_01_radiation_pressure_acc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
['periodic'],
],
cluster_width = 16,
random_seed = smilei_mpi_rank
)


Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst2d_v_o2_em_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
],

EM_boundary_conditions_k = [[cos(ang), sin(ang)],[-1.,0.],[0.,1.],[0.,-1.]],

random_seed = smilei_mpi_rank
)

Vectorization(
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst2d_v_o4_em_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
],

EM_boundary_conditions_k = [[cos(ang), sin(ang)],[-1.,0.],[0.,1.],[0.,-1.]],

random_seed = smilei_mpi_rank
)

Vectorization(
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst2d_v_o4_laser_wake_vay.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

solve_poisson = False,
print_every = 100,

random_seed = smilei_mpi_rank
)

Vectorization(
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/tst2d_v_o4_multiphoton_Breit_Wheeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ def n0_positron(x,y):
simulation_time = Tsim,

EM_boundary_conditions = [field_cond, field_cond],

random_seed = smilei_mpi_rank,

reference_angular_frequency_SI = wr
)

Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst2d_v_o4_radiation_pressure_acc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
['silver-muller'],
['periodic'],
],

random_seed = smilei_mpi_rank
)


Expand Down
2 changes: 0 additions & 2 deletions benchmarks/tst3d_s_o4_em_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
simulation_time = Tsim,

EM_boundary_conditions = [ ['silver-muller'] ],

random_seed = smilei_mpi_rank
)

LaserGaussian3D(
Expand Down
11 changes: 6 additions & 5 deletions doc/Sphinx/Overview/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Changes made in the repository (not released)
* Features:

* Relativistic field initialization now supports multiple species and both direction propagations.
* Added the argument ``phase_offset`` in laser definitions such as ``LaserGaussian2D``.
* The ``LaserGaussianAM`` definition will only use one coordinate for its ``focus`` argument
(the transverse coordinate of the focus in this geometry is zero).
* Small improvements in PML for envelope model (AM and 2D).
* Deprecated ``smilei_rand_max``.
* New namelist variables ``smilei_omp_threads`` and ``smilei_total_cores``.

* Happi:

Expand All @@ -44,11 +50,6 @@ Changes made in the repository (not released)

* Dark theme (click the switch on the bottom left, or set browser preferences).

* Added the argument ``phase_offset`` in laser definitions such as ``LaserGaussian2D``.
* The ``LaserGaussianAM`` definition will only use one coordinate for its ``focus`` argument
(the transverse coordinate of the focus in this geometry is zero).
* Small improvements in PML for envelope model (AM and 2D).

* Bug fixes:

* ``dump_minutes`` often failed to write some checkpoint files.
Expand Down
17 changes: 12 additions & 5 deletions doc/Sphinx/Use/namelist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ for each MPI process). The following steps are executed:

* The rank of the current MPI process as :py:data:`smilei_mpi_rank`.
* The total number of MPI processes as :py:data:`smilei_mpi_size`.
* The maximum random integer as :py:data:`smilei_rand_max`.
* The number of OpenMP threads per MPI :py:data:`smilei_omp_threads`.
* The total number of cores :py:data:`smilei_total_cores`.

#. The namelist(s) is executed.

Expand Down Expand Up @@ -3619,9 +3620,15 @@ namelist. They should not be re-defined by the user!
The total number of MPI processes.

..
<<Not showing this anymore because of new rand system>>
.. py:data:: smilei_rand_max
.. py:data:: smilei_omp_threads
The number of OpenMP threads per MPI.

.. py:data:: smilei_total_cores
The largest random integer.
The total number of cores.

.. note::

These variables can be access during ``happi`` post-processing, e.g.
``S.namelist.smilei_mpi_size``.
14 changes: 9 additions & 5 deletions src/Params/Params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,20 @@ Params::Params( SmileiMPI *smpi, std::vector<std::string> namelistsFiles ) :
PyObject_SetAttrString( Py_main, "_test_mode", Py_False );
PyTools::checkPyError();

// here we add the rank, in case some script need it
// we add the rank, in case some script needs it
PyModule_AddIntConstant( Py_main, "smilei_mpi_rank", smpi->getRank() );

// here we add the MPI size, in case some script need it
// we add the MPI size, in case some script needs it
PyModule_AddIntConstant( Py_main, "smilei_mpi_size", smpi->getSize() );
namelist += string( "smilei_mpi_size = " ) + to_string( smpi->getSize() ) + "\n";

// here we add the larget int, important to get a valid seed for randomization
PyModule_AddIntConstant( Py_main, "smilei_rand_max", RAND_MAX );
namelist += string( "smilei_rand_max = " ) + to_string( RAND_MAX ) + "\n\n";
// we add the openMP size, in case some script needs it
PyModule_AddIntConstant( Py_main, "smilei_omp_threads", smpi->getOMPMaxThreads() );
namelist += string( "smilei_omp_threads = " ) + to_string( smpi->getOMPMaxThreads() ) + "\n";

// we add the total number of cores, in case some script needs it
PyModule_AddIntConstant( Py_main, "smilei_total_cores", smpi->getGlobalNumCores() );
namelist += string( "smilei_total_cores = " ) + to_string( smpi->getGlobalNumCores() ) + "\n";

// Running pyprofiles.py
runScript( string( reinterpret_cast<const char *>( pyprofiles_py ), pyprofiles_py_len ), "pyprofiles.py", globals );
Expand Down
3 changes: 2 additions & 1 deletion src/Python/pyinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@ class MultiphotonBreitWheeler(SmileiComponent):
# Smilei-defined
smilei_mpi_rank = 0
smilei_mpi_size = 1
smilei_rand_max = 2**31-1
smilei_omp_threads = 1
smilei_total_cores = 1

# Variable to set to False for the actual run (useful for the test mode)
_test_mode = True

0 comments on commit 1fc01c7

Please sign in to comment.