From 283a5dfd6cba0795186199e9642908b2a7834e1b Mon Sep 17 00:00:00 2001 From: eschnett Date: Mon, 12 Dec 2011 17:05:17 +0000 Subject: Import OpenMPI as external library git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/MPI/trunk@2 043a8217-7a68-40fe-abfd-36aa7d4fa6a8 --- README | 25 ++++++ configuration.ccl | 8 ++ configure.sh | 182 ++++++++++++++++++++++++++++++++++++++++++++ dist/openmpi-1.5.4.tar.gz | Bin 0 -> 12001108 bytes doc/documentation.tex | 21 +++++ interface.ccl | 3 + param.ccl | 1 + schedule.ccl | 1 + src/make.code.defn | 7 ++ src/make.configuration.defn | 4 + src/make.configuration.deps | 6 ++ 11 files changed, 258 insertions(+) create mode 100644 README create mode 100644 configuration.ccl create mode 100644 configure.sh create mode 100644 dist/openmpi-1.5.4.tar.gz create mode 100644 doc/documentation.tex create mode 100644 interface.ccl create mode 100644 param.ccl create mode 100644 schedule.ccl create mode 100644 src/make.code.defn create mode 100644 src/make.configuration.defn create mode 100644 src/make.configuration.deps diff --git a/README b/README new file mode 100644 index 0000000..07fff0b --- /dev/null +++ b/README @@ -0,0 +1,25 @@ +Cactus Code Thorn OpenMPI +Author(s) : Erik Schnetter +Maintainer(s): Cactus team +Licence : New BSD license +-------------------------------------------------------------------------- + +1. Purpose + +Distribute the OpenMPI library; see . + + + +From the OpenMPI web site: + +Open MPI: Open Source High Performance Computing + +A High Performance Message Passing Library + +The Open MPI Project is an open source MPI-2 implementation that is +developed and maintained by a consortium of academic, research, and +industry partners. Open MPI is therefore able to combine the +expertise, technologies, and resources from all across the High +Performance Computing community in order to build the best MPI library +available. Open MPI offers advantages for system and software vendors, +application developers and computer science researchers. diff --git a/configuration.ccl b/configuration.ccl new file mode 100644 index 0000000..a2923c9 --- /dev/null +++ b/configuration.ccl @@ -0,0 +1,8 @@ +# Configuration definitions for thorn OpenMPI + +PROVIDES MPI +{ + SCRIPT configure.sh + LANG bash + OPTIONS MPI OPENMPI_DIR OPENMPI_INC_DIRS OPENMPI_LIB_DIRS OPENMPI_LIBS +} diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..34d9218 --- /dev/null +++ b/configure.sh @@ -0,0 +1,182 @@ +#! /bin/bash + +################################################################################ +# Prepare +################################################################################ + +# Set up shell +set -x # Output commands +set -e # Abort on errors + + + +################################################################################ +# Check for old mechanism +################################################################################ + +if [ -n "${MPI}" ]; then + echo 'BEGIN ERROR' + echo "Setting the option \"MPI\" is incompatible with the OpenMPI thorn. Please remove the option MPI = ${MPI}." + echo 'END ERROR' + exit 1 +fi + + + +################################################################################ +# Search +################################################################################ + +if [ -z "${OPENMPI_DIR}" ]; then + echo "BEGIN MESSAGE" + echo "OpenMPI selected, but OPENMPI_DIR not set. Checking some places..." + echo "END MESSAGE" + + FILES="include/mpi.h lib/libmpi.a" + DIRS="/usr /usr/local /usr/local/mpi /usr/local/packages/mpi /usr/local/apps/mpi /opt/local /usr/lib/openmpi ${HOME} ${HOME}/mpi c:/packages/mpi" + for dir in $DIRS; do + OPENMPI_DIR="$dir" + for file in $FILES; do + if [ ! -r "$dir/$file" ]; then + unset OPENMPI_DIR + break + fi + done + if [ -n "$OPENMPI_DIR" ]; then + break + fi + done + + if [ -z "$OPENMPI_DIR" ]; then + echo "BEGIN MESSAGE" + echo "OpenMPI not found" + echo "END MESSAGE" + else + echo "BEGIN MESSAGE" + echo "Found OpenMPI in ${OPENMPI_DIR}" + echo "END MESSAGE" + fi +fi + + + +################################################################################ +# Build +################################################################################ + +if [ -z "${OPENMPI_DIR}" -o "${OPENMPI_DIR}" = 'BUILD' ]; then + echo "BEGIN MESSAGE" + echo "Building OpenMPI..." + echo "END MESSAGE" + + # Set locations + THORN=OpenMPI + NAME=openmpi-1.5.3 + SRCDIR=$(dirname $0) + BUILD_DIR=${SCRATCH_BUILD}/build/${THORN} + INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN} + DONE_FILE=${SCRATCH_BUILD}/done/${THORN} + OPENMPI_DIR=${INSTALL_DIR} + +( + exec >&2 # Redirect stdout to stderr + set -x # Output commands + set -e # Abort on errors + cd ${SCRATCH_BUILD} + if [ -e ${DONE_FILE} -a ${DONE_FILE} -nt ${SRCDIR}/dist/${NAME}.tar.gz \ + -a ${DONE_FILE} -nt ${SRCDIR}/configure.sh ] + then + echo "OpenMPI: The enclosed OpenMPI library has already been built; doing nothing" + else + echo "OpenMPI: Building enclosed OpenMPI library" + + # Set up environment + if [ "${F90}" = "none" ]; then + echo 'BEGIN MESSAGE' + echo 'No Fortran 90 compiler available. Building OpenMPI library without Fortran support.' + echo 'END MESSAGE' + unset FC + unset FCFLAGS + else + export FC="${F90}" + export FCFLAGS="${F90FLAGS}" + fi + export LDFLAGS + unset LIBS + unset RPATH + if echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then + export OBJECT_MODE=64 + fi + + echo "OpenMPI: Preparing directory structure..." + mkdir build external done 2> /dev/null || true + rm -rf ${BUILD_DIR} ${INSTALL_DIR} + mkdir ${BUILD_DIR} ${INSTALL_DIR} + + echo "OpenMPI: Unpacking archive..." + pushd ${BUILD_DIR} + ${TAR} xzf ${SRCDIR}/dist/${NAME}.tar.gz + + echo "OpenMPI: Configuring..." + cd ${NAME} + ./configure --prefix=${OPENMPI_DIR} + + echo "OpenMPI: Building..." + ${MAKE} + + echo "OpenMPI: Installing..." + ${MAKE} install + popd + + echo "OpenMPI: Cleaning up..." + rm -rf ${BUILD_DIR} + + date > ${DONE_FILE} + echo "OpenMPI: Done." + fi +) + + if (( $? )); then + echo 'BEGIN ERROR' + echo 'Error while building OpenMPI. Aborting.' + echo 'END ERROR' + exit 1 + fi + +fi + + + +################################################################################ +# Configure Cactus +################################################################################ + +# Set options + +if [ "${OPENMPI_DIR}" != '/usr' -a "${OPENMPI_DIR}" != '/usr/local' ]; then + : ${OPENMPI_INC_DIRS="${OPENMPI_DIR}/include"} + : ${OPENMPI_LIB_DIRS="${OPENMPI_DIR}/lib"} +fi +: ${OPENMPI_LIBS='mpi mpi_cxx'} + +# Pass options to Cactus + +echo "BEGIN DEFINE" +echo "CCTK_MPI 1" +echo "HAVE_MPI 1" +echo "HAVE_OPENMPI 1" +echo "END DEFINE" + +echo "BEGIN MAKE_DEFINITION" +echo "CCTK_MPI = 1" +echo "HAVE_MPI = 1" +echo "HAVE_OPENMPI = 1" +echo "MPI_DIR = ${OPENMPI_DIR}" +echo "MPI_INC_DIRS = ${OPENMPI_INC_DIRS}" +echo "MPI_LIB_DIRS = ${OPENMPI_LIB_DIRS}" +echo "MPI_LIBS = ${OPENMPI_LIBS}" +echo "END MAKE_DEFINITION" + +echo 'INCLUDE_DIRECTORY $(MPI_INC_DIRS)' +echo 'LIBRARY_DIRECTORY $(MPI_LIB_DIRS)' +echo 'LIBRARY $(MPI_LIBS)' diff --git a/dist/openmpi-1.5.4.tar.gz b/dist/openmpi-1.5.4.tar.gz new file mode 100644 index 0000000..f46b458 Binary files /dev/null and b/dist/openmpi-1.5.4.tar.gz differ diff --git a/doc/documentation.tex b/doc/documentation.tex new file mode 100644 index 0000000..7c24efe --- /dev/null +++ b/doc/documentation.tex @@ -0,0 +1,21 @@ +\documentclass{article} + +% Use the Cactus ThornGuide style file +% (Automatically used from Cactus distribution, if you have a +% thorn without the Cactus Flesh download this from the Cactus +% homepage at www.cactuscode.org) +\usepackage{../../../../doc/latex/cactus} + +\begin{document} + +\title{ExternalLibraries/OpenMPI} + +\maketitle + +% Do not delete next line +% START CACTUS THORNGUIDE + +% Do not delete next line +% END CACTUS THORNGUIDE + +\end{document} diff --git a/interface.ccl b/interface.ccl new file mode 100644 index 0000000..73893f8 --- /dev/null +++ b/interface.ccl @@ -0,0 +1,3 @@ +# Interface definition for thorn OpenMPI + +IMPLEMENTS: MPI diff --git a/param.ccl b/param.ccl new file mode 100644 index 0000000..1d3749a --- /dev/null +++ b/param.ccl @@ -0,0 +1 @@ +# Parameter definitions for thorn OpenMPI diff --git a/schedule.ccl b/schedule.ccl new file mode 100644 index 0000000..768d4b4 --- /dev/null +++ b/schedule.ccl @@ -0,0 +1 @@ +# Schedule definitions for thorn OpenMPI diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..ae2b14c --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,7 @@ +# Main make.code.defn file for thorn OpenMPI + +# Source files in this directory +SRCS = + +# Subdirectories containing source files +SUBDIRS = diff --git a/src/make.configuration.defn b/src/make.configuration.defn new file mode 100644 index 0000000..a577923 --- /dev/null +++ b/src/make.configuration.defn @@ -0,0 +1,4 @@ +# make.configuration.defn file for thorn OpenMPI + +# Define the relevant OpenMPI utilities +#ALL_UTILS += mpirun ompi-clean ompi-iof ompi-ps ompi-server ompi_info orte-clean orte-iof orte-ps orted orterun diff --git a/src/make.configuration.deps b/src/make.configuration.deps new file mode 100644 index 0000000..2e90cbb --- /dev/null +++ b/src/make.configuration.deps @@ -0,0 +1,6 @@ +# make.configuration.deps file for thorn OpenMPI + +$(UTIL_DIR)/%: $(OPENMPI_DIR)/bin/% + @echo "Copying $* from $< to $(UTIL_DIR)" + -$(MKDIR) $(MKDIRFLAGS) $(UTIL_DIR) 2> /dev/null + cp $< $@ -- cgit v1.2.3