-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·58 lines (52 loc) · 1.92 KB
/
build.sh
File metadata and controls
executable file
·58 lines (52 loc) · 1.92 KB
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
#!/usr/bin/env bash
set -e
flags="-Iinclude/ -fopenmp -Wall -Wextra -Werror \
-Wcast-align -Wshadow -Wpointer-arith \
-Wcast-qual -Wno-missing-braces -Wunreachable-code \
-Wfloat-equal -Wno-missing-field-initializers"
echo "##########################################################################"
echo "# BUILDING aCAT #"
echo "##########################################################################"
find ./src -name "*.c" -print0 | while read -d $'\0' file
do
output=$(echo $file | sed 's|^./src/|./build/|')
output="${output%.c}.o"
directory=$(dirname "$output")
mkdir -p $directory
run="mpicc -c $file -o $output $flags"
echo $run
eval $run
done
echo "##########################################################################"
echo "# BUILDING EXAMPLES #"
echo "##########################################################################"
objects=$(find ./build -name "*.o" -print0 | xargs -0)
examples=$(find ./examples -name "*.c" -print0 | xargs -0)
for arg in $examples; do
mkdir -p ./bin/examples
output=$(basename "$arg")
output="./bin/examples/${output%.c}"
run="mpicc $arg -o $output $flags $objects"
echo $run
eval $run
done
echo "##########################################################################"
echo "# RUNNING EXAMPLES #"
echo "##########################################################################"
tests=$(find ./bin/examples -type f -name "*" -print0 | xargs -0)
for arg in $tests; do
run="mpirun -np 1 ./$arg"
echo $run
eval $run
run="mpirun -np 4 ./$arg"
echo $run
eval $run
done
for arg in "$@"; do
mkdir -p ./bin
output=$(basename "$arg")
output="./bin/${output%.c}"
run="mpicc $arg -o $output $flags $objects"
echo $run
eval $run
done