-
Notifications
You must be signed in to change notification settings - Fork 0
/
dftb+_22.2_frequency_direct.sh
174 lines (115 loc) · 3.5 KB
/
dftb+_22.2_frequency_direct.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
#
#SBATCH --job-name=polarizability_calculation
#SBATCH --output=output_%j.out
#SBATCH --error=error_%j.err
#SBATCH --ntasks=Nan
#SBATCH --time=Nan
#SBATCH --partition=Nan
#SBATCH [email protected]
#SBATCH --mail-type=FAIL,REQUEUE,INVALID_DEPEND,STAGE_OUT
#Name of the directory where you will do the calculation
directory_name=${SLURM_JOB_ID}_${SLURM_JOB_NAME}
directory=/tmp/job_${directory_name}
# Create working directory
mkdir ${directory}
# directories where datas are stored
DD=${SLURM_SUBMIT_DIR}
# copy files in the working directory
for i in *.gen *.hsd ; do
cp -rv ${i} ${directory}/.
done
#write that the calculation start
echo ${directory} ${SLURM_JOB_NODELIST}>> /home/users/${USER}/slurm.log.working
echo $SLURM_JOB_NODELIST >> ${DD}/mpd.hosts
cat >> /home/users/${USER}/slurm.log <<EOF
################################################################
$(date +'%A %d %B (%D) %Hh%M')
${SLURM_JOB_ID}
${SLURM_JOB_NAME}
${SLURM_SUBMIT_DIR}
${SLURM_JOB_NODELIST}
nodes=${SLURM_JOB_NUM_NODES}:ppn${SLURM_CPUS_ON_NODE}
${SLURM_NTASKS}
$(squeue -j ${SLURM_JOB_ID} -h --Format TimeLimit)
echo ${SLURM_JOB_PARTITION}
EOF
echo '======================'
echo '======================'
echo ''
echo "Starting at `date +"%D%t%A%t%T"`"
echo ''
echo '======================'
echo '======================'
echo ''
# go to working directory
cd ${directory}
# Def function of periodic copy
recopie-periodique ()
{
tjsPresent=`ls -l $TMPDIR | wc -l`
delai=10 # pour recopie des le demarrage du calcul
while [ $tjsPresent -gt 0 ]
do
sleep $delai
touch *
echo "Copie fichier : `date`"
cp -rv ${directory} ${DD}/working_save.tmp
tjsPresent=`ls -l $TMPDIR | wc -l`
delai=3000 # augmentation du delai pour limiter l'utilisation de la bande passante
done
}
# Def function of periodic top
top-periodique ()
{
tjsPresent=`ls -l $TMPDIR | wc -l`
delai=10 # pour recopie des le demarrage du calcul
while [ $tjsPresent -gt 0 ]
do
sleep $delai
touch *
echo "Copie fichier : `date`"
echo >> ${DD}/top_output.out
date +"%D%t%A%t%T" >> ${DD}/top_output.out
echo >> ${DD}/top_output.out
top -b -n 1 |head -n 50 >> ${DD}/top_output.out
tjsPresent=`ls -l $TMPDIR | wc -l`
delai=300 # augmentation du delai pour limiter l'utilisation de la bande passante
done
}
recopie-periodique &
top-periodique &
# Run the code
. /opt/intel/oneapi/setvars.sh
ulimit -s hard
export OMP_NUM_THREADS=${SLURM_NTASKS}
#export OMP_NUM_THREADS=64
/cluster_cti/bin/DFTB+/dftbplus-22.2/bin/dftb+ > output_dftb_${SLURM_JOB_NAME}_${SLURM_JOB_ID}.out
/home/users/atetenoire/bin/dftbplus-22.2.x86_64-linux/bin/modes > modes_dftb_${SLURM_JOB_NAME}_${SLURM_JOB_ID}.out
cd ${DD}
# Retrieve data
mv ${DD}/mpd.hosts ${directory}/.
mv ${directory} ${DD}/.
rm -r ${DD}/working_save.tmp
# Write that calculation ended
cat >> /home/users/${USER}/slurm.log.end <<EOF
################################################################
$(date +'%A %d %B (%D) %Hh%M')
${SLURM_JOB_ID}
${SLURM_JOB_NAME}
${SLURM_SUBMIT_DIR}
${SLURM_JOB_NODELIST}
nodes=${SLURM_JOB_NUM_NODES}:ppn${SLURM_CPUS_ON_NODE}
${SLURM_NTASKS}
$(squeue -j ${SLURM_JOB_ID} -h --Format TimeLimit)
echo ${SLURM_JOB_PARTITION}
EOF
sed -i "s/${directory} ${SLURM_JOB_NODELIST}//" /home/users/${USER}/slurm.log.working
echo '======================'
echo '======================'
echo ''
echo "Ending at `date +"%D%t%A%t%T"`"
echo ''
echo '======================'
echo '======================'
echo ''