2018-11-27 00:04:34 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
NODES=($(srun hostname))
|
|
|
|
|
|
|
|
# Test that there is one MPI process per node
|
|
|
|
NPROC=$(echo ${NODES[@]} | tr ' ' '\n' | sort | wc -l)
|
|
|
|
NUNIQ=$(echo ${NODES[@]} | tr ' ' '\n' | sort | uniq | wc -l)
|
|
|
|
if [[ $NPROC != $NUNIQ ]]
|
|
|
|
then
|
|
|
|
echo "
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Error:
|
|
|
|
|
|
|
|
There are more than one process per host.
|
|
|
|
In your SLURM script file, use:
|
|
|
|
|
|
|
|
#SBATCH --nodes=$NPROC
|
|
|
|
#SBATCH --ntasks-per-node=1
|
|
|
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
PROG=$1
|
|
|
|
INPUT=$2
|
|
|
|
|
|
|
|
# Check if quantum_package.rc is sourced
|
|
|
|
|
|
|
|
if [[ -z ${QP_ROOT} ]]
|
|
|
|
then
|
|
|
|
echo "Error: quantum_package.rc is not sourced"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Get host names
|
|
|
|
|
|
|
|
MASTER_NODE=${NODES[0]}
|
|
|
|
SLAVE_NODES=$(echo ${NODES[@]:1}| tr ' ' ',')
|
|
|
|
if [[ $NPROC -gt 1 ]]
|
|
|
|
then
|
|
|
|
echo "Master : $MASTER_NODE"
|
|
|
|
echo "Slaves : $SLAVE_NODES"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if the integrals can be read
|
|
|
|
source ${QP_ROOT}/external/ezfio/Bash/ezfio.sh
|
|
|
|
ezfio set_file $INPUT
|
|
|
|
RW=$(ezfio get integrals_bielec disk_access_mo_integrals)
|
|
|
|
if [[ $RW != Read ]]
|
|
|
|
then
|
|
|
|
echo "
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Warning:
|
|
|
|
|
|
|
|
Two-electron integrals were not saved to disk in a previous run.
|
|
|
|
If the 4-index transformation takes time, you may consider
|
|
|
|
killing this job and running
|
|
|
|
|
|
|
|
qp_run Four_idx_transform $INPUT
|
|
|
|
|
|
|
|
as a single-node job before re-submitting the current job.
|
|
|
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
"
|
|
|
|
fi
|
2018-12-21 17:50:24 +01:00
|
|
|
rm --force -- "${INPUT}"/work/qp_run_address
|
2018-11-27 00:04:34 +01:00
|
|
|
set -x
|
2018-11-28 11:03:10 +01:00
|
|
|
srun -N 1 -n 1 qp_run $PROG $INPUT &
|
2018-11-27 00:04:34 +01:00
|
|
|
|
|
|
|
if [[ $NPROC -gt 1 ]]
|
|
|
|
then
|
|
|
|
while [[ ! -f $INPUT/work/qp_run_address ]]
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo "Starting slaves"
|
2019-01-07 00:25:08 +01:00
|
|
|
srun -n $((${SLURM_NTASKS}-1)) qp_run -slave $PROG $INPUT > $INPUT.slaves.out
|
2018-11-27 00:04:34 +01:00
|
|
|
fi
|
|
|
|
wait
|
|
|
|
|
|
|
|
|