aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@53307013-940b-43fa-b11d-2c2b05dfe90d>2010-03-22 17:26:01 +0000
committerschnetter <schnetter@53307013-940b-43fa-b11d-2c2b05dfe90d>2010-03-22 17:26:01 +0000
commit9354bec07b819208920e5892e7a2c0f6a14c8ce0 (patch)
treed05776c08a63f2ce6261c6ad905294127c2b8e55
parent751f6e06081f0aee04e92dd71e038a61151d847a (diff)
Add BLAS
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/BLAS/trunk@2 53307013-940b-43fa-b11d-2c2b05dfe90d
-rw-r--r--BLAS.sh139
-rw-r--r--README23
-rw-r--r--configuration.ccl8
-rw-r--r--dist/lapack-3.2.1.tgzbin0 -> 4792502 bytes
-rw-r--r--interface.ccl3
-rw-r--r--param.ccl1
-rw-r--r--schedule.ccl1
-rw-r--r--src/make.code.defn7
8 files changed, 182 insertions, 0 deletions
diff --git a/BLAS.sh b/BLAS.sh
new file mode 100644
index 0000000..6a67046
--- /dev/null
+++ b/BLAS.sh
@@ -0,0 +1,139 @@
+#! /bin/bash
+
+################################################################################
+# Prepare
+################################################################################
+
+# Set up shell
+set -x # Output commands
+set -e # Abort on errors
+
+
+
+################################################################################
+# Search
+################################################################################
+
+if [ -z "${BLAS_DIR}" ]; then
+ echo "BEGIN MESSAGE"
+ echo "BLAS selected, but BLAS_DIR not set. Checking some places..."
+ echo "END MESSAGE"
+
+ FILES="libblas.a libblas.so"
+ DIRS="/usr/lib /usr/local/lib /usr/lib/atlas ${HOME}"
+ for file in $FILES; do
+ for dir in $DIRS; do
+ if test -r "$dir/$file"; then
+ BLAS_DIR="$dir"
+ break
+ fi
+ done
+ done
+
+ if [ -z "$BLAS_DIR" ]; then
+ echo "BEGIN MESSAGE"
+ echo "BLAS not found"
+ echo "END MESSAGE"
+ else
+ echo "BEGIN MESSAGE"
+ echo "Found BLAS in ${BLAS_DIR}"
+ echo "END MESSAGE"
+ fi
+fi
+
+
+
+################################################################################
+# Build
+################################################################################
+
+if [ -z "${BLAS_DIR}" ]; then
+ echo "BEGIN MESSAGE"
+ echo "Building BLAS..."
+ echo "END MESSAGE"
+
+ # Set locations
+ NAME=blas-3.2.1
+ TARNAME=lapack-3.2.1
+ SRCDIR=$(dirname $0)
+ INSTALL_DIR=${SCRATCH_BUILD}
+ BLAS_DIR=${INSTALL_DIR}/${NAME}
+
+ # Clean up environment
+ unset LIBS
+ unset MAKEFLAGS
+
+(
+ exec >&2 # Redirect stdout to stderr
+ set -x # Output commands
+ set -e # Abort on errors
+ cd ${INSTALL_DIR}
+ if [ -e done-${NAME} -a done-${NAME} -nt ${SRCDIR}/dist/${TARNAME}.tgz \
+ -a done-${NAME} -nt ${SRCDIR}/BLAS.sh ]
+ then
+ echo "BLAS: The enclosed BLAS library has already been built; doing nothing"
+ else
+ echo "BLAS: Building enclosed BLAS library"
+
+ echo "BLAS: Unpacking archive..."
+ rm -rf build-${NAME}
+ mkdir build-${NAME}
+ pushd build-${NAME}
+ # Should we use gtar or tar?
+ TAR=$(gtar --help > /dev/null 2> /dev/null && echo gtar || echo tar)
+ ${TAR} xzf ${SRCDIR}/dist/${TARNAME}.tgz
+ popd
+
+ echo "BLAS: Configuring..."
+ rm -rf ${NAME}
+ mkdir ${NAME}
+ pushd build-${NAME}/${TARNAME}/BLAS/SRC
+
+ echo "BLAS: Building..."
+ ${F77} ${F77FLAGS} -c *.f
+ ${AR} ${ARFLAGS} blas.a *.o
+ ${RANLIB} ${RANLIBFLAGS} blas.a
+
+ echo "BLAS: Installing..."
+ cp blas.a ${BLAS_DIR}
+ popd
+
+ echo 'done' > done-${NAME}
+ echo "BLAS: Done."
+ fi
+)
+
+ if (( $? )); then
+ echo 'BEGIN ERROR'
+ echo 'Error while building BLAS. Aborting.'
+ echo 'END ERROR'
+ exit 1
+ fi
+
+fi
+
+
+
+################################################################################
+# Configure Cactus
+################################################################################
+
+# Set options
+if [ "${BLAS_DIR}" != '/usr' -a "${BLAS_DIR}" != '/usr/local' ]; then
+ BLAS_INC_DIRS=
+ BLAS_LIB_DIRS="${BLAS_DIR}"
+fi
+BLAS_LIBS='blas'
+
+# Pass options to Cactus
+echo "BEGIN MAKE_DEFINITION"
+echo "HAVE_BLAS = 1"
+echo "BLAS_DIR = ${BLAS_DIR}"
+echo "BLAS_INC_DIRS = ${BLAS_INC_DIRS}"
+echo "BLAS_LIB_DIRS = ${BLAS_LIB_DIRS}"
+echo "BLAS_LIBS = ${BLAS_LIBS}"
+echo "END MAKE_DEFINITION"
+
+echo 'INCLUDE_DIRECTORY $(BLAS_INC_DIRS)'
+echo 'LIBRARY_DIRECTORY $(BLAS_LIB_DIRS)'
+echo 'LIBRARY $(BLAS_LIBS)'
diff --git a/README b/README
new file mode 100644
index 0000000..d05ba68
--- /dev/null
+++ b/README
@@ -0,0 +1,23 @@
+Cactus Code Thorn BLAS
+Author(s) : Erik Schnetter
+Maintainer(s): Cactus team
+Licence : ?
+--------------------------------------------------------------------------
+
+1. Purpose
+
+Distribute the Basic Linear Algebra Subroutines (BLAS); see
+<http://netlib.org/blas/>.
+
+
+
+From the web site:
+
+The BLAS (Basic Linear Algebra Subprograms) are routines that provide
+standard building blocks for performing basic vector and matrix
+operations. The Level 1 BLAS perform scalar, vector and vector-vector
+operations, the Level 2 BLAS perform matrix-vector operations, and the
+Level 3 BLAS perform matrix-matrix operations. Because the BLAS are
+efficient, portable, and widely available, they are commonly used in
+the development of high quality linear algebra software, LAPACK for
+example.
diff --git a/configuration.ccl b/configuration.ccl
new file mode 100644
index 0000000..ba23870
--- /dev/null
+++ b/configuration.ccl
@@ -0,0 +1,8 @@
+# Configuration definitions for thorn BLAS
+
+PROVIDES BLAS
+{
+ SCRIPT BLAS.sh
+ LANG bash
+ OPTIONS BLAS_DIR BLAS_LIBS
+}
diff --git a/dist/lapack-3.2.1.tgz b/dist/lapack-3.2.1.tgz
new file mode 100644
index 0000000..e56685d
--- /dev/null
+++ b/dist/lapack-3.2.1.tgz
Binary files differ
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..d45b11e
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,3 @@
+# Interface definition for thorn BLAS
+
+IMPLEMENTS: BLAS
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..bb4563c
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1 @@
+# Parameter definitions for thorn BLAS
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..a0c3fbd
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1 @@
+# Schedule definitions for thorn BLAS
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..f907740
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,7 @@
+# Main make.code.defn file for thorn BLAS
+
+# Source files in this directory
+SRCS =
+
+# Subdirectories containing source files
+SUBDIRS =