3. RSA MPI Usage

3.1. Source the environment

source Env.sh

Then, three possibilities can be considered, depending on the complexity of the experiment:

  • run with a command line in the standard case,

  • use a python script for more refined use,

  • build a C++ script for fine-tuned use.

3.2. RSA MPI Paramters

3.2.1. Command lines

Command lines are available with the command:

rsa --help

3.2.2. Parameters description

Option

Type

Description

–dim

int, >= 2

set dimension.

–radius

[double]

set sphere radius.

–seed

[int]

set seed used to generate random numbers.

–size

[int]

set the maximum number of spheres thrown per dart.

–inf

[double, …, double]

set the position of the bottom limit of the simulation domain.

–sup

[double, …, double]

set the position of the upper limit of the simulation domain.

–paraview

int, 0 or 1

disable [0] or activate [0] the feature: write paraview files, default is 0

3.3. Bash Example Run:

Example of usage for 3D RSA with radius 0.02 inside a cube \([0, 1]^3\).

mpirun -n 4 rsa --dim 3 --radius 0.02 --seed 0 --size 10000 --inf 0, 0, 0 --sup 1, 1, 1 --paraview 1

Display your results:

paraview ParaviewOutput/rsa_mpi_0.pvtp
_images/Illustration_example.png

3.4. C++ Script Example

Users may only make use of classes and functions of the namespace user_interface. See the doxygen documentation for the C++ manual.

Example of script: The simplest ``C++`` script:

File:

scripts/main_script.cpp

Run:

mpirun -n 10 /scripts/main_script

Output:

_images/Illustration_main_script.png

Example of script: Example of script using re-iteration:

File:

scripts/main_max_frac.cpp

Run:

  • Dim = 2

  • First Radius = 0.05

  • Box size = \([0, 1]^3\)

  • Seed = 0

  • Number of iteration = 7

  • Radius Factor = 0.5

mpirun -n 10 scripts/reiterate_rsa 2 0.05 1 0 7 0.5

Outputs:

_images/Illustration_frac_max.png
_images/fract_2D_zoom.png

3.5. Using Python API

The Python API is actually a wrapper for the C++ API throught the pybind11 library. See the python manual. For examples, see in scripts_python, to be launched as:

mpiexec -np 2 python3 scripts_python/launch_rsa_mpi.py

3.6. Miscellaneous

  • For the license, see the file LICENSE.

  • Please kindly report bugs and issues through the gitlab interface.

  • If you use this software, please consider citing “Parallel and bias-free RSA algorithm for~maximal Poisson-sphere sampling, Josien & Prat (in preparation)”.