-
Notifications
You must be signed in to change notification settings - Fork 1
/
BuildAllExamples.sh
executable file
·122 lines (100 loc) · 3.81 KB
/
BuildAllExamples.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
#!/bin/bash
exit_code=0
summary=""
directories=(
"Approximation/GaussianProcess_CO2"
"Approximation/MonotoneRegression"
"Modeling/FlowEquation/cpp"
"Modeling/UMBridge"
"Modeling/CustomModPiece/cpp"
"Modeling/MemoryTest/cpp"
"Modeling/WorkGraphs/cpp"
"SamplingAlgorithms/MC/Example1_Gaussian"
"SamplingAlgorithms/MCMC/BasicMetropolisInGibbs/cpp"
"SamplingAlgorithms/MCMC/CustomGaussianProposal/cpp"
"SamplingAlgorithms/MCMC/EllipticInference/cpp"
"SamplingAlgorithms/MCMC/MultilevelMCMC_FlowModel/cpp"
"SamplingAlgorithms/MCMC/Example1_Gaussian/cpp"
"SamplingAlgorithms/MCMC/Example2_GaussianInverseGamma/cpp"
"SamplingAlgorithms/MCMC/Example3_MultilevelGaussian/cpp"
"SamplingAlgorithms/MCMC/Example4_MultiindexGaussian/cpp"
"SamplingAlgorithms/MCMC/Example5_MALASampling"
"Utilities/HDF5/BlockOperations"
"Utilities/HDF5/SimpleReadWrite"
)
binaries=(
"Modeling/FlowEquation/cpp/build/FlowEquation"
"Modeling/CustomModPiece/cpp/build/BasicModPiece"
"Modeling/MemoryTest/cpp/build/MemoryUsage"
"Modeling/WorkGraphs/cpp/build/SimpleWorkGraph"
"Modeling/WorkGraphs/cpp/build/SplitSum"
"SamplingAlgorithms/MC/Example1_Gaussian/build/MonteCarlo"
"SamplingAlgorithms/MC/Example1_Gaussian/build/MultilevelMonteCarlo"
"SamplingAlgorithms/MCMC/BasicMetropolisInGibbs/cpp/build/MetropolisInGibbs"
"SamplingAlgorithms/MCMC/CustomGaussianProposal/cpp/build/CustomProposal"
"SamplingAlgorithms/MCMC/EllipticInference/cpp/build/InvariantSampling"
"SamplingAlgorithms/MCMC/Example1_Gaussian/cpp/build/GaussianSampling"
"SamplingAlgorithms/MCMC/Example2_GaussianInverseGamma/cpp/build/GaussianGammaSampling"
"SamplingAlgorithms/MCMC/Example3_MultilevelGaussian/cpp/build/BasicMultilevel"
"SamplingAlgorithms/MCMC/Example3_MultilevelGaussian/cpp/build/AdvancedMultilevel"
"SamplingAlgorithms/MCMC/Example4_MultiindexGaussian/cpp/build/MultiindexGaussianSampling"
"./SamplingAlgorithms/MCMC/Example5_MALASampling/build/malaSampling"
"Utilities/HDF5/BlockOperations/build/BlockOperations"
"Utilities/HDF5/SimpleReadWrite/build/SimpleReadWrite"
)
for dir in "${directories[@]}"
do
echo "======================"
echo "Building example in examples/$dir"
echo ""
mkdir -p examples/$dir/build
cmake -S examples/$dir -B examples/$dir/build -DMUQ_DIR=$PWD/build/install/lib/cmake/MUQ
cmake_exit=$?
if [ $cmake_exit -eq 0 ]
then
echo "CMake successful for example examples/$dir"
else
echo "CMake failed for example examples/$dir"
summary="$summary\nCMake FAILED for example examples/$dir"
fi
exit_code=$(($exit_code + $cmake_exit)) # Simply add exit codes; will be zero if all tests successful
make -C examples/$dir/build
make_exit=$?
if [ $make_exit -eq 0 ]
then
echo "Make successful for example examples/$dir"
summary="$summary\nBuild successful for example examples/$dir"
else
echo "Make failed for example examples/$dir"
summary="$summary\nMake FAILED for example examples/$dir"
fi
exit_code=$(($exit_code + $make_exit)) # Simply add exit codes; will be zero if all tests successful
done
echo "======================"
for bin in "${binaries[@]}"
do
echo "======================"
echo "Running example $bin"
echo ""
examples/$bin
run_exit=$?
if [ $run_exit -eq 0 ]
then
echo "Run successful for example $bin"
summary="$summary\nRun successful for example $bin"
else
echo "Run failed for example $bin"
summary="$summary\nRun FAILED for example $bin"
fi
exit_code=$(($exit_code + $run_exit)) # Simply add exit codes; will be zero if all tests successful
done
echo "======================"
echo -e $summary
echo ""
if [ $exit_code -eq 0 ]
then
echo "All examples successful."
else
echo "Some examples FAILED!"
fi
exit $exit_code