How to compile (P)elegant
Official build instructions
Go down for PSI build instructions!
Instructions to setup epics/base, epics/extensions compile SDDS and elegant. The instructions to build from source are almost at the end of the page:
https://www.aps.anl.gov/Accelerator-Operations-Physics/Software/installationGuide_Linux
Instructions to build Pelegant:
https://ops.aps.anl.gov/publish/Pelegant_manual/node2.html
Get the software
Main page
Configuration files for EPICS build system (base and extensions)
- http://www.aps.anl.gov/Accelerator_Systems_Division/Accelerator_Operations_Physics/cgi-bin/oagLog4.cgi?name=epics.base.configure.tar.gz
- http://www.aps.anl.gov/Accelerator_Systems_Division/Accelerator_Operations_Physics/cgi-bin/oagLog4.cgi?name=epics.extensions.configure.tar.gz
Configure files for elegant, spiffe, genesis, and shower
SDDS source
elegant source
Required Modules
module load gcc/7.3.0 gsl/2.4 mpich/3.2.1
Set used versions
SDDS_VERSION=3.6.1
ELEGANT_VERSION=34.2.0
Setup Environment
DOWNLOAD_DIR='/afs/psi.ch/software/Pmodules/distfiles/elegant'
PREFIX=/opt/psi/MPI/elegant/${ELEGANT_VERSION}/${MPI}/${MPI_VERSION}/${COMPILER}/${COMPILER_VERSION}
export EPICS_BASE="${PREFIX}/epics/base"
export HOST_ARCH=linux-x86_64
export EPICS_HOST_ARCH=linux-x86_64
export RPN_DEFNS="${PREFIX}/RPN_DEFNS/defns.rpn"
ARGS=()
ARGS+=( "INSTALL_LOCATION=${PREFIX}" )
ARGS+=( "INSTALL_LIB=${PREFIX}/lib" )
ARGS+=( "INSTALL_SHRLIB=${PREFIX}/lib" )
ARGS+=( "INSTALL_TCLLIB=${PREFIX}/lib" )
ARGS+=( "INSTALL_BIN=${PREFIX}/bin" )
Prepare base build environment
EPICS base configuration
mkdir -p "${PREFIX}"
mkdir -p "${RPN_DEFNS%/*}"
cp "${DOWNLOAD_DIR}/defns.rpn" "${RPN_DEFNS}"
cd "${PREFIX}"
tar xvf "${DOWNLOAD_DIR}/epics.base.configure.tar.gz"
cd epics/base
make
Unpack EPICS extensions and OAG apps configuration
cd "${PREFIX}"
tar xvf "${DOWNLOAD_DIR}/epics.extensions.configure.tar.gz"
tar xvf "${DOWNLOAD_DIR}/oag.apps.configure.tar.gz"
cd "${PREFIX}/oag/apps/configure"
Build required tools and libraries from SDDS
cd "${PREFIX}"
tar xvf "${DOWNLOAD_DIR}/SDDS.${SDDS_VERSION}.tar.gz"
make -e "${ARGS[@]}" -C namelist
make -e "${ARGS[@]}" -C pgapack
make -e "${ARGS[@]}" -C SDDSlib
make -e "${ARGS[@]}" -C SDDSlib clean
make -e "${ARGS[@]}" MPI=1 -C SDDSlib
== Compile (P)elegant
cd "${PREFIX}"
tar xvf "${DOWNLOAD_DIR}/elegant.${ELEGANT_VERSION}"
PATH+=":${PREFIX}/bin"
cd "${PREFIX}/oag/apps/src/physics"
make "${ARGS[@]}" OP_SYS_LDLIBS="-lreadline -lncurses -lgfortran -lquadmath -lf2c -lm -lrt -ldl"
cd "${PREFIX}/oag/apps/src/xraylib"
make "${ARGS[@]}" OP_SYS_LDLIBS="-lreadline -lncurses -lgfortran -lquadmath -lf2c -lm -lrt -ldl"
cd "${PREFIX}/oag/apps/src/elegant"
make "${ARGS[@]}" OP_SYS_LDLIBS="-lreadline -lncurses -lgfortran -lquadmath -lf2c -lm -lrt -ldl"
make "${ARGS[@]}" OP_SYS_LDLIBS="-lreadline -lncurses -lgfortran -lquadmath -lf2c -lm -lrt -ldl" Pelegant
make "${ARGS[@]}" OP_SYS_LDLIBS="-lreadline -lncurses -lgfortran -lquadmath -lf2c -lm -lrt -ldl" -C elegantTools
make "${ARGS[@]}" OP_SYS_LDLIBS="-lreadline -lncurses -lgfortran -lquadmath -lf2c -lm -lrt -ldl" -C sddsbrightness