PETSc , Xcode

Do you use PETSc for your High Performance Computing?

How can it be integrated into the Xcode?

PETSc

A build/install guide for PETSc would be most appreciated.

I found some notes on

I found some notes on installing PETSc on mac here:
http://www.scorec.rpi.edu/~littld/osx_petsc_2.2.1.html
http://www.ldeo.columbia.edu/~spk/macosx_install.html

I installed PETSc on my G5 quad core last year without too much difficulty, although I don't remember the exact details. I remember that you have to install mpich using the shared memory socket in order to take advantage of the SMP architecture.

Josh

PETSc on macports

Have someone used the macports' port of PETSc? I've tried to build it on my MBP (running 10.5 & gfortran), but the process failed in the configuration stage.

PETSc insall guide on Tiger

This is an install guide for Tiger at least.

First of all, I couldn't get PETSc to compile with MPICH or MPICH2. Using OpenMPI however, I just followed the standard procedure and had no problems at all.

Assuming that openMPI resides in /usr/local the following should do the trick.

Begin by setting some environment variables in your .profile file.

PETSC_DIR=your_petsc_folder;
export PETSC_DIR
PETSC_ARCH=macx;
export PETSC_ARCH

Then cd to your petsc-folder and run configure. Like so:

shell$ ./config/configure.py --with-mpi-dir=/usr/local/openMPI

Finally, run make by

make all
make test

Leopard has openMPI preinstalled so it should really not be any harder than this. But then again I hear of people running into problems.. If someone could confirm a successful compile of PETSc on Leopard, I'd appreciate it. Otherwise, no upgrade for me!

Well, I've tried to run the

Well, I've tried to run the configuration in leopard --

./config/configure.py --with-mpi-dir=/usr/bin/

... and got an error message:

Fortran error! mpif.h could not be located at: ['/usr/bin/include']

Apparently, Leopard's OpenMPI implementation does not include fortran --

[~]>mpif90
--------------------------------------------------------------------------
Unfortunately, this installation of Open MPI was not compiled with
Fortran 90 support. As such, the mpif90 compiler is non-functional.

--------------------------------------------------------------------------

Which also means that mpif.h won't be there to be found.

I guess the next stage would be to compile openmpi from scratch and install it over the current version / somewhere else.

Re: Well, I've tried to run the

That is correct. The Leopard version of MPI only includes C/C++ bindings. There are no fortran bindings, presumably because Apple doesn't support fortran themselves in the dev tools.

You can install your own OpenMPI, although I'd caution not to overwrite the system one. This could be modified at a later date during an update, and may cause unexpected behavior in your program. /usr/local is at least one safe place.

Regards,

Dave

petsc building scripts

IT may come a bit late, but just in case, here is a list of instruction on building petsc using the latest intel compilers using mpich2. I assume that your compilers are properly installed, and that you are sourcing the proper files. For reference, I have the following lines in my .profile

