123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #!/usr/bin/env bash
- # local_setup.sh: Copies the runtime environment from the Autosubmit project
- # folder to the remote machine
- set -xvue
- PROJDEST=%PROJECT_DESTINATION%
- PROJDIR=%PROJDIR%
- HPCARCH=%HPCARCH%
- VERSION=%VERSION%
- how_many_retry_copy_file=5
- function ecaccess-file-put_with_check_and_retry(){
- source=$1
- destination=$2
- retry=0
- while [[ ${retry} -le ${how_many_retry_copy_file} ]]; do
- ecaccess-file-put ${source} ${destination}
- source_size=$(ls -lrt $source | awk '{print $5}')
- destination_size=$(ecaccess-file-size $destination)
- if [[ ${source_size} == ${destination_size} ]]; then
- echo "done."
- break
- else
- ((retry++))
- fi
- done
- if [[ ${retry} -eq how_many_retry_copy_file ]]; then
- echo "Transfer error: Source and destination files have not the same size. Exiting..."
- exit 1
- fi
- }
- #
- # Run ec-conf
- #
- cd %PROJDIR%/runtime/autosubmit
- #cd ${PROJDIR}/sources/runtime/autosubmit
- ln -sf ../classic/platform
- if [ ${HPCARCH} == 'ecmwf-xc40' ]
- then
- architecture=ecmwf-cca-intel
- module load ECAC
- ../../sources/util/ec-conf/ec-conf --platform ${architecture} -o PLT:ACTIVE:ECEARTH_SRC_DIR='${SCRATCH}/${exp_name}/auto-ecearth3/sources/sources' -o PLT:ACTIVE:RUN_DIR='${SCRATCH}/${exp_name}/${run_start_date}/${member}/runtime' -o PLT:ACTIVE:INI_DATA_DIR='${SCRATCH}/${exp_name}/${run_start_date}/${member}/inidata' config-run.xml
- #../../sources/util/ec-conf/ec-conf --platform ${architecture} -o PLT:ACTIVE:ECEARTH_SRC_DIR='${SCRATCH}/${exp_name}/auto-ecearth3/sources/sources' -o PLT:ACTIVE:RUN_DIR='${SCRATCH}/${exp_name}/${run_start_date}/${member}/runtime' -o PLT:ACTIVE:INI_DATA_DIR='/perm/ms/nl/nm6/ECE3-DATA' config-run.xml
- elif [ ${HPCARCH} == 'marenostrum4' ]
- then
- architecture=bsc-marenostrum4
- ../../sources/util/ec-conf/ec-conf --platform ${architecture} -o PLT:ACTIVE:INI_DATA_DIR="/gpfs/projects/bsc32/models/ecearth/${VERSION}/inidata" config-run.xml
- else
- error "Unsupported ec-conf architechture: ${HPCARCH}"
- exit 0
- fi
- #
- # Copy Model Sources
- #
- cd ${PROJDIR}; cd ..
- if [[ -d ${PROJDEST} ]]; then
- tar -zcvf ${PROJDEST}.tar.gz ${PROJDEST}
- else
- echo "!!! model not present !!!"
- exit 1
- fi
- # transfer model
- if [ ${HPCARCH} == 'ecmwf-xc40' ] ; then
- # ecaccess-file-mput -force ${PROJNAME}.tar.gz %HPCHOST%:%HPCROOTDIR%/
- module load ECAC
- ecaccess-file-mkdir %HPCHOST%:%HPCROOTDIR%/
- ecaccess-file-put_with_check_and_retry ${PROJDEST}.tar.gz %HPCHOST%:%HPCROOTDIR%/${PROJDEST}.tar.gz
- else
- rsync -avz ${PROJDEST}.tar.gz %HPCUSER%@%HPCHOST%:%HPCROOTDIR%/
- fi
- rm ${PROJDEST}.tar.gz
|