- #1
Useful nucleus
- 370
- 58
I'm working with a Fortran code which I run on a Linux cluster. I'm able to compile it such that it works fine on one CPU, but I would like to run it parallel . The code manual mention the following as an instruction to compile it to work in parallel
Based on this can somebody please help me in how to modify this file to do the parallelization?
The get machine file is just a long if statement that tries to get the type of the machine and the type of the fortran compiler on this machine. Since my Machine is Linux with intel compiler , I copy the part of the getmachine file relavant to my machine/compilerIf you wish to run the program in parallel using MPI then you will need to alter the file
"getmachine" accordingly. The usual changes would be to add the "-DMPI" option and in
some cases change the compiler name (for example to mpif77/mpif90).
Code:
makedir()
{
if [ ! -d "$dir" ]
then
mkdir "$dir"
fi
cd $dir
}
debug=
if [ "$1" = "-debug" ]
then
debug="_DEBUG"
shift
fi
os=`uname -s`
case $os in
#
# This is Linux with f90. cdabs.f contains the cdabs function
# which is missing in the f2c library
#
Linux) dir="${os}${debug}"
makedir
if [ "$debug" = "" ]
then
# PG compiler
# echo 'OPT=-fast -tp=p6 > makefile
# echo 'OPT1=-O1 -tp=p6 >> makefile
# Intel compiler
echo 'OPT=-O3 -mp1 ' > makefile
echo 'OPT1=-O1' >> makefile
echo 'OPT2=-O3 -mp1 ' > makefile
# Absoft compiler
# echo 'OPT=-O' > makefile
# echo 'OPT1=-O' >> makefile
#
echo 'BAGGER=' >> makefile
else
echo 'OPT=' > makefile
echo 'BAGGER=-g ' >> makefile
fi
target=${1}_
# PG compiler
# echo 'RUNF90=pgf90 -Bstatic' >> makefile
# Intel compiler
echo 'RUNF90=ifort ' >> makefile
# Absoft compiler
# echo 'RUNF90=f90' >> makefile
# PG compiler
# echo 'FFLAGS=-I.. -DLINUX -Mextend' >> makefile
# echo 'LIBS=' >> makefile
# Intel compiler
echo 'FFLAGS=-I.. -DLINUX -132' >> makefile
echo 'LIBS=' >> makefile
# Absoft compiler
# echo 'FFLAGS=-I.. -DLINUX -B18 -W132' >> makefile
# echo 'LIBS=-lblas -lU77' >> makefile
#
echo 'CFLAGS=-ansi -DLINUX' >> makefile
# PG compiler
# echo 'LDFLAGS=-Bstatic' >> makefile
# Intel compiler
echo 'LDFLAGS=-static' >> makefile
echo 'ETIME=' >> makefile
echo 'BLAS=blas.o' >> makefile
echo 'LAPACK=lapack.o' >> makefile
echo 'GULPENV=' >> makefile
echo 'CDABS=cdabs.o' >> makefile
echo 'DEFS=-DLINUX' >> makefile
;;
Based on this can somebody please help me in how to modify this file to do the parallelization?