# [[Minfx#Install | Minfx]]
# [[Bmrblib#Install | Bmrblib]]
== mpi4py ==For the model-free and relaxation dispersion analyses in relax, the optimisation can be speed up using Gary Thompson's multi-processor framework. This allows the calculations to be run on a computer cluster. This uses OpenMPI via the # [[mpi4py]] Python package. [http://www.nmr-relax.com/manual/Usage_multi_processor.html See the manual].<br>It requires the installation of '''openmpi''' and the '''mpi4py''' Python package.<br> Remember to check if there are newer versions of [https://bitbucket.org/mpi4py/mpi4py/downloads #Install | mpi4py]. <br>The [https://code.google.com/p/mpi4py/ mpi4py] libraries can be installed on all Linux systems by typing [http://mpi4py.scipy.org/docs/usrman/install.html or check instructions here.]:<source lang="bash"># Install openmpi-devel, to get 'mpicc'sudo yum install openmpi-devel# Check for mpiccwhich mpicc# If not found, try this fix, ref: http://forums.fedoraforum.org/showthread.php?t=194688#For 32 computer.sudo ln -s /usr/lib/openmpi/bin/mpicc /usr/bin/mpicc# For 64 bit computer.sudo ln -s /usr/lib64/openmpi/bin/mpicc /usr/bin/mpicc# Source your shell settings, to find the executable, # or restart your terminal.source $HOME/.cshrc # Then install mpi4pycd $HOME/Downloadswget https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-1.3.1.tar.gztar -xzf mpi4py-1.3.1.tar.gzcd mpi4py-1.3.1#Then eithersudo pip install .# Orpython setup.py buildsudo python setup.py install</source>
== Testing the Python installation ==
# Execute script
relax -g
</source>
=== In multiprocessor mode ===
<source lang="bash">
set RELAX=`which relax`
# Normal
mpirun -np N+1 $RELAX --multi='mpi4py'
# In gui
mpirun -np N+1 $RELAX --multi='mpi4py' -g
</source>
where N is the number of slaves you have. See the mpirun documentation for details - this is not part of relax. <br>
This code runs in the GUI, the script UI and the prompt UI, i.e. everywhere.
== Helper start scripts ==
If you have several versions or development branches of relax installed, you could probably use some of these scripts, and put them in your PATH.
=== Script for force running the disp branch of relax on server computer ===
This script exemplifies a setup, where the above installation requirements is met on one server computer ''haddock'', and where satellite computers
are forced to run on this computer.
The file '''relax_trunk''' is made executable (''chmod +x relax_trunk''), and put in a PATH, known by all satellite computers.
<source lang="bash">
#!/bin/tcsh -f
# Set the lax version used for this script.
set RELAX=/network_drive/software_user/software/NMR-relax/relax_trunk/relax
# Check machine, since only machine haddock have correct packages installed.
if ( $HOST != "haddock") then
echo "You have to run on haddock. I do it for you"
ssh haddock -Y -t "cd $PWD; $RELAX $argv; /bin/tcsh"
else
$RELAX $argv
endif
</source>
=== Script for running the disp branch of relax with maximum number of processors available ===
This script exemplifies a setup, to test the running relax with maximum number of processors.
The file '''relax_test''' is made executable, and put in a PATH, known by all satellite computers.
<source lang="bash">
#!/bin/tcsh -fe
# Set the relax version used for this script.
set RELAX=/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/relax
# Set number of available CPUs.
set NPROC=`nproc`
set NP=`echo $NPROC + 1 | bc `
echo "Running relax with NP=$NP in multi-processor mode"
# Run relax in multi processor mode.
/usr/lib64/openmpi/bin/mpirun -np $NP $RELAX --multi='mpi4py' $argv
</source>