aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@043a8217-7a68-40fe-abfd-36aa7d4fa6a8>2011-12-12 17:05:17 +0000
committereschnett <eschnett@043a8217-7a68-40fe-abfd-36aa7d4fa6a8>2011-12-12 17:05:17 +0000
commit283a5dfd6cba0795186199e9642908b2a7834e1b (patch)
treefc1d731fb1e106393ece497761f9876a45818bc1
parent65657cc7ce92c88a25c06c02731e7949db849338 (diff)
Import OpenMPI as external library
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/MPI/trunk@2 043a8217-7a68-40fe-abfd-36aa7d4fa6a8
-rw-r--r--README25
-rw-r--r--configuration.ccl8
-rw-r--r--configure.sh182
-rw-r--r--dist/openmpi-1.5.4.tar.gzbin0 -> 12001108 bytes
-rw-r--r--doc/documentation.tex21
-rw-r--r--interface.ccl3
-rw-r--r--param.ccl1
-rw-r--r--schedule.ccl1
-rw-r--r--src/make.code.defn7
-rw-r--r--src/make.configuration.defn4
-rw-r--r--src/make.configuration.deps6
11 files changed, 258 insertions, 0 deletions
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 <http://www.open-mpi.org/>.
+
+
+
+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
--- /dev/null
+++ b/dist/openmpi-1.5.4.tar.gz
Binary files 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 $< $@