Verified Commit 81e76837 authored by Adel Kara Slimane's avatar Adel Kara Slimane
Browse files

Add more details in INSTALL.rst about parallel calculations

parent 4c7516c1
Pipeline #36864 passed with stages
in 5 minutes and 35 seconds
......@@ -111,16 +111,29 @@ with the following command:
.. code:: shell
$ mpirun -n 4 -bind-to none python3 doc/examples/quantum_dot.py
$ mpirun -n 4 python3 doc/examples/quantum_dot.py
Note that in the above command, ``mpirun`` will always use the **first**
four cores of the CPU: if a second script is run in parallel using the same
command, the same cores will be used to run it, which will make the simulation
slower, since the same cores are used for both simulations. One way around that
is to use ``mpirun`` with ``--bind-to none`` option:
.. code:: shell
$ mpirun -n 4 --bind-to none python3 doc/examples/quantum_dot.py
The ``-bind-to none`` option is there to not force the OS to use specific
threads to run the 4 copies. If the option is not used, the code will run
on the first 4 threads of the machine: if a second script is run in parallel
using the same command, the same cores will be used to run it, which will make
the simulation slower, since the same cores are used for both simulations.
cores to run the 4 copies. This option comes with a caveat: for CPUs with
`SMT <https://en.wikipedia.org/wiki/Simultaneous_multithreading>`_ enabled
the OS may use the additional hardware threads as cores to fill out the asked number
of cores to use by the ``-n`` option, it may also move them around between
hardware threads, which can decrease the performance compared
to ``-n`` option used alone.
There’s also the possibility of
choosing the threads on which to run the script
There’s also the possibility to
chose the hardware threads (whether `SMT <https://en.wikipedia.org/wiki/Simultaneous_multithreading>`_
is enabled or not) on which to run the script
.. code:: shell
......@@ -133,6 +146,13 @@ command can be written:
$ mpirun -n 5 --cpu-set 0,1,2,3,4 --bind-to core python3 doc/examples/quantum_dot.py
To run two scripts, both on several cores, the best is to manually chose different cores for each script
through the ``--cpu-set`` option.
**N.B.:** If the used computer has 20 cores, 40 threads (when `SMT <https://en.wikipedia.org/wiki/Simultaneous_multithreading>`_
is enabled). The hardware thread indexing in MPI goes as follows: threads indexed from 0 till 19
are located in physically different cores. The the next 20 threads overlap with the previous ones:
20 is on the same core as 0, 21 with 1 etc...
Development
===========
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment