-
Notifications
You must be signed in to change notification settings - Fork 0
/
hpcbmtenvcreate-v1.sh
365 lines (352 loc) · 22.9 KB
/
hpcbmtenvcreate-v1.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
#!/bin/bash
#サブスクリプションが複数ある場合は指定しておく
#az account set -s <Subscription ID or name>
MyResourceGroup=cfdbmt01
Location=japaneast
VMPREFIX=cfdbmt01
VMSIZE=Standard_HB120rs_v2 #Standard_HC44rs, Standard_HB120rs_v3
MyAvailabilitySet=${VMPREFIX}avset01
MyNetwork=${VMPREFIX}-vnet01
MySubNetwork=compute
MyNetworkSecurityGroup=${VMPREFIX}-nsg
# MyNic="cfdbmt-nic"
IMAGE="OpenLogic:CentOS-HPC:7_8:latest"
USERNAME=azureuser
# SSH公開鍵ファイルを指定
SSHKEYFILE="./${VMPREFIX}.pub"
TAG=${VMPREFIX}=$(date "+%Y%m%d")
MAXVM=10
# 追加の永続ディスクが必要な場合、ディスクサイズ(GB)を記入する https://azure.microsoft.com/en-us/pricing/details/managed-disks/
PERMANENTDISK=0
# 必要なパッケージ。Ubuntuの場合、以下のパッケージが必要
#sudo apt install -y parallel jq
### コマンド名取得
CMDNAME=`basename $0`
### コマンドオプションエラー処理
if [ $# -ne 1 ]; then
echo "実行するには1個の引数が必要です。" 1>&2
echo "create,delete,start,stop,list,remount 引数を一つ指定する必要があります。" 1>&2
exit 1
fi
### SSH鍵チェック。なければ作成
if [ ! -f "./${VMPREFIX}" ] || [ ! -f "./${VMPREFIX}.pub" ] ; then
ssh-keygen -f ./${VMPREFIX} -m pem -t rsa -N "" -b 4096
fi
### ログイン処理
#az login --service-principal --username ${azure_name} --password ${azure_password} --tenant ${azure_tenant} --output none
case $1 in
create )
### 全体環境作成
az group create --resource-group $MyResourceGroup --location $Location --tags $TAG --output none
# ネットワークチェック
tmpnetwork=$(az network vnet show -g $MyResourceGroup --name $MyNetwork --query id)
echo "current netowrk id: $tmpnetwork"
if [ -z "$tmpnetwork" ] ; then
az network vnet create -g $MyResourceGroup -n $MyNetwork --address-prefix 10.0.0.0/22 --subnet-name $MySubNetwork --subnet-prefix 10.0.0.0/24 --output none
fi
az network nsg create --name $MyNetworkSecurityGroup -g $MyResourceGroup -l $Location --tags $TAG --output none
az network nsg rule create --name ssh --nsg-name $MyNetworkSecurityGroup -g $MyResourceGroup --access allow --protocol Tcp --direction Inbound \
--priority 1000 --source-address-prefix Internet --source-port-range "*" --destination-address-prefix "*" --destination-port-range 22 --output none
az vm availability-set create --name $MyAvailabilitySet -g $MyResourceGroup -l $Location --tags $TAG --output none
numvm=0
if [ -f ./vmlist ]; then
rm ./vmlist
fi
for count in `seq 1 $MAXVM` ; do
# echo "creating nic # $count"
# az network nic create --accelerated-networking true --name $MyNic-$count --resource-group $MyResourceGroup --vnet-name $MyNetwork --subnet $MySubNetwork --network-security>
echo "creating VM # $count"
az vm create \
--resource-group $MyResourceGroup --location $Location \
--name ${VMPREFIX}-${count} \
--size $VMSIZE --availability-set $MyAvailabilitySet \
--vnet-name $MyNetwork --subnet $MySubNetwork \
--nsg $MyNetworkSecurityGroup --nsg-rule SSH \
--image $IMAGE \
--admin-username $USERNAME --ssh-key-values $SSHKEYFILE \
--no-wait --tags $TAG &
done
while [ $((numvm)) -lt $((MAXVM)) ]; do
echo "sleep 30" && sleep 30
az vm list -g $MyResourceGroup | jq '.[] | .name' | grep ${VMPREFIX} > ./vmlist
numvm=$(cat ./vmlist | wc -l)
done
echo "careated VM list" && echo "$(cat ./vmlist)"
if [ -f ./ipaddresslist ]; then
rm ./ipaddresslist
fi
for count in $(seq 1 $MAXVM) ; do
echo "VM $count: ${VMPREFIX}-$count"
unset ipaddresstmp
while [ -z $ipaddresstmp ]; do
ipaddresstmp=$(az vm show -d -g $MyResourceGroup --name ${VMPREFIX}-${count} --query publicIps -o tsv)
echo "ip: $ipaddresstmp"
done
echo $ipaddresstmp >> ipaddresslist
done
cat ./ipaddresslist
# 永続ディスクが必要な場合に設定可能
if [ $((PERMANENTDISK)) -gt 0 ]; then
az vm disk attach --new -g $MyResourceGroup --size-gb $PERMANENTDISK --sku Premium_LRS --vm-name ${VMPREFIX}-1 --name ${VMPREFIX}-1-disk0
fi
echo "setting up nfs server"
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-1 --command-id RunShellScript \
--scripts "sudo yum install -y nfs-utils && echo '/mnt/resource *(rw,no_root_squash,async)' >> /etc/exports"
sleep 5
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-1 --command-id RunShellScript \
--scripts "sudo chown ${USERNAME}:${USERNAME} /mnt/resource"
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-1 --command-id RunShellScript \
--scripts "sudo systemctl start rpcbind && sudo systemctl start nfs"
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-1 --command-id RunShellScript \
--scripts "sudo systemctl enable rpcbind && sudo systemctl enable nfs"
echo "setting up nfs client"
mountip=$(az vm show -g $MyResourceGroup --name ${VMPREFIX}-1 -d --query privateIps -otsv)
seq 1 $MAXVM | parallel "az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-{} --command-id RunShellScript --scripts 'sudo yum install -y nfs-utils'"
sleep 5
count=0
for count in $(seq 2 $MAXVM) ; do
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-${count} --command-id RunShellScript --scripts "sudo mount -v -t nfs ${mountip}:/mnt/resource /mnt/resource" &
done
sleep 15
echo "configuring fstab"
for count in $(seq 2 $MAXVM) ; do
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-${count} --command-id RunShellScript \
--scripts "echo '/dev/sdb1 /mnt/resource xfs defaults 0 2' | sudo tee /etc/fstab"
done
# seq 2 $MAXVM | parallel -a ipaddresslist "ssh -t -t -i ./${VMPREFIX} $USERNAME@{} "echo '/dev/sdb1 /mnt/resource xfs defaults 0 2' | sudo tee /etc/fstab""
# SSHパスワードレスセッティング
echo "confugring passwordless settings"
tmpfile=$(stat ./${VMPREFIX} -c '%a')
cat ./ipaddresslist
# SSH追加設定
cat <<'EOL' >> config
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
EOL
case $tmpfile in
600 )
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./${VMPREFIX} $USERNAME@{}:/home/$USERNAME/.ssh/${VMPREFIX}"
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./${VMPREFIX} $USERNAME@{}:/home/$USERNAME/.ssh/id_rsa"
seq 1 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t $USERNAME@{} "chmod 600 /home/$USERNAME/.ssh/id_rsa""
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./${VMPREFIX}.pub $USERNAME@{}:/home/$USERNAME/.ssh/${VMPREFIX}.pub"
# SSH追加設定
for count in `seq 1 $MAXVM` ; do
line=$(sed -n ${count}P ./ipaddresslist)
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./config $USERNAME@${line}:/home/$USERNAME/.ssh/config
ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${line} "chmod 600 /home/$USERNAME/.ssh/config"
done
;;
7** )
# 何らかの事情でファイルパーミッションが設定できていない場合、~/.ssh/ディレクトリを利用する
cp ./${VMPREFIX} ~/.ssh/
chmod 600 ~/.ssh/${VMPREFIX}
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} ./${VMPREFIX} $USERNAME@{}:/home/$USERNAME/.ssh/${VMPREFIX}"
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} ./${VMPREFIX} $USERNAME@{}:/home/$USERNAME/.ssh/id_rsa"
seq 1 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t $USERNAME@{} "chmod 600 /home/$USERNAME/.ssh/id_rsa""
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} ./${VMPREFIX}.pub $USERNAME@{}:/home/$USERNAME/.ssh/${VMPREFIX}.pub"
# SSH追加設定
for count in `seq 1 $MAXVM` ; do
line=$(sed -n ${count}P ./ipaddresslist)
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./config $USERNAME@${line}:/home/$USERNAME/.ssh/config
ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${line} "chmod 600 /home/$USERNAME/.ssh/config"
done
;;
esac
;;
start )
echo "starting VM ${VMPREFIX}-1"
az vm start -g $MyResourceGroup --name ${VMPREFIX}-1 --output none
echo "starting VM ${VMPREFIX}:2-$MAXVM compute nodes"
seq 2 $MAXVM | parallel "az vm start -g $MyResourceGroup --name ${VMPREFIX}-{} --output none"
echo "checking VM status"
numvm=0
while [ $((numvm)) -lt $((MAXVM)) ]; do
tmpnumvm=$(az vm list -d --query "[?powerState=='VM running']" -o tsv)
echo $tmpnumvm | tr ' ' '\n' > ./tmpnumvm.txt
numvm=$(grep -c "running" ./tmpnumvm.txt)
echo "current running VMs: $numvm"
sleep 5
done
echo "nfs server @ ${VMPREFIX}-1"
ipaddresstmp=$(az vm show -d -g $MyResourceGroup --name ${VMPREFIX}-1 --query publicIps -o tsv)
#|\\|\\\|\\\|\\\|\\\|\\\vm1ip=$(head -1 ./ipaddresslist)
echo "${VMPREFIX}-1's IP: $ipaddresstmp"
mountip=$(az vm show -g $MyResourceGroup --name ${VMPREFIX}-1 -d --query privateIps -otsv)
cat ./ipaddresslist
tmpfile=$(stat ./${VMPREFIX} -c '%a')
case $tmpfile in
600 )
echo "600:${VMPREFIX}-1: $vm1ip"
ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${ipaddresstmp} 'showmount -e'
echo "600:mounting: ${VMPREFIX}: 2-$MAXVM"
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "sudo mkdir -p /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "sudo chown $USERNAME:$USERNAME /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "sudo mount -t nfs ${mountip}:/mnt/resource /mnt/resource""
;;
7** )
# 何らかの事情でファイルパーミッションが設定できていない場合、~/.ssh/ディレクトリを利用する
cp ./${VMPREFIX} ~/.ssh/
chmod 600 ~/.ssh/${VMPREFIX}
echo "700:${VMPREFIX}-1: $vm1ip"
ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} $USERNAME@${ipaddresstmp} 'showmount -e'
echo "700:mounting: ${VMPREFIX}: 2-$MAXVM"
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t -t $USERNAME@{} "sudo mkdir -p /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t -t $USERNAME@{} "sudo chown $USERNAME:$USERNAME /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t -t $USERNAME@{} "sudo mount -t nfs ${mountip}:/mnt/resource /mnt/resource""
####for count in $(seq 2 $MAXVM) ; do
#### az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-${count} --command-id RunShellScript --scripts "mount -v -t nfs ${mountip}:/mnt/resource /mnt/resource"
#### done
#### rm ./tmpnumvm.txt
;;
esac
;;
stop )
for count in $(seq 1 $MAXVM) ; do
echo "stoping VM $count"
az vm stop -g $MyResourceGroup --name ${VMPREFIX}-${count} &
done
;;
list )
echo "listng running(/stop) VM"
az vm list -g $MyResourceGroup -d -o table
;;
delete )
if [ -f ./tmposdiskidlist ]; then
rm ./tmposdiskidlist
fi
for count in $(seq 1 $MAXVM) ; do
disktmp=$(az vm show -g $MyResourceGroup --name ${VMPREFIX}-${count} --query storageProfile.osDisk.managedDisk.id -o tsv)
echo $disktmp >> tmposdiskidlist
done
echo "deleting VM"
seq 1 $MAXVM | parallel "az vm delete -g $MyResourceGroup --name ${VMPREFIX}-{} --yes &"
rm ./ipaddresslist
numvm=$(cat ./vmlist | wc -l)
while [ $((numvm)) -gt 0 ]; do
echo "sleep 30" && sleep 30
echo "current running VMs: $numvm"
az vm list -g $MyResourceGroup | jq '.[] | .name' | grep ${VMPREFIX} > ./vmlist
numvm=$(cat ./vmlist | wc -l)
done
rm ./vmlist
echo "deleting disk"
parallel -a tmposdiskidlist "az disk delete --ids {} --yes"
sleep 10 && rm ./tmposdiskidlist
echo "deleting nic"
seq 1 $MAXVM | parallel "az network nic delete -g $MyResourceGroup --name ${VMPREFIX}-{}VMNic"
echo "deleting public ip"
seq 1 $MAXVM | parallel "az network public-ip delete -g $MyResourceGroup --name ${VMPREFIX}-{}PublicIP"
echo "detele data disk"
az disk delete -g $MyResourceGroup --name ${VMPREFIX}-1-disk0 --yes
echo "current running VMs: ${numvm}"
;;
remount )
echo "current mounting status"
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "df | grep '/mnt/resource'""
# mounting nfs server from compute node.
numvm=$(cat ./ipaddresslist | wc -l)
if [ -f ./ipaddresslist ]; then
ipaddresstmp=$(az vm show -d -g $MyResourceGroup --name ${VMPREFIX}-1 --query publicIps -o tsv)
# |\\\|\\\|\\\vm1ip=$(head -1 ./ipaddresslist)
echo "${VMPREFIX}-1's IP: $ipaddresstmp"
mountip=$(az vm show -g $MyResourceGroup --name ${VMPREFIX}-1 -d --query privateIps -otsv)
tmpfile=$(stat ./${VMPREFIX} -c '%a')
case $tmpfile in
600 )
echo "600:${VMPREFIX}-1: $vm1ip"
ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${ipaddresstmp} 'showmount -e'
echo "600:mounting: ${VMPREFIX}: 2-$MAXVM"
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "sudo mkdir -p /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "sudo chown $USERNAME:$USERNAME /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} -t -t $USERNAME@{} "sudo mount -t nfs ${mountip}:/mnt/resource /mnt/resource""
;;
7** )
echo "700:${VMPREFIX}-1: $vm1ip"
ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} $USERNAME@${ipaddresstmp} 'showmount -e'
echo "700:mounting: ${VMPREFIX}: 2-$MAXVM"
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t -t $USERNAME@{} "sudo mkdir -p /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t -t $USERNAME@{} "sudo chown $USERNAME:$USERNAME /mnt/resource""
seq 2 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${VMPREFIX} -t -t $USERNAME@{} "sudo mount -t nfs ${mountip}:/mnt/resource /mnt/resource""
;;
esac
else
for count in $(seq 2 $MAXVM) ; do
az vm run-command invoke -g $MyResourceGroup --name ${VMPREFIX}-${count} --command-id RunShellScript --scripts "mount -t nfs ${mountip}:/mnt/resource /mnt/resource" &
done
fi
;;
pingpong )
if [ -f ./nodelist ]; then
rm ./nodelist
fi
for count in $(seq 1 $MAXVM) ; do
nodelist=$(az vm show -g $MyResourceGroup --name ${VMPREFIX}-${count} -d --query privateIps -otsv)
echo $nodelist >> nodelist
done
if [ -f ./pingponglist ]; then
rm ./pingponglist
fi
for NODE in `cat ./nodelist`; do
for NODE2 in `cat ./nodelist`; do
echo "$NODE,$NODE2" >> pingponglist
done
done
# fullpingpongコマンド作成
rm ./fullpingpong.sh
# fullpingpong.sh作成
cat <<'EOL' >> fullpingpong.sh
#!/bin/bash
IMPI_VERSION=2018.4.274
cp /home/$USER/* /mnt/resource/
cd /mnt/resource/
count=1
max=$(cat ./pingponglist | wc -l)
echo max: $max
# run pingpong
case $IMPI_VERSION in
2018* )
for count in `seq 1 $max`; do
line=$(sed -n ${count}P ./pingponglist)
echo "############### ${line} ###############" >> result
/opt/intel/impi/${IMPI_VERSION}/intel64/bin/mpirun -hosts $line -ppn 1 -n 2 -env I_MPI_FABRICS=shm:ofa /opt/intel/impi/${IMPI_VERSION}/bin64/IMB-MPI1 pingpong >> result
done
;;
esac
# ヒアドキュメントのルール上改行不可
EOL
cat <<'EOL' >> config
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
EOL
# fullpingpon実行
echo "pingponglist: $pingponglist"
vm1ip=$(head -1 ./ipaddresslist)
impidir=$(ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${vm1ip} "ls /opt/intel/impi/")
cat ./pingponglist
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./fullpingpong.sh azureuser@$vm1ip:/home/azureuser/
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./pingponglist azureuser@$vm1ip:/home/azureuser/
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./fullpingpong.sh azureuser@$vm1ip:/mnt/resource/
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./pingponglist azureuser@$vm1ip:/mnt/resource/
# SSH追加設定
tmpfile=$(stat ./${VMPREFIX} -c '%a')
cat ./ipaddresslist
case $tmpfile in
600 )
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./config $USERNAME@{}:/home/$USERNAME/.ssh/config"
seq 1 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@{} "chmod 600 /home/$USERNAME/.ssh/config""
;;
7** )
seq 1 $MAXVM | parallel -v -a ipaddresslist "scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} ./config $USERNAME/@{}:/home/$USERNAME/.ssh/config"
seq 1 $MAXVM | parallel -v -a ipaddresslist "ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@{} "chmod 600 /home/$USERNAME/.ssh/config""
;;
esac
# コマンド実行
ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${vm1ip} "rm /mnt/resource/result"
ssh -o StrictHostKeyChecking=no -i ./${VMPREFIX} $USERNAME@${vm1ip} "bash /mnt/resource/fullpingpong.sh > /mnt/resource/result"
sleep 60
scp -o StrictHostKeyChecking=no -i ./${VMPREFIX} azureuser@$vm1ip:/mnt/resource/result ./
;;
esac
echo "end of vm hpc environment create script"