Difference between revisions of "Building on MacOSX"

From GridPACK
Jump to: navigation, search
 
(No difference)

Latest revision as of 18:28, 31 October 2013

This particular system is an older MacBook Pro with Mac OS X 10.6.8 (Snow Leopard). Some of the prerequisite software was installed on this system using MacPorts, which is reasonably convenient. The following ports were installed:

 cmake @2.8.10.2_0 (active)
 openmpi @1.7.1_0+gcc47 (active)
 boost @1.53.0_1+no_single+no_static+openmpi+python27 (active)
 doxygen @1.8.3.1_0 (active)
 graphviz @2.30.1_0+pangocairo+x11 (active)

Note that the openmpi Boost variant was installed. This is important. Doxygen and Graphviz are optional.

It's possible to use the MPI implementation that is standard in MacOS, but that was not done on this particular system.

Building PETSc

PETSc version 3.4.0 was configured and built as follows:

 setenv PETSC_DIR /Users/d3g096/ProjectStuff/petsc-3.4.0
 unsetenv PETSC_ARCH 
 python ./config/configure.py \
     --with-mpi=1 \
     --with-cc=openmpicc \
     --with-fc=openmpif90 \
     --with-cxx=openmpicxx \
     --with-c++-support=1 \
     --with-c-support=0 \
     --with-fortran=0 \
     --with-scalar-type=complex \
     --download-f2cblaslapack=1 \
     --with-clanguage=c++ \
     --with-shared-libraries=0 \
     --with-dynamic-loading=0 \
     --with-x=0 \
     --with-mpirun=openmpirun \
     --with-mpiexec=openmpiexec \
     --with-debugging=0
 make all
 make test

Note that the OpenMPI compilers were used, consistent with the Boost installation. The configuration decided that PETSC_ARCH should be arch-darwin-cxx-opt.

Building ParMETIS

In order to get ParMETIS 4.0 to compile with older GNU compilers, a warning option needs to be removed from on of the build system files. In the top ParMETIS source directory, execute the following command:

 sed -i.org -e 's/-Wno-unused-but-set-variable//g' metis/GKlib/GKlibSystem.cmake

Starting in the ParMETIS source directory, build and install METIS first:

 set prefix=/Users/d3g096/ProjectStuff/GridPack/software
 cd metis
 make config prefix="$prefix"
 make
 make install

then build and install ParMETIS:

 cd ..
 make config cc=openmpicc cxx=openmpicxx prefix="$prefix"
 make 
 make install

Do some tests to make sure it works:

 cd Graphs
 openmpirun -np 2 $prefix/bin/ptest rotor.graph rotor.graph.xyz
 openmpirun -np 2 $prefix/bin/ptest rotor.graph
 openmpirun -np 2 $prefix/bin/ptest bricks.hex3d

The last one seemed to hang.

Building and Testing GridPACK

CMake projects are designed to be built outside of the source code location. If the entire GridPACK {{{trunk}}} repository is checked out, the top of the the CMake project is {{{.../src}}}. Make a subdirectory there called {{{build}}} or something. Configure and build GridPACK in that directory.

GridPACK was configured and built as follows:

 cd /path/to/gridpack/trunk/src
 mkdir build
 cd build
 cmake -Wno-dev \
     -D Boost_DIR:STRING='/opt/local' \
     -D PETSC_DIR:STRING='/Users/d3g096/ProjectStuff/petsc-3.4.0' \
     -D PETSC_ARCH:STRING='arch-darwin-cxx-opt' \
     -D MPI_CXX_COMPILER:STRING='openmpicxx' \
     -D MPI_C_COMPILER:STRING='openmpicc' \
     -D MPIEXEC:STRING='openmpiexec' \
     -D CMAKE_BUILD_TYPE:STRING="Debug" \
     -D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
     ..
 make
 make test