HfS multiprocessor procedures are versions that use Open MPI (www.open-mpi.org) and run in parallel using a number of processors available in the machines, or in more than one host. The multiprocessor procedures hfs_cube_mp and hfs_nh3_cube_mp are naked versions of the single-processor versions, hfs_cube_sp and hfs_nh3_cube_sp, without any graphic output.
$ mpifort -fno-range-check -mcmodel=medium -ohfs_cube_mp hfs_cube_mp.f90
$ mpifort -fno-range-check -mcmodel=medium -ohfs_nh3_cube_mp hfs_cube_mp.f90
No need of linking with PGplot and X11 libraries. The compilation is performed by the shell script hfs_compile (see Installation in the HfS main page).
$ mpirun -np <N> hfs_cube_mp <parfile>.par
$ mpirun -np <N> hfs_nh3_cube_mp <parfile>.par
where <N>
is the number of processors to use. To know the number (and characteristics) of processors in a Linux system, use
$ cat /proc/cpuinfo
For example, running in localhost and another host <otherhost>:
$ mpirun -np <N> -host localhost,<otherhost> hfs_cube_mp <parfile>.par
$ mpirun -np <N> -host localhost,<otherhost> hfs_nh3_cube_mp <parfile>.par
Here <N>
is the total number of processors to use, distributed among the hosts listed after -host
. If you want to know which are the processes run in each host, use the option -display-map
.
localhost
, make:$ cd $HOME/.ssh
$ ssh-keygen
> enter passphrase: <RET>
A file id_rsa_pub
is created, and has to be copied to <otherhost>:.ssh/
in a file called authorized_keys2
:
$ scp ~/.ssh/id_rsa.pub <user>@<otherhost>:.ssh/authorized_keys2
or, if the file .ssh/authorized_keys2
already exists in <otherhost>
:
$ scp ~/.ssh/id_rsa.pub <user>@<otherhost>:.ssh/id.tmp
$ ssh <otherhost> 'cat .ssh/id.tmp >> .ssh/authorized_keys2; rm .ssh/id.tmp'
Sometimes it is necessary to run in <otherhost>:
$ restorecon -v '.ssh/authorized_keys2'
<otherhost>
. Your PATH
and LD_LIBRARY_PATH
in <otherhost>
have to point to the openmpi bin
and lib
folders in the installation directory. For example, if openmpi is installed in /usr/local/openmpi
, you can include in the file <otherhost>:.bashrc
the lines:export PATH=$PATH:/usr/local/openmpi/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openmpi/lib
<otherhost>
and in localhost
, i.e. the same directory from where you run hfs_cube_mp, with the same paramater file <parfile>
and data files. The log files of the different processors, log/<parfile>_##.log
, will be written in the host where each processor runs.