if [ -f /opt/intel/cce/10.1/bin/iccvars.sh ]; then
source /opt/intel/cce/10.1/bin/iccvars.sh
fi
if [ -f /opt/intel/fce/10.1/bin/ifortvars.sh ]; then
source /opt/intel/fce/10.1/bin/ifortvars.sh
fi
if [ -f /opt/intel/idbe/10.1/bin/idbvars.sh ]; then
source /opt/intel/idbe/10.1/bin/idbvars.sh
fi
if [ -f /Library/Frameworks/Intel_MKL.framework/Versions/Current/tools/environment/mklvarsem64t.sh ]; then
source /Library/Frameworks/Intel_MKL.framework/Versions/Current/tools/environment/mklvarsem64t.sh
fi

  1. Build mpich2: I use the following script (note that HPCDIST_DIR will have to be set to the folder in which mpich2 and petsc will be installed:

    #!/bin/csh
    setenv CC icc
    setenv CXX icpc
    setenv FC ifort
    setenv F90 ifort
    setenv MPI_DIR ${HPCDIST_DIR}/mpich2-1.0.7
    setenv MPI_ARCH intel10.1-g64
    setenv MPI_HOME ${MPI_DIR}_${MPI_ARCH}

    setenv RSHCOMMAND ssh

    rm -f config-mine.${MPI_ARCH}.log
    ./configure -prefix=${MPI_HOME} --enable-f77 --enable-f90 --enable-cxx \
    --enable-g=dbg --enable-debuginfo --with-device=ch3:nemesis |& tee config-mine.${MPI_ARCH}.log

    rm -f make-mine.${MPI_ARCH}.log
    make |& tee make-mine.${MPI_ARCH}.log

    rm -f install-mine.${MPI_ARCH}.log
    make install |& tee install-mine.${MPI_ARCH}.log

  2. Build PETSc: In order to get X11 to work, you will need to follow the directions from this article in the petsc-user mailing list

    #!/bin/csh

    setenv MPI_ARCH intel10.1-g64
    setenv MPI_DIR ${HPCDIST_DIR}/mpich2-1.0.7_${MPI_ARCH}
    setenv PETSC_ARCH intel10.1-g64
    setenv PETSC_DIR `pwd`

    ./config/configure.py --with-clanguage=C++ --with-vendor-compilers=intel \
    --with-gnu-compilers=0 --with-pic \
    --download-parmetis --with-x11=1 \
    --with-mpi-dir=${MPI_DIR} \
    --with-fortran-lib-autodetect=0 \
    --with-fc=ifort --withcxx=icpc --with-cc=icc \
    --FFLAGS="-O0" --CFLAGS="-O0" \
    --LDFLAGS="-L/opt/intel/fce/10.1/lib -lifport -lifcore" \
    --with-shared=0 \
    |& tee make-conf-${PETSC_ARCH}.log

    make all |& tee make-$PETSC_ARCH.log

    make test |& tee make-test-$PETSC_ARCH.log

    I was never able to get dynamic linking to work properly.

  3. Add something like the following in you .profile:

    ### PRODUCTION
    #export PETSC_ARCH=intel10.1-O64
    #export MPI_ARCH=intel10.1-O64
    ### DEBUG
    export PETSC_ARCH=intel10.1-g64
    export MPI_ARCH=intel10.1-g64

    export HPCDIST_DIR=/opt/HPC
    export MPI_DIR=${HPCDIST_DIR}/mpich2-1.0.7
    export MPI_HOME=${MPI_DIR}_${MPI_ARCH}

The following scripts are for a build with optimization (you may want to substitute your favorite optimization options for mine):

#!/bin/csh
setenv CC icc
setenv CXX icpc
setenv FC ifort
setenv F90 ifort

setenv CFLAGS "-O3 -axTP"
setenv CXXFLAGS "-O3 -axTP"
setenv FFLAGS "-O3 -axTP"
setenv F90FLAGS "-O3 -axTP"

setenv MPI_DIR ${HPCDIST_DIR}/mpich2-1.0.7
setenv MPI_ARCH intel10.1-O64
setenv MPI_HOME ${MPI_DIR}_${MPI_ARCH}

setenv RSHCOMMAND ssh

rm -f config-mine.${MPI_ARCH}.log
./configure -prefix=${MPI_HOME} --enable-f77 --enable-f90 --enable-cxx \
--enable-fast --with-device=ch3:nemesis |& tee config-mine.${MPI_ARCH}.log

rm -f make-mine.${MPI_ARCH}.log
make |& tee make-mine.${MPI_ARCH}.log

rm -f install-mine.${MPI_ARCH}.log
make install |& tee install-mine.${MPI_ARCH}.log


#!/bin/csh

setenv MPI_ARCH intel10.1-O64
setenv MPI_DIR ${HPCDIST_DIR}/mpich2-1.0.7_${MPI_ARCH}
setenv PETSC_ARCH intel10.1-O64
setenv PETSC_DIR `pwd`

./config/configure.py --with-clanguage=C++ --with-vendor-compilers=intel \
--with-debugging=0 --COPTFLAGS="-O3 -axTP" --FOPTFLAGS="-O3 -axTP" \
--with-gnu-compilers=0 --with-pic \
--download-parmetis --with-x11=1 \
--with-mpi-dir=${MPI_DIR} \
--with-fortran-lib-autodetect=0 \
--with-fc=ifort --withcxx=icpc --with-cc=icc \
--LDFLAGS="-L/opt/intel/fce/10.1/lib -lifport -lifcore" \
--with-shared=0 \
|& tee make-conf-${PETSC_ARCH}.log

make all |& tee make-$PETSC_ARCH.log

make test |& tee make-test-$PETSC_ARCH.log