From d8420c2786a0f287c335257e4af0147554a74f45 Mon Sep 17 00:00:00 2001 From: knarf Date: Fri, 5 Aug 2011 02:30:58 +0000 Subject: commit FFTW3 thorn from Yosef git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/FFTW3/trunk@1 325d7946-0b50-4e3b-902a-3a8d69fbdfa6 --- FFTW3.sh | 155 +++++++++++++++++++++++++++++++++++++++++++++++++ README | 30 ++++++++++ configuration.ccl | 8 +++ dist/fftw-3.2.2.tar.gz | Bin 0 -> 3495117 bytes interface.ccl | 3 + param.ccl | 1 + schedule.ccl | 1 + src/make.code.defn | 7 +++ 8 files changed, 205 insertions(+) create mode 100644 FFTW3.sh create mode 100644 README create mode 100644 configuration.ccl create mode 100644 dist/fftw-3.2.2.tar.gz create mode 100644 interface.ccl create mode 100644 param.ccl create mode 100644 schedule.ccl create mode 100644 src/make.code.defn diff --git a/FFTW3.sh b/FFTW3.sh new file mode 100644 index 0000000..ad56a5a --- /dev/null +++ b/FFTW3.sh @@ -0,0 +1,155 @@ +#! /bin/bash + +################################################################################ +# Prepare +################################################################################ + +# Set up shell +set -x # Output commands +set -e # Abort on errors + + + +################################################################################ +# Search +################################################################################ + +if [ -z "${FFTW3_DIR}" ]; then + echo "BEGIN MESSAGE" + echo "FFTW3 selected, but FFTW3_DIR not set. Checking some places..." + echo "END MESSAGE" + + FILES="include/fftw3.h" + DIRS="/usr /usr/local /usr/local/fftw3 /usr/local/packages/fftw3 /usr/local/apps/fftw3 ${HOME} c:/packages/fftw3" + for dir in $DIRS; do + FFTW3_DIR="$dir" + for file in $FILES; do + if [ ! -r "$dir/$file" ]; then + unset FFTW3_DIR + break + fi + done + if [ -n "$FFTW3_DIR" ]; then + break + fi + done + + if [ -z "$FFTW3_DIR" ]; then + echo "BEGIN MESSAGE" + echo "FFTW3 not found" + echo "END MESSAGE" + else + echo "BEGIN MESSAGE" + echo "Found FFTW3 in ${FFTW3_DIR}" + echo "END MESSAGE" + fi +fi + + + +################################################################################ +# Build +################################################################################ + +if [ -z "${FFTW3_DIR}" -o "${FFTW3_DIR}" = 'BUILD' ]; then + echo "BEGIN MESSAGE" + echo "Building FFTW3..." + echo "END MESSAGE" + + # Set locations + THORN=FFTW3 + NAME=fftw-3.2.2 + SRCDIR=$(dirname $0) + BUILD_DIR=${SCRATCH_BUILD}/build/${THORN} + INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN} + DONE_FILE=${SCRATCH_BUILD}/done/${THORN} + FFTW3_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}/FFTW3.sh ] + then + echo "FFTW3: The enclosed FFTW3 library has already been built; doing nothing" + else + echo "FFTW3: Building enclosed FFTW3 library" + + # Should we use gmake or make? + MAKE=$(gmake --help > /dev/null 2>&1 && echo gmake || echo make) + # Should we use gtar or tar? + TAR=$(gtar --help > /dev/null 2> /dev/null && echo gtar || echo tar) + + # Set up environment + unset LIBS + if echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then + export OBJECT_MODE=64 + fi + + echo "FFTW3: Preparing directory structure..." + mkdir build external done 2> /dev/null || true + rm -rf ${BUILD_DIR} ${INSTALL_DIR} + mkdir ${BUILD_DIR} ${INSTALL_DIR} + + echo "FFTW3: Unpacking archive..." + pushd ${BUILD_DIR} + ${TAR} xzf ${SRCDIR}/dist/${NAME}.tar.gz + + echo "FFTW3: Configuring..." + cd ${NAME} + ./configure --prefix=${FFTW3_DIR} + + echo "FFTW3: Building..." + ${MAKE} + + echo "FFTW3: Installing..." + ${MAKE} install + popd + + echo "FFTW3: Cleaning up..." + rm -rf ${BUILD_DIR} + + date > ${DONE_FILE} + echo "FFTW3: Done." + fi +) + + if (( $? )); then + echo 'BEGIN ERROR' + echo 'Error while building FFTW3. Aborting.' + echo 'END ERROR' + exit 1 + fi + +fi + + + +################################################################################ +# Configure Cactus +################################################################################ + +# Set options +if [ "${FFTW3_DIR}" = '/usr' -o "${FFTW3_DIR}" = '/usr/local' ]; then + FFTW3_INC_DIRS='' + FFTW3_LIB_DIRS='' +else + FFTW3_INC_DIRS="${FFTW3_DIR}/include" + FFTW3_LIB_DIRS="${FFTW3_DIR}/lib" +fi +FFTW3_LIBS='fftw3' + +# Pass options to Cactus +echo "BEGIN MAKE_DEFINITION" +echo "HAVE_FFTW3 = 1" +echo "FFTW3_DIR = ${FFTW3_DIR}" +echo "FFTW3_INC_DIRS = ${FFTW3_INC_DIRS}" +echo "FFTW3_LIB_DIRS = ${FFTW3_LIB_DIRS}" +echo "FFTW3_LIBS = ${FFTW3_LIBS}" +echo "END MAKE_DEFINITION" + +echo 'INCLUDE_DIRECTORY $(FFTW3_INC_DIRS)' +echo 'LIBRARY_DIRECTORY $(FFTW3_LIB_DIRS)' +echo 'LIBRARY $(FFTW3_LIBS)' diff --git a/README b/README new file mode 100644 index 0000000..42d9e2a --- /dev/null +++ b/README @@ -0,0 +1,30 @@ +Cactus Code Thorn FFTW3 +Author(s) : Yosef Zlochower +Maintainer(s): +Licence : GPL +-------------------------------------------------------------------------- + +1. Purpose + +Distribute the FFTW Library; see + + + + +From the web site: FFTW is a C subroutine library for computing the +discrete Fourier transform (DFT) in one or more dimensions, of +arbitrary input size, and of both real and complex data (as well as of +even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). +We believe that FFTW, which is free software, should become the FFT +library of choice for most applications. + +Our benchmarks, performed on on a variety of platforms, show that +FFTW's performance is typically superior to that of other publicly +available FFT software, and is even competitive with vendor-tuned +codes. In contrast to vendor-tuned codes, however, FFTW's performance +is portable: the same program will perform well on most architectures +without modification. Hence the name, "FFTW," which stands for the +somewhat whimsical title of "Fastest Fourier Transform in the West." + +The FFTW package was developed at MIT by Matteo Frigo and Steven G. +Johnson diff --git a/configuration.ccl b/configuration.ccl new file mode 100644 index 0000000..12d5553 --- /dev/null +++ b/configuration.ccl @@ -0,0 +1,8 @@ +# Configuration definitions for thorn FFTW3 + +PROVIDES FFTW3 +{ + SCRIPT FFTW3.sh + LANG bash + OPTIONS FFTW3_DIR FFTW3_LIBS +} diff --git a/dist/fftw-3.2.2.tar.gz b/dist/fftw-3.2.2.tar.gz new file mode 100644 index 0000000..244c96f Binary files /dev/null and b/dist/fftw-3.2.2.tar.gz differ diff --git a/interface.ccl b/interface.ccl new file mode 100644 index 0000000..115ac96 --- /dev/null +++ b/interface.ccl @@ -0,0 +1,3 @@ +# Interface definition for thorn FFTW3 + +IMPLEMENTS: FFTW3 diff --git a/param.ccl b/param.ccl new file mode 100644 index 0000000..c5cdf10 --- /dev/null +++ b/param.ccl @@ -0,0 +1 @@ +# Parameter definitions for thorn FFTW3 diff --git a/schedule.ccl b/schedule.ccl new file mode 100644 index 0000000..4e028c9 --- /dev/null +++ b/schedule.ccl @@ -0,0 +1 @@ +# Schedule definitions for thorn FFTW3 diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..eb130e9 --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,7 @@ +# Main make.code.defn file for thorn FFTW3 + +# Source files in this directory +SRCS = + +# Subdirectories containing source files +SUBDIRS = -- cgit v1.2.3