Installation of OpenMPI
Installation process goes in following steps
step1 :
check whether there is any c & c++ compilers (gcc,g++,icc,i++), other we have to intall gcc, g++, forton etc..
step2:
After that only we install openMPI. Download openMPI from the openMPI site.
the file : openmpi-version.tar.bz2
step3:
First create open application directory
# mkdir /apps
# mv openmpi-1.4.3.tar.bz2 /apps
# cd /apps
extarct by # bunzip2 openmpi-1.4.3.tar.baz.2
and then extract
# tar -xvf openmpi-1.4.3.tar
and then create one temporary directory
# mkdir temp
move the extracted directory to temp
# mv openmpi-1.4.3 temp/
create an empty directory for installation of openMPI
# mkdir openmpi-1.4.3
And go the temp/openmpi-1.4.3/
# cd temp/openmpi-1.4.3/
check list of file in the openmpi-1.4.3
#ls
step4:
Configure the location of installation as
# ./configure –perfix=/apps/openmpi-1.4.3
.
….
…..
After that configuration we make the installation
# make
.
..
…
After making the files check the make by
# make check
.
..
…
After that install by make
# make install
.
..
…
Installation is completed ..
step5:
We run over mpi c programm before that we have to export the path of the installation of openmpi and add LD_LIBRARY_PATH=”/apps/openmpi-1.4.3/lib”
# export PATH=$PATH:”/apps/openmpi-1.4.3/bin” # mpicc, mpi++ .. location
# export LD_LIBRARY_PATH=”/apps/openmpi-1.4.3/lib” # library files location
step6:
Sample open MPI HelloWorld.c
/* Sample MPI "hello World" application in C */
#include <stdio.h>
#include "mpi.h"
int main (int argc, char* argv[])
{
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank); // Procesor id
MPI_Comm_size(MPI_COMM_WORLD, &size); // no.of process running
printf("Hello, World, I am %d of %d\n", rank, size);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
return 0;
}
MPICH shell script command to compile and link programs
mpicc
mpiCC
mpif77
mpif90
Command line options:
-help: help on command line options
-compile_info: show commands and options used to compile a program
-link_info: show commands and options used to link a program
-cc : used with mpicc to change the compiler used
-CC: used with mpiCC to change the compiler used
-fc: used with mpif77 to change the compiler used
-f90: used with mpif90 to change the compiler used
Compilation of MPI Program as
C mpicc
C++ mpic++
forton90 mpif90
and etc
after that we can run output file as
mpirun -np 4 a.out
here np – no of processors
step1 :
check whether there is any c & c++ compilers (gcc,g++,icc,i++), other we have to intall gcc, g++, forton etc..
step2:
After that only we install openMPI. Download openMPI from the openMPI site.
the file : openmpi-version.tar.bz2
step3:
First create open application directory
# mkdir /apps
# mv openmpi-1.4.3.tar.bz2 /apps
# cd /apps
extarct by # bunzip2 openmpi-1.4.3.tar.baz.2
and then extract
# tar -xvf openmpi-1.4.3.tar
and then create one temporary directory
# mkdir temp
move the extracted directory to temp
# mv openmpi-1.4.3 temp/
create an empty directory for installation of openMPI
# mkdir openmpi-1.4.3
And go the temp/openmpi-1.4.3/
# cd temp/openmpi-1.4.3/
check list of file in the openmpi-1.4.3
#ls
step4:
Configure the location of installation as
# ./configure –perfix=/apps/openmpi-1.4.3
.
….
…..
After that configuration we make the installation
# make
.
..
…
After making the files check the make by
# make check
.
..
…
After that install by make
# make install
.
..
…
Installation is completed ..
step5:
We run over mpi c programm before that we have to export the path of the installation of openmpi and add LD_LIBRARY_PATH=”/apps/openmpi-1.4.3/lib”
# export PATH=$PATH:”/apps/openmpi-1.4.3/bin” # mpicc, mpi++ .. location
# export LD_LIBRARY_PATH=”/apps/openmpi-1.4.3/lib” # library files location
step6:
Sample open MPI HelloWorld.c
/* Sample MPI "hello World" application in C */
#include <stdio.h>
#include "mpi.h"
int main (int argc, char* argv[])
{
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank); // Procesor id
MPI_Comm_size(MPI_COMM_WORLD, &size); // no.of process running
printf("Hello, World, I am %d of %d\n", rank, size);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
return 0;
}
MPICH shell script command to compile and link programs
mpicc
mpiCC
mpif77
mpif90
Command line options:
-help: help on command line options
-compile_info: show commands and options used to compile a program
-link_info: show commands and options used to link a program
-cc : used with mpicc to change the compiler used
-CC: used with mpiCC to change the compiler used
-fc: used with mpif77 to change the compiler used
-f90: used with mpif90 to change the compiler used
Compilation of MPI Program as
C mpicc
C++ mpic++
forton90 mpif90
and etc
after that we can run output file as
mpirun -np 4 a.out
here np – no of processors
No comments:
Post a Comment