Skip to content

Commit

Permalink
update installation script to allow quadruple precision install if su…
Browse files Browse the repository at this point in the history
…pported
  • Loading branch information
dalekopera committed Apr 9, 2024
1 parent a8c6ea0 commit 996585f
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 51 deletions.
99 changes: 75 additions & 24 deletions bin/install_cutest_alone
Original file line number Diff line number Diff line change
Expand Up @@ -230,24 +230,69 @@ echo "$MACHINE ($OPSYS) $COMPUSED" > $CUTEST/versions/$VERSION

if [[ ! -e $OBJDIR ]]; then
$MKDIR $OBJDIR
$MKDIR $OBJDIR/double $OBJDIR/single
$MKDIR $OBJDIR/double $OBJDIR/single $OBJDIR/quadruple
$MKDIR $OBJDIR/double_64 $OBJDIR/single_64 $OBJDIR/quadruple_64
else
[[ ! -e $OBJDIR/double ]] && $MKDIR $OBJDIR/double
[[ ! -e $OBJDIR/single ]] && $MKDIR $OBJDIR/single
if [[ ! -e $OBJDIR/double ]]; then
$MKDIR $OBJDIR/double
fi
if [[ ! -e $OBJDIR/single ]]; then
$MKDIR $OBJDIR/single
fi
if [[ ! -e $OBJDIR/quadruple ]]; then
$MKDIR $OBJDIR/quadruple
fi
if [[ ! -e $OBJDIR/double_64 ]]; then
$MKDIR $OBJDIR/double_64
fi
if [[ ! -e $OBJDIR/single_64 ]]; then
$MKDIR $OBJDIR/single_64
fi
if [[ ! -e $OBJDIR/quadruple_64 ]]; then
$MKDIR $OBJDIR/quadruple_64
fi
fi

if [[ ! -e $MODDIR ]]; then
$MKDIR $MODDIR
$MKDIR $MODDIR/double $MODDIR/single
$MKDIR $MODDIR/double $MODDIR/single $MODDIR/quadruple
$MKDIR $MODDIR/double_64 $MODDIR/single_64 $MODDIR/quadruple_64
else
[[ ! -e $MODDIR/double ]] && $MKDIR $MODDIR/double
[[ ! -e $MODDIR/single ]] && $MKDIR $MODDIR/single
if [[ ! -e $MODDIR/double ]]; then
$MKDIR $MODDIR/double
fi
if [[ ! -e $MODDIR/single ]]; then
$MKDIR $MODDIR/single
fi
if [[ ! -e $MODDIR/quadruple ]]; then
$MKDIR $MODDIR/quadruple
fi
if [[ ! -e $OBJDIR/double_64 ]]; then
$MKDIR $OBJDIR/double_64
fi
if [[ ! -e $OBJDIR/single_64 ]]; then
$MKDIR $OBJDIR/single_64
fi
if [[ ! -e $OBJDIR/quadruple_64 ]]; then
$MKDIR $OBJDIR/quadruple_64
fi
fi

[[ ! -e $PKGDIR ]] && $MKDIR $PKGDIR
[[ ! -e $PKGDIR/double ]] && $MKDIR $PKGDIR/double
[[ ! -e $PKGDIR/single ]] && $MKDIR $PKGDIR/single

[[ ! -e $PKGDIR ]] && $MKDIR $PKGDIR
[[ ! -e $PKGDIR/double ]] && $MKDIR $PKGDIR/double
[[ ! -e $PKGDIR/single ]] && $MKDIR $PKGDIR/single
[[ ! -e $PKGDIR/quadruple ]] && $MKDIR $PKGDIR/quadruple

if [[ $QUADREAL == 'yes' ]] ; then
QUADFLAG="-DCUTEST_16btye_reals_exist"
else
QUADFLAG=""
fi

#$CP $CUTEST/packages/defaults/* $PKGDIR/double/
#$CP $CUTEST/packages/defaults/* $PKGDIR/single/

