Files
org-roam/20230607171316-openmpi.org
2025-11-05 09:18:11 +01:00

3.0 KiB

OpenMPI

OpenMPI is a Message Passing Interface (MPI) library project combining technologies and resources from several other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI). It is used by many TOP500 supercomputers including Roadrunner, which was the world's fastest supercomputer from June 2008 to November 2009, and K computer, the fastest supercomputer from June 2011 to June 2012.

Note: To use OpenMPI, ssh-keys are created just like for borg-backup.

Configure the Host file

Here map the IP adresses to the host names so that it is not requiered to type the ip adresses again and again… For that you need root (sudo)

  sudo nano /etc/hosts

Example for map the IP adresses

 # Standard host addresses
 127.0.0.1  localhost
 ::1        localhost ip6-localhost ip6-loopback
 ff02::1    ip6-allnodes
 ff02::2    ip6-allrouters
 # This host address
 127.0.1.1  <client1>
 #MPI SETUP
 <local IP adress of master>  <master>
 <local IP adress of client>  <client1 but set annother name >

NOTE: Do this for all clients and for the master. The master must known all clients but the clients only there self and the master.

Setting up NFS

NFS is used to share object file among all the systems and sharable datas in this cluster. Mounting the sharable folder:

NFS on Master

  yay nfs-utils
  mkdir <name of sharable folder>
  cat /etc/exports #/home/<user>/<name of sharbel folder>* (rw,sync,no_root_squash,no_subtree_check)
  exportfs -a
  sudo systemctl enable nfs-utils && sudo systemctl start nfs-utils && sudo systemctl restart nfs-utils

NFS on Clients

  yay nfs-utils
  mkdir <name of sharable folder>
  sudo mount -t nfs <master>:/home/<user>/<name of sharable folder> ~/storage
  df -h
  sudo systemctl enable nfs-utils && sudo systemctl start nfs-utils && sudo systemctl restart nfs-utils

Add the entry to the file system table on clients

  cat /etc/fstab
  #MPI Cluster SetUP
  <master>:/home/<smad>/<name of sharable folder> /home/<smad>/<name of sharable folder> nfs

Write a program in C and compile the code

  • the file have to be a <name of file>.c on the Master-Node
  cd <name of sharable folder>
  pwd /home/<user>/<name of sharable folder>
  mpicc <name of file>.c

Run the C-Code on Master-Node

  mpirund -np 4 -hosts <master>,<client1>,<client2> ./a.out

NOTE: The file.c can be every file from GMSH, FEA-Tool or other c compatible program.