-
Notifications
You must be signed in to change notification settings - Fork 1
/
lines.sh
executable file
·89 lines (75 loc) · 2.9 KB
/
lines.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
#!/bin/sh
#
# This script counts source lines of code (ignoring comments and
# blanks) for the different benchmark implementations.
set -e
sloc_accelerate() {
grep -E -x -v '\w*(--.*)?' -- "$@" | wc -l
}
sloc_apl() {
grep -E -x -v '\w*(⍝.*)?' -- "$@" | wc -l
}
sloc_dace() {
grep -E -x -v '\w*(#.*)?' -- "$@" | wc -l
}
sloc_futhark() {
grep -E -x -v '\w*(--.*)?' -- "$@" | wc -l
}
sloc_sac() {
grep -E -x -v '\w*(//.*)?' -- "$@" | wc -l
}
sloc_cpp() {
scc -f csv -i c,cpp,h,cl,cu "$@"|tail -n +2|cut -d, -f2|awk '{sum+=$1}END{print sum}'
}
printf "%15s baselines\n" ""
printf "%15s Acc APL DaCe--C/G Fut SAC CPU GPU\n" ""
printf "%15s %4d %4d %4d %4d %4d %4d %4d %5d\n" \
nbody \
$(sloc_accelerate nbody-naive/accelerate/nbody-naive/src/*.hs) \
$(sloc_apl nbody-naive/APL/nbody_naive_v4.apln) \
$(sloc_dace nbody-naive/dace/nbody_dace_cpu_impl.py) \
$(sloc_dace nbody-naive/dace/nbody_dace_gpu_impl.py) \
$(sloc_futhark nbody-naive/futhark/nbody.fut) \
$(sloc_sac nbody-naive/sac/src/nbody.sac) \
$(sloc_cpp nbody-naive/baseline-cpu) \
$(sloc_cpp nbody-naive/baseline-gpu)
printf "%15s %4d %4d %4d %4s %4d %4d %4d %5d\n" \
LocVolCalib \
$(sloc_accelerate LocVolCalib/accelerate/src/*.hs) \
$(sloc_apl LocVolCalib/APL/finpar.apln) \
$(sloc_dace LocVolCalib/dace/locvolcalib_dace.py) \
"same" \
$(sloc_futhark LocVolCalib/futhark/LocVolCalib.fut) \
$(sloc_sac LocVolCalib/sac/src/VolCalibGPU.sac) \
$(sloc_cpp LocVolCalib/baseline-FinPar/COpenMP) \
$(sloc_cpp LocVolCalib/baseline-FinPar/AllParOpenCLMP)
printf "%15s %4d %4d %4d %4s %4d %4d %4s %5d\n" \
MG \
$(sloc_accelerate MG/accelerate/src/*.hs) \
$(sloc_apl MG/APL/MG_k.apln) \
$(sloc_dace MG/dace/mg_dace.py) \
"same" \
$(sloc_futhark MG/futhark/mg.fut) \
$(sloc_sac MG/sac/src/*.sac) \
"---" \
$(sloc_cpp MG/baseline-NPB-GPU/MG)
printf "%15s %4d %4d %4s %4s %4d %4d %4d %5s\n" \
QuickHull \
$(sloc_accelerate quickhull/accelerate/src/*.hs) \
$(sloc_apl quickhull/APL/quickhull_k.apln) \
"---" \
"---" \
$(sloc_futhark quickhull/futhark/*.fut) \
$(sloc_sac quickhull/sac/src/*.sac) \
$(sloc_cpp quickhull/baseline/hull.cpp) \
"---"
printf "%15s %4d %4d %4d %4d %4d %4d %4d %5d\n" \
FlashAttention \
$(sloc_accelerate FlashAttention/accelerate/src/*.hs) \
$(sloc_apl FlashAttention/APL/flash_attention_k.apln) \
$(sloc_dace FlashAttention/dace/flash_attention_dace_cpu.py) \
$(sloc_dace FlashAttention/dace/flash_attention_dace_gpu.py) \
$(sloc_futhark FlashAttention/futhark/custom-alg1-opt.fut) \
$(sloc_sac FlashAttention/sac/src/*.sac) \
$(sloc_cpp FlashAttention/baseline-cpu) \
$(sloc_cpp FlashAttention/baseline-gpu)