Expand All @@ -268,14 +313,8 @@ MOD='$CUTEST/modules/'$VERSION'/$PRECIS'
FFLAGS="$LIBCMD"' '`eval echo $MODCMD`' '"$F90"
echo 'FFLAGS="'$FFLAGS' '$MBASIC' '$OPENMP'"' >> $SYSFILE
echo 'PROBFLAGS="'$FFLAGS' '$BASIC' '$OPTIMIZATION' '$F77' "' >> $SYSFILE
#echo 'CUTESTUSED="'$CUTESTUSED'"' >> $SYSFILE
echo 'BLAS="'$BLAS'"' >> $SYSFILE
echo 'LAPACK="'$LAPACK'"' >> $SYSFILE
#echo 'HSL="'$HSL'"' >> $SYSFILE
#echo 'METIS="'$METIS'"' >> $SYSFILE
#echo 'PARDISO="'$PARDISO'"' >> $SYSFILE
#echo 'WSMP="'$WSMP'"' >> $SYSFILE
#echo 'PLPLOT="'$PLPLOT'"' >> $SYSFILE

# write out the cutest/makefile/ file for this architecture

Expand All @@ -301,11 +340,15 @@ echo ' ' >> $MAKEFILE
echo '# Directory for binaries' >> $MAKEFILE
echo ' ' >> $MAKEFILE
echo 'PRECIS = double' >> $MAKEFILE
echo 'OBJ = $(CUTEST)/objects/$(VERSION)/$(PRECIS)' >> $MAKEFILE
echo 'OBJS = $(CUTEST)/objects/$(VERSION)/single' >> $MAKEFILE
echo 'OBJD = $(CUTEST)/objects/$(VERSION)/double' >> $MAKEFILE
echo 'MOD = $(CUTEST)/modules/$(VERSION)/$(PRECIS)' >> $MAKEFILE
echo 'SEDS = $(CUTEST)/seds/$(PRECIS).sed' >> $MAKEFILE
echo 'OBJ = $(CUTEST)/objects/$(VERSION)/$(PRECIS)' >> $MAKEFILE
echo 'OBJS = $(CUTEST)/objects/$(VERSION)/single' >> $MAKEFILE
echo 'OBJD = $(CUTEST)/objects/$(VERSION)/double' >> $MAKEFILE
echo 'OBJQ = $(CUTEST)/objects/$(VERSION)/quadruple' >> $MAKEFILE
echo 'OBJS64 = $(CUTEST)/objects/$(VERSION)/single_64' >> $MAKEFILE
echo 'OBJD64 = $(CUTEST)/objects/$(VERSION)/double_64' >> $MAKEFILE
echo 'OBJQ64 = $(CUTEST)/objects/$(VERSION)/quadruple_64' >> $MAKEFILE
echo 'MOD = $(CUTEST)/modules/$(VERSION)/$(PRECIS)' >> $MAKEFILE
echo 'SEDS = $(CUTEST)/seds/$(PRECIS).sed' >> $MAKEFILE
echo 'MVMODS = '"$MVMODS" >> $MAKEFILE
echo ' ' >> $MAKEFILE
echo '# Compiler options' >> $MAKEFILE
Expand All @@ -329,7 +372,8 @@ echo 'F95SUFFIX = '$F95SUFFIX >> $MAKEFILE
echo 'TIMER = '$TIMER >> $MAKEFILE
echo 'NOT95 = '$NOT95 >> $MAKEFILE
echo 'NOT64 = '$NOT64 >> $MAKEFILE
#echo 'PLPLOTUSED = '$PLPLOTUSED >> $MAKEFILE
echo 'INTEGER = '$INTEGER >> $MAKEFILE
echo 'QUADREAL = '$QUADFLAG >> $MAKEFILE
echo ' ' >> $MAKEFILE
echo 'AMPLDIR = '$AMPLLIBDIR >> $MAKEFILE
echo 'CC = '$CC >> $MAKEFILE
Expand All @@ -346,12 +390,6 @@ echo '# Libraries' >> $MAKEFILE
echo ' ' >> $MAKEFILE
echo 'BLAS = '$BLAS >> $MAKEFILE
echo 'LAPACK = '$LAPACK >> $MAKEFILE
#echo 'HSL = '$HSL >> $MAKEFILE
#echo 'METIS = '$METIS >> $MAKEFILE
#echo 'PARDISO = '$PARDISO >> $MAKEFILE
#echo 'WSMP = '$WSMP >> $MAKEFILE
#echo 'PLPLOT = '$PLPLOT >> $MAKEFILE
#echo 'CUTESTUSED = '$CUTESTUSED >> $MAKEFILE
echo 'CUTESTUSED = ' >> $MAKEFILE
echo ' ' >> $MAKEFILE
echo '# Shell used' >> $MAKEFILE
Expand Down Expand Up @@ -441,6 +479,19 @@ if [[ $? == 1 ]]; then
esac

fi

# optionally compile the selected packages in quadruple precision if supported

if [[ $QUADREAL == 'yes' ]] ; then
yesno_default_no ' Would you like to compile CUTEst in quadruple precision ...'
if [[ $? != 0 ]]; then
PREC='quadruple'
MACROS="PRECIS=$PREC PWD=$CUTEST/src CUTEST=$CUTEST
$MAKE $OPTIONS all $MACROS
fi
fi
fi
fi
echo -e "\n Remember to set the environment variable"
Expand Down
51 changes: 33 additions & 18 deletions bin/install_cutest_main
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cutest_compile () {
echo "$MAKE $OPTIONS all all_matlab $MACROS"
else
echo " compiling in $CUTEST/src with the comand"
echo " $MAKE $OPTIONS all all_matlab"
echo " $MAKE $OPTIONS all all_matlab $MACROS"
$MAKE $OPTIONS all all_matlab $MACROS
[[ $? != 0 ]] && exit 2
fi
Expand All @@ -28,7 +28,7 @@ cutest_compile () {
echo "$MAKE $OPTIONS all $MACROS"
else
echo " compiling in $CUTEST/src with the comand"
echo " $MAKE $OPTIONS all"
echo " $MAKE $OPTIONS all $MACROS"
$MAKE $OPTIONS all $MACROS
[[ $? != 0 ]] && exit 2
fi
Expand Down Expand Up @@ -80,7 +80,8 @@ fi

if [[ ! -e $MODDIR ]]; then
$MKDIR $MODDIR
$MKDIR $MODDIR/double $MODDIR/single $OBJDIR/double_64 $OBJDIR/single_64
$MKDIR $MODDIR/double $MODDIR/single $MODDIR/quadruple
$MKDIR $MODDIR/double_64 $MODDIR/single_64 $MODDIR/quadruple_64
else
if [[ ! -e $MODDIR/double ]]; then
$MKDIR $MODDIR/double
Expand All @@ -107,11 +108,11 @@ fi
[[ ! -e $PKGDIR/single ]] && $MKDIR $PKGDIR/single
[[ ! -e $PKGDIR/quadruple ]] && $MKDIR $PKGDIR/quadruple

if [[ $QUADREAL == 'yes' ]] ; then
if [[ $QUADREAL == "yes" ]] ; then
QUADFLAG="-DCUTEST_16btye_reals_exist"
else
QUADFLAG=""
if
fi

# write out the cutest/bin/sys file for this architecture

Expand Down Expand Up @@ -160,8 +161,10 @@ echo 'PRECIS = double' >> $MAKEFILE
echo 'OBJ = $(CUTEST)/objects/$(VERSION)/$(PRECIS)' >> $MAKEFILE
echo 'OBJS = $(CUTEST)/objects/$(VERSION)/single' >> $MAKEFILE
echo 'OBJD = $(CUTEST)/objects/$(VERSION)/double' >> $MAKEFILE
echo 'OBJQ = $(CUTEST)/objects/$(VERSION)/quadruple' >> $MAKEFILE
echo 'OBJS64 = $(CUTEST)/objects/$(VERSION)/single_64' >> $MAKEFILE
echo 'OBJD64 = $(CUTEST)/objects/$(VERSION)/double_64' >> $MAKEFILE
echo 'OBJQ64 = $(CUTEST)/objects/$(VERSION)/quadruple_64' >> $MAKEFILE
echo 'MOD = $(CUTEST)/modules/$(VERSION)/$(PRECIS)' >> $MAKEFILE
echo 'SEDS = $(CUTEST)/seds/$(PRECIS).sed' >> $MAKEFILE
echo 'MVMODS = '"$MVMODS" >> $MAKEFILE
Expand Down Expand Up @@ -227,39 +230,51 @@ if [[ $? != 0 ]]; then
cd $CUTEST/src/
OPTIONS="-s -f $CUTEST/makefiles/$VERSION"

if [[ $GALAHAD_REQPREC == "" ]] ; then
echo -e '\n CUTEst may be compiled in (S)ingle or (D)ouble precision or (B)oth.'
read -p ' Which precision do you require for the installed subset (D/s/b) ? ' -r -n 1 GALAHAD_REQPREC;
if [[ $QUADREAL == "yes" ]] ; then
if [[ $GALAHAD_REQPREC == "" ]] ; then
echo -e '\n CUTEst may be compiled in (S)ingle, (D)ouble or'
echo -e ' (Q)uadruple precision or (A)ll of these.'
read -p ' Which precision do you require for the installed subset (D/s/q/a) ? ' -r -n 1 GALAHAD_REQPREC;
if [[ $GALAHAD_REQPREC == "" ]] ; then
GALAHAD_REQPREC="D"
fi
fi

else
if [[ $GALAHAD_REQPREC == "" ]] ; then
GALAHAD_REQPREC="D"
echo -e '\n CUTEst may be compiled in (S)ingle or (D)ouble precision or (B)oth.'
read -p ' Which precision do you require for the installed subset (D/s/b) ? ' -r -n 1 GALAHAD_REQPREC;
if [[ $GALAHAD_REQPREC == "" ]] ; then
GALAHAD_REQPREC="D"
fi
fi
fi

if [[ $GALAHAD_REQPREC == [Ss] ]] ; then
PREC='single'
elif [[ $GALAHAD_REQPREC == [Qq] ]] ; then
PREC='quadruple'
else
PREC='double'
fi
cutest_compile

# optionally compile the selected packages in the other precision
# optionally compile the selected packages in the other (single) precision

if [[ $GALAHAD_REQPREC == [Bb] ]] ; then
PREC='single'
cutest_compile
fi

# optionally compile the selected packages in quadruple precision if supported
# optionally compile the selected packages in all the other precisions

if [[ $QUADREAL == 'yes' ]] ; then
yesno_default_no ' Would you like to compile CUTEst in quadruple precision ...'
if [[ $? != 0 ]]; then
PREC='quadruple'
cutest_compile
fi
if [[ $GALAHAD_REQPREC == [Aa] ]] ; then
PREC='single'
cutest_compile
PREC='quadruple'
cutest_compile
fi


success 'CUTEst successfully installed'
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/uninstall_cutest
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ while [[ $finished != 'true' ]]; do
fi

yesno_default_no " Do you wish to uninstall another version"
[[ $? != 0 ]] && finished='true'
[[ $? == 0 ]] && finished='true'
done
2 changes: 1 addition & 1 deletion include/cutest.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ typedef bool logical;
#ifdef SINGLE
typedef float rp_;
typedef float rpc_;
#elseif QUAD
#elif QUAD
typedef __float128 rp_;
typedef __float128 rpc_;
#else
Expand Down
3 changes: 2 additions & 1 deletion src/makedefs/instructions
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# standard CUTEst compilation and run instructions

# Nick Gould, for GALAHAD production
# This version: 2023-11-22
# This version: 2024-04-08

# compilation agenda

Expand All @@ -13,6 +13,7 @@ $(package): $(package)_$(PRECIS)
@printf ' %-21s\n' "CUTEst: $(package) ($(PRECIS) $(SUCC)"
$(package)_single: $($(PACKAGE))
$(package)_double: $($(PACKAGE))
$(package)_quadruple: $($(PACKAGE))

# compile tools

Expand Down
Loading

0 comments on commit 996585f

Please sign in to comment.