Documente Academic
Documente Profesional
Documente Cultură
*For more detail understanding please go through the websites FOR INSTALLING MPI IN UBUNTU Refer: ** OpenMPI on Ubuntu 9.04 - MPI - e-Notes.html A. Install OpenMPI $ sudo apt-get install libopenmpi-dev openmpi-bin openmpi-doc $ sudo apt-get install ssh B. Configure SSH $ ssh-keygen -t dsa $ cd ~/.ssh $ cat id_dsa.pub >> authorized_keys C. MPI Program Example Filename: MPI_Hello.c #include <stdio.h> #include <mpi.h> int main(int argc, char** argv) { int myrank, nprocs; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); printf("Hello from processor %d of %d\n", myrank, nprocs); MPI_Finalize(); return 0; } D. Compilation $ mpicc MPI_Hello.c -o MPI_Hello E. Execution $ mpiexec -n 5 MPI_Hello This command is for running the program in single machine Please dont try in cluster
1) Slave Nodes
$ sudo apt-get install openssh-server
2) Master nodes
First of all go to (gksu gedit /etc/hosts) and note down ip addresses and name of all slaves.
Add the machine name and ip address of the slave along with add the ip address in front of your machine name also which will set for local host ip address by default
1. 2. 3 4
$ sudo apt-get install openssh-client $ ssh-keygen -t dsa $ cp /home/mpiuser/.ssh/id_dsa.pub /home/mpiuser/.ssh/authorized_keys $ scp /home/mpiuser/.ssh/id_dsa.pub mpiuser@slave1:.ssh/authorized_keys (slave1 is the machine name of the slave and mpiuser is login name of the slave) 5 $ chmod 700 /home/mpiuser/.ssh 6 $ chmod 600 /home/mpiuser/.ssh/authorized_keys (here it may ask for creating .ssh folder so give the path as it will suggest in the bracket) 7 $ ssh-add ~/.ssh/id_dsa 8 $ ssh slave1 (slave1 is machine name) 9 Create a hostfile with name .mpi_hostfile containing name of all slaves including master name. see attachments for example. mpiuser (my login name will be there by default) mpiuser-desktop (slave 1 should be added. Similarly if there are any slaves they all must be added) .c file and hostfile should remain in same folder.