NOTE: This will need to be changed again once all V99* and V2000* installations have been removed.
369 lines
11 KiB
Bash
Executable File
369 lines
11 KiB
Bash
Executable File
#!/bin/sh
|
|
#BHEADER***********************************************************************
|
|
# (c) 1998 The Regents of the University of California
|
|
#
|
|
# See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
|
|
# notice, contact person, and disclaimer.
|
|
#
|
|
# $Revision$
|
|
#EHEADER***********************************************************************
|
|
|
|
#=============================================================================
|
|
#
|
|
# There are two types of installations supported here:
|
|
#
|
|
# internal - updated frequently
|
|
# installed only on CASC cluster
|
|
# constructed directly from the repository
|
|
#
|
|
# external - updated less frequently
|
|
# installed on many platforms
|
|
# constructed from a previous 'internal' installation
|
|
#
|
|
# The external installation on the CASC cluster is automatically copied
|
|
# from the internal installation (but recompiled).
|
|
#
|
|
# The external installation on other platforms requires that the 'UPDATE.tar'
|
|
# file has already been copied and untarred into the install directory.
|
|
#
|
|
# Do 'update -h' or 'update -help' for usage info.
|
|
#
|
|
#=============================================================================
|
|
|
|
#=============================================================================
|
|
# Define install permissions:
|
|
# - give everybody read/execute permission
|
|
# - give user/group write permission
|
|
#=============================================================================
|
|
|
|
HYPRE_INSTALL_PERMISSIONS="a+rX,ug+w"
|
|
|
|
#=============================================================================
|
|
# Set install directories:
|
|
#=============================================================================
|
|
|
|
HYPRE_CASC_INSTALL_DIR="/home/casc/software/hypre"
|
|
HYPRE_DEC_INSTALL_DIR="/usr/apps/hypre"
|
|
HYPRE_BLUE_INSTALL_DIR="/usr/apps/hypre"
|
|
HYPRE_RED_INSTALL_DIR="/usr/apps/hypre"
|
|
|
|
#=============================================================================
|
|
# Parse arguments
|
|
#=============================================================================
|
|
|
|
case $1 in
|
|
-h|-help)
|
|
echo
|
|
echo "$0 -h|-help"
|
|
echo " prints usage information"
|
|
echo
|
|
echo "(or)"
|
|
echo
|
|
echo "$0 -dirs"
|
|
echo " prints current list of install directories"
|
|
echo
|
|
echo "(or)"
|
|
echo
|
|
echo "$0 internal|external [-dec|-blue|-red] [install]"
|
|
echo " -dec LC DEC cluster"
|
|
echo " -blue ASCI Blue-Pacific"
|
|
echo " -red ASCI Red"
|
|
echo " install builds, installs, and cleans source"
|
|
echo
|
|
exit;;
|
|
-dirs)
|
|
echo
|
|
echo "internal $HYPRE_CASC_INSTALL_DIR/internal"
|
|
echo "external $HYPRE_CASC_INSTALL_DIR/external"
|
|
echo "external -dec $HYPRE_DEC_INSTALL_DIR"
|
|
echo "external -blue $HYPRE_BLUE_INSTALL_DIR"
|
|
echo "external -red $HYPRE_RED_INSTALL_DIR"
|
|
echo
|
|
exit;;
|
|
esac
|
|
|
|
HYPRE_INSTALL_TYPE=$1
|
|
if [ "$HYPRE_INSTALL_TYPE" != "internal" ] &&
|
|
[ "$HYPRE_INSTALL_TYPE" != "external" ]
|
|
then
|
|
echo "Error: check usage: $0 -help"
|
|
exit
|
|
fi
|
|
shift
|
|
|
|
HYPRE_ARCH="casc"
|
|
HYPRE_INSTALL_DIR=$HYPRE_CASC_INSTALL_DIR/$HYPRE_INSTALL_TYPE
|
|
HYPRE_INSTALL=""
|
|
HYPRE_INSTALL_THREADS=""
|
|
while [ "$*" != "" ]
|
|
do
|
|
case $1 in
|
|
-dec)
|
|
HYPRE_ARCH="dec"
|
|
HYPRE_INSTALL_DIR=$HYPRE_DEC_INSTALL_DIR
|
|
HYPRE_INSTALL_THREADS="--with-openmp"
|
|
shift;;
|
|
-blue)
|
|
HYPRE_ARCH="blue"
|
|
HYPRE_INSTALL_DIR=$HYPRE_BLUE_INSTALL_DIR
|
|
HYPRE_INSTALL_THREADS="--with-openmp"
|
|
shift;;
|
|
-red)
|
|
HYPRE_ARCH="red"
|
|
HYPRE_INSTALL_DIR=$HYPRE_RED_INSTALL_DIR
|
|
shift;;
|
|
install)
|
|
HYPRE_INSTALL="install"
|
|
shift;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
exit;;
|
|
esac
|
|
done
|
|
|
|
#===========================================================================
|
|
# Check that the install directory exists
|
|
#===========================================================================
|
|
|
|
if [ ! -d $HYPRE_INSTALL_DIR ]
|
|
then
|
|
echo "Error: HYPRE_INSTALL_DIR=$HYPRE_INSTALL_DIR does not exist"
|
|
exit
|
|
fi
|
|
|
|
#===========================================================================
|
|
# Update the source
|
|
#===========================================================================
|
|
|
|
cd $HYPRE_INSTALL_DIR
|
|
|
|
#==========================
|
|
# CASC Cluster, internal
|
|
#==========================
|
|
|
|
if [ "$HYPRE_ARCH" = "casc" ] &&
|
|
[ "$HYPRE_INSTALL_TYPE" = "internal" ]
|
|
then
|
|
# update only if no VERSION_NAME file
|
|
if [ ! -f UPDATE/VERSION_NAME ]
|
|
then
|
|
# create directory UPDATE and protect
|
|
mkdir -p UPDATE
|
|
rm -fr UPDATE/*
|
|
chmod $HYPRE_INSTALL_PERMISSIONS UPDATE
|
|
chmod go-w UPDATE
|
|
|
|
# checkout the source from the repository
|
|
(
|
|
if [ ! -d "$CVSROOT" ]
|
|
then
|
|
echo "Error: no CVS repository, CVSROOT = $CVSROOT"
|
|
exit
|
|
fi
|
|
mkdir UPDATE/src
|
|
cd UPDATE/src
|
|
cvs checkout -P linear_solvers
|
|
)
|
|
|
|
# build documentation and tools and install in UPDATE subdirectory
|
|
(
|
|
HYPRE_INSTALL_DIR=$HYPRE_INSTALL_DIR/UPDATE
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir UPDATE/docs
|
|
mkdir UPDATE/bin
|
|
cd UPDATE/src/linear_solvers
|
|
./configure
|
|
(cd docs; make install; make veryclean)
|
|
(cd tools; make install; make veryclean)
|
|
)
|
|
|
|
# store version info
|
|
(
|
|
cd UPDATE
|
|
src/linear_solvers/utilities/version > VERSION
|
|
# store version name with syntax VX.XX.XX (for sorting purposes)
|
|
src/linear_solvers/utilities/version -number | \
|
|
awk 'BEGIN {FS="."} {printf "V%d.%02d.%02d\n",$1,$2,$3}' \
|
|
> VERSION_NAME
|
|
)
|
|
|
|
# create the UPDATE.tar file
|
|
echo "creating the UPDATE.tar file ..."
|
|
cp UPDATE/src/linear_solvers/update .
|
|
rm -f UPDATE.tar
|
|
tar cf UPDATE.tar \
|
|
update \
|
|
UPDATE/VER* \
|
|
UPDATE/docs \
|
|
UPDATE/bin \
|
|
UPDATE/src/linear_solvers/configure \
|
|
UPDATE/src/linear_solvers/tarch \
|
|
UPDATE/src/linear_solvers/Makefile.in \
|
|
UPDATE/src/linear_solvers/HYPRE.h \
|
|
UPDATE/src/linear_solvers/HYPRE_config.h.in \
|
|
UPDATE/src/linear_solvers/blas \
|
|
UPDATE/src/linear_solvers/utilities \
|
|
UPDATE/src/linear_solvers/struct_matrix_vector \
|
|
UPDATE/src/linear_solvers/struct_linear_solvers \
|
|
UPDATE/src/linear_solvers/sstruct_matrix_vector \
|
|
UPDATE/src/linear_solvers/sstruct_linear_solvers \
|
|
UPDATE/src/linear_solvers/seq_matrix_vector \
|
|
UPDATE/src/linear_solvers/parcsr_matrix_vector \
|
|
UPDATE/src/linear_solvers/distributed_matrix \
|
|
UPDATE/src/linear_solvers/matrix_matrix \
|
|
UPDATE/src/linear_solvers/IJ_matrix_vector \
|
|
UPDATE/src/linear_solvers/distributed_linear_solvers/pilut \
|
|
UPDATE/src/linear_solvers/distributed_linear_solvers/ParaSails \
|
|
UPDATE/src/linear_solvers/parcsr_linear_solvers \
|
|
UPDATE/src/linear_solvers/FEI_matrix_vector \
|
|
UPDATE/src/linear_solvers/test
|
|
rm -f update
|
|
fi
|
|
fi
|
|
|
|
#==========================
|
|
# CASC Cluster, external
|
|
#==========================
|
|
|
|
if [ "$HYPRE_ARCH" = "casc" ] &&
|
|
[ "$HYPRE_INSTALL_TYPE" = "external" ]
|
|
then
|
|
cp ../internal/UPDATE.tar .
|
|
tar xf UPDATE.tar
|
|
fi
|
|
|
|
#==========================
|
|
# Check the source
|
|
#==========================
|
|
|
|
if [ ! -f UPDATE/VERSION_NAME ]
|
|
then
|
|
echo "Error: invalid update source in $HYPRE_INSTALL_DIR/UPDATE"
|
|
exit
|
|
fi
|
|
|
|
#===========================================================================
|
|
# Make sure permissions are right on UPDATE.tar
|
|
#===========================================================================
|
|
|
|
cd $HYPRE_INSTALL_DIR
|
|
|
|
if [ -f UPDATE.tar ]
|
|
then
|
|
chmod $HYPRE_INSTALL_PERMISSIONS UPDATE.tar
|
|
fi
|
|
|
|
#===========================================================================
|
|
# Build and do a temporary install in the UPDATE subdirectory
|
|
#===========================================================================
|
|
|
|
cd $HYPRE_INSTALL_DIR
|
|
|
|
# MPI version. (Do this only once)
|
|
if [ ! -d UPDATE/lib ]
|
|
then
|
|
(
|
|
HYPRE_INSTALL_DIR=$HYPRE_INSTALL_DIR/UPDATE
|
|
export HYPRE_INSTALL_DIR
|
|
|
|
cd UPDATE/src/linear_solvers
|
|
./configure
|
|
make install
|
|
make veryclean
|
|
|
|
echo "setting permissions ..."
|
|
chmod -fR $HYPRE_INSTALL_PERMISSIONS $HYPRE_INSTALL_DIR/*
|
|
)
|
|
(
|
|
HYPRE_INSTALL_DIR=$HYPRE_INSTALL_DIR/UPDATE/debug
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd UPDATE/src/linear_solvers
|
|
./configure --enable-debug
|
|
make install
|
|
make veryclean
|
|
|
|
echo "setting permissions ..."
|
|
chmod -fR $HYPRE_INSTALL_PERMISSIONS $HYPRE_INSTALL_DIR
|
|
)
|
|
fi
|
|
|
|
# MPI + threads version. (Do this only once)
|
|
if [ "$HYPRE_INSTALL_THREADS" != "" ] &&
|
|
[ ! -d UPDATE/threads/lib ]
|
|
then
|
|
(
|
|
HYPRE_INSTALL_DIR=$HYPRE_INSTALL_DIR/UPDATE/threads
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd UPDATE/src/linear_solvers
|
|
./configure $HYPRE_INSTALL_THREADS
|
|
make install
|
|
make veryclean
|
|
|
|
echo "setting permissions ..."
|
|
chmod -fR $HYPRE_INSTALL_PERMISSIONS $HYPRE_INSTALL_DIR
|
|
)
|
|
(
|
|
HYPRE_INSTALL_DIR=$HYPRE_INSTALL_DIR/UPDATE/threads/debug
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd UPDATE/src/linear_solvers
|
|
./configure $HYPRE_INSTALL_THREADS --enable-debug
|
|
make install
|
|
make veryclean
|
|
|
|
echo "setting permissions ..."
|
|
chmod -fR $HYPRE_INSTALL_PERMISSIONS $HYPRE_INSTALL_DIR
|
|
)
|
|
fi
|
|
|
|
#===========================================================================
|
|
# Complete the install
|
|
#===========================================================================
|
|
|
|
cd $HYPRE_INSTALL_DIR
|
|
|
|
if [ "$HYPRE_INSTALL" ]
|
|
then
|
|
# move the current installed version into an "old" directory
|
|
echo "saving the current installed version ..."
|
|
if [ -f VERSION_NAME ]
|
|
then
|
|
mkdir UPDATE_OLD
|
|
chmod $HYPRE_INSTALL_PERMISSIONS UPDATE_OLD
|
|
for i in [!UV]* VER*
|
|
do
|
|
mv $i UPDATE_OLD
|
|
done
|
|
OLD=`cat UPDATE_OLD/VERSION_NAME`
|
|
if [ -d "$OLD" ]
|
|
then
|
|
rm -fr $OLD
|
|
fi
|
|
mv UPDATE_OLD $OLD
|
|
fi
|
|
|
|
# move the updated version into the install directory
|
|
echo "installing the updated version ..."
|
|
mv UPDATE/* .
|
|
rmdir UPDATE
|
|
|
|
# keep some number of old copies of the library
|
|
echo "removing old installations ..."
|
|
NUM_COPIES=3
|
|
# note: `*' will expand alphabetically in the Bourne shell
|
|
set - V[1-9][^.]*
|
|
COUNT=`expr $# - $NUM_COPIES`
|
|
while [ $COUNT -gt 0 ]
|
|
do
|
|
rm -fr $1
|
|
shift
|
|
COUNT=`expr $COUNT - 1`
|
|
done
|
|
fi
|
|
|