diff --git a/bmad/code/attribute_bookkeeper.f90 b/bmad/code/attribute_bookkeeper.f90 index 1d71881612..8e0310950a 100644 --- a/bmad/code/attribute_bookkeeper.f90 +++ b/bmad/code/attribute_bookkeeper.f90 @@ -87,6 +87,7 @@ subroutine attribute_bookkeeper (ele, force_bookkeeping) if (ele%bookkeeping_state%attributes /= stale$ .and. .not. logic_option(.false., force_bookkeeping)) return else + call attributes_need_bookkeeping(ele) if (ele%bookkeeping_state%attributes /= stale$ .and. .not. logic_option(.false., force_bookkeeping)) return if (ele%lord_status /= not_a_lord$) then diff --git a/bmad/code/lattice_bookkeeper.f90 b/bmad/code/lattice_bookkeeper.f90 index de14a01463..136522a2a1 100644 --- a/bmad/code/lattice_bookkeeper.f90 +++ b/bmad/code/lattice_bookkeeper.f90 @@ -37,6 +37,7 @@ subroutine lattice_bookkeeper (lat, err_flag) type (branch_struct), pointer :: branch type (bookkeeping_state_struct), pointer :: stat +real(rp) dval(num_ele_attrib$) integer i, j logical, optional :: err_flag @@ -58,7 +59,7 @@ subroutine lattice_bookkeeper (lat, err_flag) branch => lat%branch(i) do j = 0, branch%n_ele_max call set_ele_status_stale (branch%ele(j), all_groups$, .false.) - call attributes_need_bookkeeping(branch%ele(j)) + call attributes_need_bookkeeping(branch%ele(j), dval) enddo enddo endif diff --git a/bmad/modules/bmad_struct.f90 b/bmad/modules/bmad_struct.f90 index 1bbd5a4e4e..68208a8c94 100644 --- a/bmad/modules/bmad_struct.f90 +++ b/bmad/modules/bmad_struct.f90 @@ -1035,18 +1035,21 @@ module bmad_struct type bunch_struct type (coord_struct), allocatable :: particle(:) integer, allocatable :: ix_z(:) ! bunch%ix_z(1) is index of head particle, etc. - real(rp) :: charge_tot = 0 ! Total charge in a bunch (Coul). - real(rp) :: charge_live = 0 ! Charge of live particles (Coul). - real(rp) :: z_center = 0 ! Longitudinal center of bunch (m). Note: Generally, z_center of - ! bunch #1 is 0 and z_center of the other bunches is negative. - real(rp) :: t_center = 0 ! Center of bunch creation time relative to head bunch. - real(rp) :: t0 = real_garbage$ ! Used by track1_bunch_space_charge for tracking so particles have constant t. - integer :: ix_ele = 0 ! Nominal element bunch is at. But, EG, dead particles can be someplace else. - integer :: ix_bunch = 0 ! Bunch index. Head bunch = 1, etc. - integer :: ix_turn = 0 ! Turn index for long term tracking. ix_turn = 0 before end of first turn, etc. + real(rp) :: charge_tot = 0 ! Total charge in a bunch (Coul). + real(rp) :: charge_live = 0 ! Charge of live particles (Coul). + real(rp) :: z_center = 0 ! Longitudinal center of bunch (m). Note: Generally, z_center of + ! bunch #1 is 0 and z_center of the other bunches is negative. + real(rp) :: t_center = 0 ! Center of bunch creation time relative to head bunch. + real(rp) :: t0 = real_garbage$ ! Used by track1_bunch_space_charge for tracking so particles have constant t. + logical :: drift_between_t_and_s = .false. + ! Drift (ignore any fields) instead of tracking to speed up the calculation? + ! This can only be done under certain circumstances. + integer :: ix_ele = 0 ! Nominal element bunch is at. But, EG, dead particles can be someplace else. + integer :: ix_bunch = 0 ! Bunch index. Head bunch = 1, etc. + integer :: ix_turn = 0 ! Turn index for long term tracking. ix_turn = 0 before end of first turn, etc. integer :: n_live = 0 - integer :: n_good = 0 ! Number of accepted steps when using adaptive step size control. - integer :: n_bad = 0 ! Number of rejected steps when using adaptive step size control. + integer :: n_good = 0 ! Number of accepted steps when using adaptive step size control. + integer :: n_bad = 0 ! Number of rejected steps when using adaptive step size control. end type type beam_struct diff --git a/bmad/modules/bookkeeper_mod.f90 b/bmad/modules/bookkeeper_mod.f90 index d3e4a3392a..1326938419 100644 --- a/bmad/modules/bookkeeper_mod.f90 +++ b/bmad/modules/bookkeeper_mod.f90 @@ -1901,16 +1901,42 @@ subroutine attributes_need_bookkeeping (ele, dval) enddo endif +if (associated(ele%cartesian_map)) then + do i = 1, size(ele%cartesian_map) + ele%value(check_sum$) = ele%value(check_sum$) + ele%cartesian_map(i)%field_scale + enddo +endif + +if (associated(ele%cylindrical_map)) then + do i = 1, size(ele%cylindrical_map) + ele%value(check_sum$) = ele%value(check_sum$) + ele%cylindrical_map(i)%field_scale + enddo +endif + +if (associated(ele%gen_grad_map)) then + do i = 1, size(ele%gen_grad_map) + ele%value(check_sum$) = ele%value(check_sum$) + ele%gen_grad_map(i)%field_scale + enddo +endif + +if (associated(ele%grid_field)) then + do i = 1, size(ele%grid_field) + ele%value(check_sum$) = ele%value(check_sum$) + ele%grid_field(i)%field_scale + enddo +endif + ! -dv = abs(ele%value - ele%old_value) -dv(x1_limit$:y2_limit$) = 0 ! Limit changes do not need bookkeeping -if (present(dval)) dval = dv +if (present(dval)) then + dv = abs(ele%value - ele%old_value) + dv(x1_limit$:y2_limit$) = 0 ! Limit changes do not need bookkeeping + dval = dv -if (all(dv == 0) .and. ele%key /= capillary$) then - ele%bookkeeping_state%attributes = ok$ -else - ele%bookkeeping_state%attributes = stale$ + if (all(dv == 0) .and. ele%key /= capillary$) then + ele%bookkeeping_state%attributes = ok$ + else + ele%bookkeeping_state%attributes = stale$ + endif endif end subroutine attributes_need_bookkeeping diff --git a/bmad/space_charge/space_charge_mod.f90 b/bmad/space_charge/space_charge_mod.f90 index 7a3fdd3755..6dd4ca84e7 100644 --- a/bmad/space_charge/space_charge_mod.f90 +++ b/bmad/space_charge/space_charge_mod.f90 @@ -416,6 +416,17 @@ subroutine track_bunch_to_s (bunch, s, branch) ! +if (bunch%drift_between_t_and_s) then + do i = 1, size(bunch%particle) + p => bunch%particle(i) + if (p%state /= alive$) cycle + call drift_particle_to_s(p, s, branch) + enddo + return +endif + +! + s_end = branch%ele(branch%n_ele_track)%s s_begin = branch%ele(0)%s @@ -474,6 +485,17 @@ subroutine track_bunch_to_t (bunch, t_target, branch) integer i, status real(rp) ds, t_target, dt, dt2, s1, s_end, s_target, s_begin +! + +if (bunch%drift_between_t_and_s) then + do i = 1, size(bunch%particle) + p0 => bunch%particle(i) + if (p0%state /= alive$) cycle + call drift_particle_to_t(p0, t_target, branch) + enddo + return +endif + ! Convert bunch to s-based coordinates s_begin = branch%ele(0)%s diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index c767a9fe0e..a66884bf0f 100644 --- a/tao/version/tao_version_mod.f90 +++ b/tao/version/tao_version_mod.f90 @@ -6,5 +6,5 @@ !- module tao_version_mod -character(*), parameter :: tao_version_date = "2023/09/23 01:45:26" +character(*), parameter :: tao_version_date = "2023/09/26 22:48:47" end module diff --git a/util/DELETE_release b/util/DELETE_release deleted file mode 100755 index b6c23cbcb8..0000000000 --- a/util/DELETE_release +++ /dev/null @@ -1,278 +0,0 @@ -#!/bin/sh -##################################################################### -# This is a script to delete an ENTIRE previously-built CESR release -##################################################################### -# USE WITH CAUTION -##################################################################### -# Conservative measures have been taken to -# prevent the accidental deletion of an important release, but if -# you make it through all the error checking and interlocks, this -# script WILL completely delete the entire release that you specify, -# including the build log file. -# --It will be as if it had never been built in the first place. -# --You have been warned. -##################################################################### -# Usage: -# DELETE_release [-QUIET] [-quiet] REL=release-name -# -# Optional -QUIET flag will perform the deletion without -# interactively prompting for confirmation. This is used primarily -# for automatic scripts. -##################################################################### - - -# Script help functions -myprint_help () { -# Print help info - echo "" - echo "Usage is: DELETE_release [flag] REL=release-name" - echo "" - echo "Using no flags will prompt for confirmation." - echo "" - echo "-quiet -q Prompt with no terminal beeping." - echo "-QUIET -Q Delete without prompting for confirmation." - echo "-help Print full list of command-line flags." - echo "" - exit 1 -} - -myprint_help2 () { -# Print help info - echo "" - echo "Usage is: DELETE_release [flag] REL=release-name" - echo "" - echo "Using no flags will prompt for confirmation." - echo "" - echo "-quiet -q Prompt with no terminal beeping." - echo "-QUIET -Q Delete without prompting for confirmation." - echo "-help Print this usage summary." - echo "" - echo "-NOLOCK Allow deletion of otherwise protected" - echo " DEVEL and/or CURRENT releases." - echo " USE WITH CAUTION" - echo "" - exit 1 -} - -########################## -# Main script starts here -########################## -# One hardcoded line here necessary for subsequent getting of config vars. -UTIL_DIR=`/home/cesrulib/bin/util/getcfg Paths UTIL_DIR` - -arg_list="" -REL_NAME="" -quiet=0 -QUIET=0 -NOLOCK=0 -PURGE=0 - -LIBS_DIR=`${UTIL_DIR}/getcfg Paths LIBS_DIR` -LIBS_DIR="${LIBS_DIR}/" -# Path on VMS cluster where release .zip archives are kept -VMS_ZIPDIR=`${UTIL_DIR}/getcfg Paths VMS_ZIPDIR` - -PLATFORMS=`${UTIL_DIR}/getcfg Platforms` - -if ( [ $# = 0 ] ) then - myprint_help - exit 1 -fi - -############################# -# Get command-line arguments -############################# -for i -do arg_list="${arg_list} ${i}" - case $i in - REL=* ) REL_NAME=`echo $i | cut -d= -f2` ;; - "-quiet" ) quiet=1 ;; - "-q" ) quiet=1;; - "-QUIET" ) QUIET=1;; - "-Q" ) QUIET=1;; - "-NOLOCK" ) NOLOCK=1;; - "-quiet" ) QUIET=1;; - "-PURGE" ) PURGE=1;; - "-help" ) myprint_help2; exit 1;; - * ) myprint_help; exit 1;; - esac -done - -if ( [ ${QUIET} -eq 1 ] && [ ! ${#} -eq 2 ] ) then - myprint_help -fi - -################################################ -# Begin error-checking paranoia -################################################ - -if ( [ ! -e /home/cesrulib/cesr_libs/log/${REL_NAME}.genlog ] ) then - echo "Release with name ${REL_NAME} does not exist. (.genlog check)" - exit 1 -fi - -if ( [ "${REL_NAME}" = "" ] ) then - echo "Please specify a build name after REL= on the command line." - exit 1 -fi - -# check here to determine if requested release has either -# a current pointer or a devel pointer filesystem link. If so, abort. -# Generalize here to avoid the need to hardcode any platform name. -if ( [ ${LIBS_DIR}Linux_i686_intel/current -ef ${LIBS_DIR}Linux_i686_intel/${REL_NAME} ] ) then - echo "" - echo "The release will not be deleted. It is the most recent CURRENT release." - echo "" - exit 1 -fi -if ( [ ${LIBS_DIR}Linux_i686_intel/devel -ef ${LIBS_DIR}Linux_i686_intel/${REL_NAME} ] ) then - echo "" - echo "The release will not be deleted. It is the most recent DEVEL release." - echo "" - exit 1 -fi - -# Test requested release against all older devel and current links. -# Don't delete if the requested release matches any of them. -for j in ${LIBS_DIR}Linux_i686_intel/current* -do - if ( [ ${j} -ef ${LIBS_DIR}Linux_i686_intel/${REL_NAME} ] ) then - if ( [ ${NOLOCK} -eq 1 ] && [ ${PURGE} -eq 0 ] ) then - echo "You have requested to delete a CURRENT release! Make sure" - echo "this is really what you want to do, then press to continue." - read -n 1 CONFIRM1 - if ( [ ! ${CONFIRM1} = "\n" ] ) then - echo "" - exit 1 - fi - else - if ( [ ${PURGE} -eq 0 ] ) then - echo "" - echo "The release will not be deleted. It is a protected older CURRENT release." - echo "" - exit 1 - fi - fi - fi -done - - -for k in ${LIBS_DIR}Linux_i686_intel/devel* -do - if ( [ ${k} -ef ${LIBS_DIR}Linux_i686_intel/${REL_NAME} ] ) then - if ( [ ${NOLOCK} -eq 1 ] && [ ${PURGE} -eq 0 ] ) then - echo "You have requested to delete a DEVEL release! Make sure" - echo "this is really what you want to do, then press to continue." - read -n 1 CONFIRM2 - if ( [ ! ${CONFIRM2} = "\n" ] ) then - echo "" - exit 1 - fi - else - if ( [ ${PURGE} -eq 0 ] ) then - echo "" - echo "The release will not be deleted. It is an older DEVEL release." - echo "" - exit 1 - fi - fi - fi -done - -if ( [ ! ${QUIET} -eq 1 ] && [ ${PURGE} -eq 0 ] ) then - echo "" - if ( [ ${quiet} -eq 1 ] ) then - echo "DELETE release - " - else - echo -e " DELETE_release - \a " - fi - echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - echo " @ WARNING WARNING WARNING WARNING WARNING @" - echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - echo " @ @" - echo " @ YOU ARE ABOUT TO _COMPLETELY_DELETE_ @" - echo " @ @" - echo " @ *** ${REL_NAME} ***" - echo " @ @" - echo " @ FROM ALL PLATFORM DIRECTORIES. ALL LOG FILES WILL BE @" - echo " @ REMOVED AS WELL! @" - echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - echo " Press ENTER to continue with this operation, " - echo " any other key to abort." - - read -n 1 CONFIRM2 - if ( [ ! ${CONFIRM2} = "\n" ] ) then - echo "" - exit 1 - fi - - if ( [ ${quiet} -eq 1 ] ) then - echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - else - echo -e " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\a" - fi - echo " @ @" - echo " @ Hit _NOW_ IF YOU DO NOT WANT TO DO THIS. @" - echo " @ (You have 10 seconds) @" - echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - sleep 10 -fi -echo -n "DELETING release ${REL_NAME}..." - - -################################################################# -# Perform the deletion across all platform archive areas. -################################################################# - -############################################# -# Remove all symbolic links associated with this release -############################################# - -for platform in ${PLATFORMS}; do - for file in ${LIBS_DIR}${platform}/devel* - do - if ( [ -L "${file}" ] ) && ( [ $( readlink ${file} ) = ${REL_NAME} ] ) then - rm -rf ${file} - fi - done -done - -############################################# -# Now remove everything else -############################################# - -for platform in ${PLATFORMS}; do - rm -rf /home/cesrulib/cesr_libs/${platform}/${REL_NAME} - - rm -f /home/cesrulib/cesr_libs/log/${platform}/${REL_NAME}.log - - rm -f /home/cesrulib/cesr_libs/${platform}/${REL_NAME}.zip # VMS area only -done -rm -rf /home/cesrulib/cesr_libs/distribution/${REL_NAME} -rm -f /home/cesrulib/cesr_libs/distribution/${REL_NAME}.tar.gz -rm -f /home/cesrulib/cesr_libs/distribution/log/${REL_NAME}.log - - -################################################################## -# Delete the release .zip file on the VMS cluster. -################################################################## -ftp cesr2f < /dev/null - binary - cd $VMS_ZIPDIR - delete ${REL_NAME}.zip -EOF -ftp_success=${?} -if ( [ ${ftp_success} -ne 0 ] ) then - echo "ERROR deleting release zip file on VMS cluster." - exit 15 -fi - -################################################## -# Delete .genlog file last to ensure thoroughness -################################################## -rm -f /home/cesrulib/cesr_libs/log/${REL_NAME}.genlog - -echo " DONE." -echo "" - -exit 0 diff --git a/util/INSTALL b/util/INSTALL deleted file mode 100644 index ae1f3d71fc..0000000000 --- a/util/INSTALL +++ /dev/null @@ -1,28 +0,0 @@ -[Note: When modifying, modify copy in bmad_dist/util/INSTALL. This will be copied to bmad_dist/INSTALL] - -BMAD DISTRIBUTION INSTALLATION INSTRUCTIONS -------------------------------------------- - -For Distribution building instructions, please see the web documentation: - https://wiki.classe.cornell.edu/ACC/ACL/OffsiteDoc - -Distribution tarballs can be downloaded from: - http://www.classe.cornell.edu/~cesrulib/downloads/tarballs - -The Bmad manual can be found on the Bmad web site: - http://www.classe.cornell.edu/~dcs/bmad - - -***************************************************************************** -OBTAINING HELP ---------------- - -For general questions, installation problems, code building problems contact: - ACC Code Librarian (cesrulib@cornell.edu) - -Currently, the people sharing library responsibility are: - Attilio De Falco - David Sagan - -For questions on the Bmad code contact: - David Sagan diff --git a/util/acc_vars.sh b/util/acc_vars.sh deleted file mode 100644 index e55447604e..0000000000 --- a/util/acc_vars.sh +++ /dev/null @@ -1,509 +0,0 @@ -#-------------------------------------------------------------- -# acc_vars.sh -# -# ACCelerator libraries management and software build system -# environment setup script. -# -# This script uses Bourne shell syntax. When sourced into a -# user's environment it allows for selection of a particular -# pre-built accelerator libraries release within the lab's -# Linux computing landscape. -# -# Variables that can be used to control the behavior of this -# environment setup process: -# To set the release to use when searching for include -# files and when linking code, several variable names are -# honored here if they exist in the sourcing user's -# environment to accommodate historical use habits and old -# lab-wide conventions. -# -# CESRLIB is honored unless -# ACCLIB is set, which is honored unless -# ACC_RELEASE_REQUEST is set. -# -# Environment setup is configured, for the time-being, to -# force 32-bit building and linking on all systems, -# regardless of machine type/architecture. To change this -# default behavior, the user must set the variable -# -# ACC_FORCE_32_BIT "N" -# -# in their environment BEFORE sourcing the setup script. -# This variable is only honored if the machine on which -# the setup script is sourced allows the option of running -# both 32-bit and 64-bit code. Otherwise, on a 32-bit-only -# system it is simply ignored. -# -# -# Once this script is sourced, ideally by getting called from -# the user's login script, shortcut aliases are available to -# allow easy selection of an active release and architecture. -# 'current' -- Sets active relase to CURRENT -# 'devel' -- Sets active release to DEVEL -# 'setrel -- Sets a specific release as active -# -# Other useful aliases defined below are: -# 'accinfo' -- Displays a summary of the active release's -# short name ('devel', 'current' etc), it's true (dated) -# name, build architecture, and selected Fortran compiler. -# -# For C-shell variant use, all of the above applies since the -# C-shell script is a wrapper for this one. The user must -# source the script named -# acc_vars.csh instead. -#-------------------------------------------------------------- - -#-------------------------------------------------------------- -# For User defined compiler, check how ACC_SET_F_COMPILER -# is defined, if not defined then set to default "ifort" -#-------------------------------------------------------------- -if ( [ -z ${ACC_SET_F_COMPILER} ] || [ "${ACC_SET_F_COMPILER}" != "gfortran" ] ) then - export ACC_SET_F_COMPILER="ifort" -fi - -#-------------------------------------------------------------- - -ONLINE_ARCHIVE_BASE_DIR='/nfs/cesr/online/lib' -ONLINE_OPT_DIR='/nfs/cesr/opt' - -ONLINE_RELEASE_MGMT_DIR=${ONLINE_ARCHIVE_BASE_DIR}'/util' - -#ONLINE_IFORT_SETUP_DIR=${ONLINE_OPT_DIR}'/intel/parallel_studio_xe_2016.2.062/bin' -ONLINE_IFORT_SETUP_DIR=${ONLINE_OPT_DIR}'/intel/parallel_studio_xe_2017_update7/bin' -ONLINE_IFORT_SETUP_COMMAND=(${ONLINE_IFORT_SETUP_DIR}'/compilervars.sh intel64') - -ONLINE_GFORTRAN_SETUP_DIR='/opt/rh/devtoolset-4/' -ONLINE_GFORTRAN_SETUP_COMMAND=(${ONLINE_GFORTRAN_SETUP_DIR}/enable) - -#-------------------------------------------------------------- - -OFFLINE_ARCHIVE_BASE_DIR='/nfs/acc/libs' -OFFLINE_OPT_DIR='/nfs/opt' - -[ "${OFFLINE_LOCAL_ARCHIVE_BASE_DIR}" ] && OFFLINE_ARCHIVE_BASE_DIR=${OFFLINE_LOCAL_ARCHIVE_BASE_DIR} - -OFFLINE_RELEASE_MGMT_DIR=${OFFLINE_ARCHIVE_BASE_DIR}'/util' - -#OFFLINE_IFORT_SETUP_DIR=${OFFLINE_OPT_DIR}'/intel/parallel_studio_xe_2016.2.062/bin' -OFFLINE_IFORT_SETUP_DIR=${OFFLINE_OPT_DIR}'/intel/parallel_studio_xe_2017_update7/bin' -OFFLINE_IFORT_SETUP_COMMAND=(${OFFLINE_IFORT_SETUP_DIR}'/compilervars.sh intel64') - -OFFLINE_GFORTRAN_SETUP_DIR='/opt/rh/devtoolset-4/' -OFFLINE_GFORTRAN_SETUP_COMMAND=(${OFFLINE_GFORTRAN_SETUP_DIR}/enable) - -# Capture value of ACC_BIN to allow removal from path for cleanliness. -OLD_ACC_BIN=${ACC_BIN} - -#-------------------------------------------------------------- -# Support functions -#-------------------------------------------------------------- -# Is argument $1 missing from argument $2 (or PATH)? -function no_path() { - eval "case :\$${2-PATH}: in *:$1:*) return 1;; *) return 0;; esac" -} - -# If argument path ($1) exists and is not in path, append it. -function add_path() { - [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1" -} - -# If argument ($1) is in PATH (or 2nd argument), remove it. -function del_path() { - no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: | - /bin/sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"` -} - -# Test whether argument 1 string contains argument 2 as a substring. -# Returns true(0) if substring is present -# Returns false(1) is substring is not -function has_substring() { - if [[ "${1}" =~ "${2}" ]]; then - return `true` - else - return `false` - fi -} - -# Function to remove duplicate path entries for any path variable -# passed as an argument. -function remove_duplicates() { - echo ${1} | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:",$i); }}' -} - - -#-------------------------------------------------------------- -# Files to hold a 'printenv' environment snapshot before this -# script defines all its variables, and again after for use -# in the wrapper script that only C-style shells will source. -# This is so that all the syntax for environment setup remains -# in one language, (bash) and need not be kept up-to-date -# between a bourne-shell setup script and C-shell one. -# -# Take first environment snapshot for C-shell support. -#-------------------------------------------------------------- -if ( [ "${ENV_USE_SNAPSHOTS}" == "Y" ] ) then - ENV_SNAPSHOT_1="${HOME}/.ACC_env_snapshot_1.tmp" - ENV_SNAPSHOT_2="${HOME}/.ACC_env_snapshot_2.tmp" - printenv > ${ENV_SNAPSHOT_1} -fi - - -#-------------------------------------------------------------- -# Set CESR_ONLINE to the path used for 'CESR offline' -# hosts if it hasn't already been set upon entering this -# script. -#-------------------------------------------------------------- -export CESR_ONLINE=${CESR_ONLINE:-/nfs/cesr/online} - - - -#-------------------------------------------------------------- -# 'CESR ONLINE' libraries are kept up-to-date with /nfs/acc/libs -# in case of a network failure. In that event, change the -# following variable to 'true' to use the online libs. -#-------------------------------------------------------------- - -case $(uname -n) in - cesr*) USE_CESR_ONLINE_LOC='true';; - *) USE_CESR_ONLINE_LOC='false';; -esac - - - -if ( [ "${USE_CESR_ONLINE_LOC}" == "true" ] ) then - - #-- CESR Online Host - SETUP_SCRIPTS_DIR=${ONLINE_RELEASE_MGMT_DIR} - RELEASE_ARCHIVE_BASE_DIR=${ONLINE_ARCHIVE_BASE_DIR} - HOST_TYPE="CESR ONLINE" - - - -else - #-- CESR OFFLINE Host - SETUP_SCRIPTS_DIR=${OFFLINE_RELEASE_MGMT_DIR} - RELEASE_ARCHIVE_BASE_DIR=${OFFLINE_ARCHIVE_BASE_DIR} - HOST_TYPE="CESR OFFLINE" - -fi - -# Online computers should use the online compiler and debugger -case $(uname -n) in - cesr*) IFORT_SETUP_COMMAND=${ONLINE_IFORT_SETUP_COMMAND} - GFORTRAN_SETUP_COMMAND=${ONLINE_GFORTRAN_SETUP_COMMAND} - export LM_LICENSE_FILE="/opt/intel/licenses/l_N6CKW3X8.lic:${ONLINE_OPT_DIR}/totalview/license.dat:${OFFLINE_OPT_DIR}/totalview/license.dat:${ONLINE_OPT_DIR}/MathWorks/Matlab_r2013a/licenses/network.lic:${OFFLINE_OPT_DIR}/MathWorks/Matlab_r2013a/licenses/network.lic" - export PATH=${PATH}:${ONLINE_OPT_DIR}/totalview/bin - ;; - *) IFORT_SETUP_COMMAND=${OFFLINE_IFORT_SETUP_COMMAND} - GFORTRAN_SETUP_COMMAND=${OFFLINE_GFORTRAN_SETUP_COMMAND} - export LM_LICENSE_FILE="${OFFLINE_OPT_DIR}/totalview/license.dat:${ONLINE_OPT_DIR}/totalview/license.dat:${OFFLINE_OPT_DIR}/MathWorks/Matlab_r2013a/licenses/network.lic:${ONLINE_OPT_DIR}/MathWorks/Matlab_r2013a/licenses/network.lic" - export PATH=${PATH}:${OFFLINE_OPT_DIR}/totalview/bin - ;; -esac - - - - -#-------------------------------------------------------------- -# Allow for util directory override. -#-------------------------------------------------------------- -SETUP_SCRIPTS_DIR=${UTIL_DIR_REQUEST:-$SETUP_SCRIPTS_DIR} -unset UTIL_DIR_REQUEST - - -#-------------------------------------------------------------- -# Variables that influence the build process -# (Their names begin with 'ACC'.) -#-------------------------------------------------------------- -ACC_OS="`uname`" -export ACC_ARCH="`uname -m`" -export ACC_OS_ARCH="${ACC_OS}_${ACC_ARCH}" - -if ( [ "${ACC_SET_F_COMPILER}" == "ifort" ] ) then - export ACC_FC="intel" -else - export ACC_FC="gfortran" -fi - - -#-------------------------------------------------------------- -# Allow for default behavior on 64-bit systems to be -# overridden to produce and use 32-bit binaries. -# -# Until full 64-bit OS migration takes place, all builds will -# default to 32-bit on all hosts. This can be changed to -# use the true machine architecture word length per user -# request by setting the ACC_FORCE_32_BIT variable to the -# value "N". -#-------------------------------------------------------------- -if ( [ "${ACC_FORCE_32_BIT}" == "" ] || [ "${ACC_FORCE_32_BIT}" == "N" ] ) then - #ACC_FORCE_32_BIT=N - export ACC_ARCH="x86_64" - export ACC_OS_ARCH="${ACC_OS}_${ACC_ARCH}" -fi - -if ( [ "${ACC_FORCE_32_BIT}" = "Y" ] ) then - export ACC_ARCH="i686" - export ACC_OS_ARCH="${ACC_OS}_${ACC_ARCH}" -fi - - - -export ACC_PLATFORM="${ACC_OS_ARCH}_${ACC_FC}" -PLATFORM_DIR=${RELEASE_ARCHIVE_BASE_DIR}/${ACC_PLATFORM} - -export ACC_BASE=${PLATFORM_DIR} - - - -#-------------------------------------------------------------- -# Determine if the requested release name was specified, AND -# if the that subdirectory of the platform directory whose -# name was generated above exists. -# If not, use the default "stable" release. -# -# Several variable names are honored here if they exist in the -# sourcing user's environment to accommodate historical use -# habits. -# CESRLIB is honored unless -# ACCLIB is set, which is honored unless -# ACC_RELEASE_REQUEST is set. -#-------------------------------------------------------------- -if ( [ "${CESRLIB}" != "" ] ) then - RELEASE_REQUEST=${CESRLIB} -fi -if ( [ "${ACCLIB}" != "" ] ) then - RELEASE_REQUEST=${ACCLIB} -fi -if ( [ "${ACC_RELEASE_REQUEST}" != "" ] ) then - RELEASE_REQUEST=${ACC_RELEASE_REQUEST} -fi - -if ( [ "${RELEASE_REQUEST}" != "" ] ) then - if ( [ "${RELEASE_REQUEST}" != "" -a -d ${PLATFORM_DIR}/${RELEASE_REQUEST} ] ) then - export ACC_RELEASE=${RELEASE_REQUEST} - else - echo "Release request \"${RELEASE_REQUEST}\" not found in" - echo "${PLATFORM_DIR}. Defaulting to \"current\" release." - export ACC_RELEASE="current" - fi -else - export ACC_RELEASE="current" -fi -unset CESRLIB -unset ACCLIB -unset ACC_RELEASE_REQUEST - -export ACC_RELEASE_DIR=${PLATFORM_DIR}/${ACC_RELEASE} -export ACC_ROOT_DIR=${ACC_RELEASE_DIR} # Defined for both Release and Distribution Builds -export ACC_TRUE_RELEASE=`readlink ${ACC_RELEASE_DIR}` -if ( [ "${ACC_TRUE_RELEASE}" == "" ] ) then - ACC_TRUE_RELEASE=${ACC_RELEASE} -fi -export ACC_UTIL=${SETUP_SCRIPTS_DIR} -export ACC_BIN=${ACC_RELEASE_DIR}/production/bin -export ACC_EXE=${ACC_BIN} # For backwards compatibility -export ACC_DEBUG=${ACC_RELEASE_DIR}/debug/bin -export ACC_PKG=${ACC_RELEASE_DIR}/packages -export ACC_REPO=https://accserv.lepp.cornell.edu/svn/ -export ACCR=https://accserv.lepp.cornell.edu/svn/ -export ACC_BUILD_SYSTEM=${RELEASE_ARCHIVE_BASE_DIR}/build_system -export ACC_BUILD_EXES=Y -export ACC_CMAKE_VERSION=3.13.2 # Updated as per request in RT#56874 -export TAO_DIR=${ACC_RELEASE_DIR}/tao - -#-------------------------------------------------------------- -# Variables to support other software packages -#-------------------------------------------------------------- -export PGPLOT_DIR=${ACC_PKG}/PGPLOT -export PGPLOT_FONT=${ACC_PKG}/PGPLOT/grfont.dat - - - -#-------------------------------------------------------------- -# Set up the fortran compiler appropriate to the machine -# architecture. -# -# TODO: These vendor-supplied compiler setup scripts will -# need to live in both CESR OFFLINE and CESR ONLINE -# directories. -#-------------------------------------------------------------- -case ${ACC_OS_ARCH} in - - "Linux_x86_64" ) - if ( [ "${ACC_SET_F_COMPILER}" == "ifort" ] ) then - source ${IFORT_SETUP_COMMAND} - else - source ${GFORTRAN_SETUP_COMMAND} - fi - ;; - -esac - - - -#-------------------------------------------------------------- -# Append necessary directories to the user's PATH environment -# variable. -#-------------------------------------------------------------- -del_path ${OLD_ACC_BIN} - -add_path ${ACC_UTIL} -add_path ${ACC_PKG}/bin -add_path ${ACC_BIN} - - -#-------------------------------------------------------------- -# Append path to guarantee proper cmake executable is used -# Added backup PATH /nfs/opt/extra/bin as requested in RT#65470 -#-------------------------------------------------------------- - -if [ -d ${PLATFORM_DIR}/extra/bin ]; then - PATH=${PLATFORM_DIR}/extra/bin:$PATH -elif [ -d /nfs/opt/extra/bin ]; then - PATH=/nfs/opt/extra/bin:$PATH -fi - -#-------------------------------------------------------------- -# Ensure that there is only one reference to the release's -# lib directory by searching the LD_LIBRARY_PATH variable -# value for paths that are prefixed with the -# RELEASE_ARCHIVE_BASE_DIR and removing them. The last -# step is appending the presently valid lib path for -# the active release. -#-------------------------------------------------------------- -DEFAULT_IFS=${IFS} # bash 'internal field separator' reserved variable -IFS=":" -LD_LIBRARY_PATH_TEMP="" -for part in ${LD_LIBRARY_PATH}; do - case ${part} in - - "${RELEASE_ARCHIVE_BASE_DIR}"*) - # echo "ACC path found. Will remove from LD_LIBRARY_PATH." - continue - ;; - - #"") - # continue -# ;; - - *) - if ( [ "${LD_LIBRARY_PATH_TEMP}" == "" ] ) then - LD_LIBRARY_PATH_TEMP=${part} - else - LD_LIBRARY_PATH_TEMP=${LD_LIBRARY_PATH_TEMP}:${part} - fi - ;; - - esac -done -IFS=${DEFAULT_IFS} -LD_LIBRARY_PATH=${LD_LIBRARY_PATH_TEMP} - - -#-------------------------------------------------------------- -# Source ROOT setup script for the set of ROOT libraries and -# programs built as 3rd-party packages in the selected release. -#-------------------------------------------------------------- -#if [ -f ${ACC_PKG}/root/bin/thisroot.sh ]; then - # To prevent multiple sourcing - #has_substring ${PATH} "root/../bin" - #if [ "${?}" == "1" ]; then - source ${ACC_PKG}/production/bin/thisroot.sh - #fi -#fi - -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ACC_RELEASE_DIR}/production/lib:${ACC_RELEASE_DIR}/packages/production/lib - - -#-------------------------------------------------------------- -# Useful aliases -#-------------------------------------------------------------- -# Information about build system setup for the current shell session. -function accinfo() { - printenv | grep ACC_ | sort; - export ACC_TRUE_RELEASE=`readlink ${ACC_RELEASE_DIR}` - echo -e "ACC release : \"${ACC_RELEASE}\" [${ACC_TRUE_RELEASE}] -Architecture : ${ACC_ARCH} -Fortran compiler : ${ACC_FC} -Cmake version : $(cmake --version | head -1 | awk ' { print $3 } ')" -} - -alias ACCINFO='accinfo' -alias acc_info='accinfo' -alias ACC_INFO='accinfo' - - -alias current='ACC_RELEASE_REQUEST=current; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh' -alias devel='ACC_RELEASE_REQUEST=devel; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh' -alias nightly='ACC_RELEASE_REQUEST=nightly; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh' -#alias online='ACC_RELEASE_REQUEST=online; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh' -#alias online-devel='ACC_RELEASE_REQUEST=online-devel; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh' - -alias current32='ACC_FORCE_32_BIT=Y; current' -alias devel32='ACC_FORCE_32_BIT=Y; devel;' - -# These are functions so that they may take arguments from the user. - -function setrel() { - ACC_RELEASE_REQUEST=${1}; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh -} - -function setrel64() { - ACC_FORCE_32_BIT=N; ACC_RELEASE_REQUEST=${1}; source ${SETUP_SCRIPTS_DIR}/acc_vars.sh -} - - -#-------------------------------------------------------------- -# Remove all duplicate path entries from variables composed during -# the above process -#-------------------------------------------------------------- -NEWPATH=$(remove_duplicates ${PATH}) -export PATH=${NEWPATH%?} -export LD_LIBRARY_PATH=`remove_duplicates ${LD_LIBRARY_PATH}` -export DYLD_LIBRARY_PATH=`remove_duplicates ${DYLD_LIBRARY_PATH}` -export MANPATH=`remove_duplicates ${MANPATH}` -export LIBPATH=`remove_duplicates ${LIBPATH}` -export LIBRARYPATH=`remove_duplicates ${LIBRARYPATH}` -export SYSPATH=`remove_duplicates ${SYSPATH}` -export SHLIB_PATH=`remove_duplicates ${SHLIB_PATH}` - - -#-------------------------------------------------------------- -# Take second environment snapshot for C-shell support. -#-------------------------------------------------------------- -if ( [ "${ENV_USE_SNAPSHOTS}" == "Y" ] ) then - printenv > ${ENV_SNAPSHOT_2} -fi - -#-------------------------------------------------------------- -# For User defined plot libaries, check how ACC_PLOT_PACKAGE -# is defined, if not defined then set to default "pgplot" -#-------------------------------------------------------------- -if ( [ "${ACC_PLOT_PACKAGE}" == "" ] ) then - export ACC_PLOT_PACKAGE="pgplot" -fi - -#-------------------------------------------------------------- -# If there are some acc dependent definitions -# (from cesr_online.bashrc), then redefine them -#-------------------------------------------------------------- -if [[ -n `type -t acc_dep_define` ]]; then - acc_dep_define -fi - -#-------------------------------------------------------------- -# Set ulimits to reasonable values... -# Although not recommended, a user may override these values -# depending on where in their .bashrc acc_vars.sh is sourced. -#-------------------------------------------------------------- -ulimit -S -c 0 -ulimit -S -s 10240 -ulimit -S -d 25165824 - -#-------------------------------------------------------------- -# Set Build Linker Flags -#-------------------------------------------------------------- -if [ -e ${ACC_UTIL}/build_flags_config ] ; then - . ${ACC_UTIL}/build_flags_config -fi