Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Compiling a code to run parallel

  1. Feb 16, 2009 #1
    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
    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/compiler

    Code (Text):
    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?
     
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted