From: Uwe Köcher Date: Tue, 6 Oct 2015 09:27:47 +0000 (+0200) Subject: candi: major work: allows to set the PREFIX_PATH and PROCS variable from the outside. X-Git-Tag: v0.7~13^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81f821913b2a800b98febb0177ecfcb1b205cdc0;p=candi.git candi: major work: allows to set the PREFIX_PATH and PROCS variable from the outside. Warning: the usage interface is now: ./candi.sh ./candi.sh --prefix= or -p=* | --PREFIX_PATH=* ./candi.sh --np= or -np=* | --procs=* | --PROCS=* | -j* ./candi.sh --platform= or -pf=* --- diff --git a/candi.sh b/candi.sh index 2f6b1e2..e1cb8f8 100755 --- a/candi.sh +++ b/candi.sh @@ -25,6 +25,7 @@ set -a # https://bitbucket.org/fenics-project/dorsal/src # # master c667be2 2013-11-27 # +################################################################################ # The Unix date command does not work with nanoseconds, so use # the GNU date instead. This is available in the 'coreutils' package # from MacPorts. @@ -36,6 +37,38 @@ fi # Start global timer TIC_GLOBAL="$(${DATE_CMD} +%s%N)" +################################################################################ +# Parse input parameters +for param in "$@"; do + case $param in + ##################################### + # Prefix path + -p=*|--prefix=*|--PREFIX_PATH=*) + PREFIX="${param#*=}" + ;; + + ##################################### + # Number of maximum processes to use + -np=*|--np=*|--procs=*|--PROCS=*) + NP="${param#*=}" + ;; + # Make styled processes + -j*) + NP="${param#*j}" + ;; + + ##################################### + # Specific platform + -pf=*|--platform=*) + GIVEN_PLATFORM="${param#*=}" + ;; + esac +done + +PREFIX_PATH=${PREFIX:-~/apps/candi} +PROCS=${NP:-1} + +################################################################################ # Check if the curl download is available if builtin command -v curl > /dev/null; then CURL_DOWNLOADER_AVAILABLE=true @@ -43,12 +76,14 @@ else CURL_DOWNLOADER_AVAILABLE=false fi +################################################################################ # Colours for progress and error reporting BAD="\033[1;31m" GOOD="\033[1;32m" WARN="\033[1;34m" BOLD="\033[1m" +################################################################################ ### Define helper functions ### prettify_dir() { @@ -298,9 +333,6 @@ package_build() { for target in "${TARGETS[@]}"; do echo make ${MAKEOPTS} -j ${PROCS} $target >>candi_build done -# for target in "${TARGETS[@]}"; do -# echo make -C ${BUILDDIR} ${MAKEOPTS} -j ${PROCS} $target >>candi_build -# done elif [ ${BUILDCHAIN} = "custom" ]; then # Write the function definition to file declare -f package_specific_build >>candi_build @@ -419,12 +451,13 @@ fi # If any variables are missing, revert them to defaults default PROJECT=deal.II -default DOWNLOAD_PATH=${HOME}/apps/candi/${PROJECT}/src -default UNPACK_PATH=${HOME}/apps/candi/${PROJECT}/unpack -default BUILD_PATH=${HOME}/apps/candi/${PROJECT}/build + +default DOWNLOAD_PATH=${PREFIX_PATH}/src +default UNPACK_PATH=${PREFIX_PATH}/${PROJECT}/unpack +default BUILD_PATH=${PREFIX_PATH}/${PROJECT}/build default CLEAN_BUILD=false -default INSTALL_PATH=${HOME}/apps/candi/${PROJECT} -default PROCS=1 +default INSTALL_PATH=${PREFIX_PATH}/${PROJECT} + default STABLE_BUILD=true default USE_SNAPSHOTS=false default PACKAGES_OFF="" @@ -447,7 +480,7 @@ else fi # Check if candi.sh was invoked correctly -if [ $# -eq 0 ]; then +if [ -z "${GIVEN_PLATFORM}" ]; then PLATFORM_SUPPORTED=${PROJECT}/platforms/supported/`guess_platform`.platform PLATFORM_CONTRIBUTED=${PROJECT}/platforms/contributed/`guess_platform`.platform PLATFORM_DEPRECATED=${PROJECT}/platforms/deprecated/`guess_platform`.platform @@ -465,7 +498,7 @@ if [ $# -eq 0 ]; then else cecho ${BAD} "Error: Platform to build for not specified (and not automatically recognised)." echo "If you know the platform you are interested in (myplatform), please specify it directly, as:" - echo "./candi.sh ${PROJECT}/platforms/supported/myplatform.platform" + echo "./candi.sh --platform=${PROJECT}/platforms/supported/myplatform.platform" echo "If you'd like to learn more, refer to the file USAGE for detailed usage instructions." exit 1 fi @@ -481,6 +514,8 @@ if [ $# -eq 0 ]; then echo "Building projects in: $(prettify_dir ${BUILD_PATH})" echo "Installing projects in: $(prettify_dir ${INSTALL_PATH})" echo + echo "Number of at most build processes to use: PROCS=${PROCS}" + echo if [ ${STABLE_BUILD} = true ]; then echo "Building stable point-releases of ${PROJECT} projects." else @@ -538,19 +573,19 @@ if [ $# -eq 0 ]; then echo "" cecho ${GOOD} "Once ready, hit enter to continue!" read -elif [ $# -eq 1 ]; then - PLATFORM_SUPPORTED=${1} +elif [ ! -z "${GIVEN_PLATFORM}" ]; then + PLATFORM_SUPPORTED=${GIVEN_PLATFORM} if [ -e ${PLATFORM_SUPPORTED} ]; then PLATFORM=${PLATFORM_SUPPORTED} cecho ${GOOD} "Building ${PROJECT} using ${PLATFORM}." if [ "${PLATFORM}" = "deal.II/platforms/supported/linux_cluster.platform" ]; then - cecho ${WARN} "BLAS_DIR and LAPACK_DIR need to be set in the configuration file" - cecho ${WARN} "if you want to use Trilinos." + cecho ${BAD} "BLAS_DIR and LAPACK_DIR need to be set in the configuration file" + cecho ${BAD} "if you want to use Trilinos." fi else cecho ${BAD} "Error: Platform to build for not supported." echo "If you know the platform you are interested in (myplatform), please specify it directly, as:" - echo "./candi.sh ${PROJECT}/platforms/supported/myplatform.platform" + echo "./candi.sh --platform=${PROJECT}/platforms/supported/myplatform.platform" echo "If you'd like to learn more, refer to the file USAGE for detailed usage instructions." exit 1 fi diff --git a/deal.II/packages/dealii-snapshot.package b/deal.II/packages/dealii-snapshot.package deleted file mode 100644 index 1ef1236..0000000 --- a/deal.II/packages/dealii-snapshot.package +++ /dev/null @@ -1,47 +0,0 @@ -NAME=deal.II-svn -SOURCE=https://svn.dealii.org/trunk/deal.II -PACKING=svn -BUILDCHAIN=custom - -CONFOPTS=" \ -${DEAL_CONFOPTS} \ -" - -CONFOPTS="${CONFOPTS} \ --D HDF5_DIR=${HDF5_DIR} \ -" - -CONFOPTS="${CONFOPTS} \ --D TRILINOS_DIR=${TRILINOS_DIR} \ -" - -CONFOPTS="${CONFOPTS} \ --D PETSC_DIR=${PETSC_DIR} \ -" - -CONFOPTS="${CONFOPTS} \ --D SLEPC_DIR=${SLEPC_DIR} \ -" - -CONFOPTS="${CONFOPTS} \ --D CMAKE_INSTALL_PREFIX:PATH="${INSTALL_PATH}" \ -" - -package_specific_setup () { - echo "Build ${NAME} in ${BUILD_PATH}/${NAME}" - mkdir -p "${BUILD_PATH}/${NAME}" - cd "${BUILD_PATH}/${NAME}" - - DEALII_SOURCE="${DOWNLOAD_PATH}/${EXTRACTSTO}" - - # configure - cmake ${CONFOPTS} ${DEALII_SOURCE} - - # make - make -j${PROCS} - make install -} - -package_specific_register () { - export DEALII_DIR=${INSTALL_PATH} -} diff --git a/deal.II/packages/dealii-stable.package b/deal.II/packages/dealii-stable.package index d3a0174..6e3f04a 100644 --- a/deal.II/packages/dealii-stable.package +++ b/deal.II/packages/dealii-stable.package @@ -1,4 +1,4 @@ -VERSION=v8.3.0 +VERSION=${DEAL_II_VERSION} NAME=dealii.git EXTRACTSTO=deal.II-${VERSION} SOURCE=https://github.com/dealii/ diff --git a/deal.II/packages/dealii.package b/deal.II/packages/dealii.package index 01fa582..3609810 100644 --- a/deal.II/packages/dealii.package +++ b/deal.II/packages/dealii.package @@ -43,8 +43,21 @@ CONFOPTS="${CONFOPTS} \ # ********************************************************************************** package_specific_conf() { -MODULEFILE_PATH=${INSTALL_PATH}/conf/modulefiles/deal.II/${COMPILER} -CONFIG_FILE=${MODULEFILE_PATH}/${VERSION} + +# Prepare modulefile path and config file name +if [ -z "${COMPILER}" ]; then + COMPILER=default +fi + +if [ -z "${MODULEFILE_PATH}" ]; then + MODULEFILE_PATH=${INSTALL_PATH#$PREFIX_PATH} + MODULEFILE_PATH=${MODULEFILE_PATH%/$COMPILER} +fi + +if [ -z "${CONFIG_FILE}" ]; then + CONFIG_FILE=${MODULEFILE_PATH}/${COMPILER} +fi + CURRENT_MODULES=$(echo ${LOADEDMODULES} | sed 's/:/\ /') # Generate modulefile diff --git a/project-deal.II.cfg b/project-deal.II.cfg index fdd8c58..e27e0ff 100644 --- a/project-deal.II.cfg +++ b/project-deal.II.cfg @@ -5,6 +5,7 @@ # Meta-project to build PROJECT=deal.II +DEAL_II_VERSION=v8.3.0 CLEAN_BUILD=false ######################################################################### @@ -55,41 +56,25 @@ DEAL_CONFOPTS=" \ # LAPACK_DIR= ######################################################################### + # Do you want to use MKL? MKL=OFF +# BLAS_DIR= +# LAPACK_DIR= -######################################################################### -# How many processes would you like to build using? -PROCS=1 - -######################################################################### -# Prefix directory -PREFIX_PATH=~/apps/candi - -######################################################################### -# Setup compiler name string -COMPILERBASE=default -#COMPILERBASE=gcc-5.1.1 -#COMPILERBASE=llvm - -COMPILERMPI=default -#COMPILERMPI=openmpi-1.8.7 -#COMPILERMPI=mpich-3.1.4 - -COMPILER=${COMPILERBASE}-${COMPILERMPI} ######################################################################### # Where do you want the downloaded source files to go? -DOWNLOAD_PATH=${PREFIX_PATH}/src +#DOWNLOAD_PATH=${PREFIX_PATH}/src # Where do you want to unpack source files to go? -UNPACK_PATH=${PREFIX_PATH}/unpack +#UNPACK_PATH=${PREFIX_PATH}/unpack # Where do you want the build files to go? -BUILD_PATH=${PREFIX_PATH}/${PROJECT}/${COMPILER}-build +BUILD_PATH=${PREFIX_PATH}/${PROJECT}/${DEAL_II_VERSION}-build # Where do you want the compiled software installed? -INSTALL_PATH=${PREFIX_PATH}/${PROJECT}/${COMPILER} +INSTALL_PATH=${PREFIX_PATH}/${PROJECT}/${DEAL_II_VERSION} # Would you like to build stable versions of projects? # If STABLE_BUILD=false, then the development version of deal.II will be