-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunvpic.sh
111 lines (101 loc) · 2.93 KB
/
runvpic.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
#/bin/bash
# this function pulls information from a config file to do a run
function run_config {
# Pull information from the config file
file=$1
FLAG=0
file_list=()
script_list=()
while IFS= read -r line
do
if [ "$line" == "# End" ]; then
break
fi
if [ "$line" == "# Folder Name" ]; then
FLAG=1
continue
fi
if [ "$line" == "# Deck" ]; then
FLAG=2
continue
fi
if [ "$line" == "# Files" ]; then
FLAG=3
continue
fi
if [ "$line" == "# Scripts" ]; then
FLAG=4
continue
fi
if [ $FLAG == 1 ]; then
folder_name="$line"
continue
fi
if [ $FLAG == 2 ]; then
deck_name="$line"
continue
fi
if [ $FLAG == 3 ]; then
file_list+=("$line")
continue
fi
if [ $FLAG == 4 ]; then
script_list+=("$line")
fi
done <"$file"
# Create Folder
mkdir -p /home/docker/$folder_name
# Copy Files
for i in "${file_list[@]}"; do
cp $i /home/docker/$folder_name
done
# Copy Scripts
for i in "${script_list[@]}"; do
cp $i /home/docker/$folder_name
done
# Configure insitu.py and move it
rm insitu.py
touch insitu.py
for i in "${script_list[@]}"; do
filename="${i##*/}"
scriptname="${filename%.*}"
printf "import $scriptname\n" >> insitu.py
done
printf "def RequestDataDescription(datadescription):\n" >> insitu.py
for i in "${script_list[@]}"; do
filename="${i##*/}"
scriptname="${filename%.*}"
printf "\t$scriptname.RequestDataDescription(datadescription)\n" >> insitu.py
done
printf "def DoCoProcessing(datadescription):\n" >> insitu.py
for i in "${script_list[@]}"; do
filename="${i##*/}"
scriptname="${filename%.*}"
printf "\t$scriptname.DoCoProcessing(datadescription)\n" >> insitu.py
done
mv insitu.py /home/docker/$folder_name
# Compile deck and configure libraries
export CPLUS_INCLUDE_PATH=/home/docker/vpic/src/util/catalyst/
export LD_LIBRARY_PATH=/home/docker/paraview_build/lib/
cd /home/docker/$folder_name
../vpic.bin/bin/vpic $deck_name
# Get executable name
#temp="${deck_name##*/}"
#executable="${temp%.*}.Linux"
# Run it
#LD_LIBRARY_PATH=/home/docker/paraview_build/lib
#mpirun --allow-run-as-root --mca btl_tcp_if_include eth0 --hostfile /home/docker/hostfile /home/docker/$folder_name/$executable
#/home/docker/$folder_name/$executable
}
# Build VPIC
cd /home/docker/vpic.bin
#cmake \
# -DUSE_CATALYST=ON \
# -DCMAKE_BUILD_TYPE=Release \
# /home/docker/vpic
#make -j16
# PUT RUNS BELOW
# Run 1 using vpic_config
run_config "/home/docker/vpic_config"
# Run 2 using vpic_config2
run_config "/home/docker/vpic_config2"