-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpixi.toml
More file actions
261 lines (238 loc) · 9.13 KB
/
pixi.toml
File metadata and controls
261 lines (238 loc) · 9.13 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
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
[workspace]
authors = ["Seth Stadick <seth_stadick@bio-rad.com>"]
channels = [
#"https://conda.modular.com/max-nightly",
"https://prefix.dev/conda-forge",
"https://conda.modular.com/max",
"https://repo.prefix.dev/modular-community",
]
platforms = ["osx-arm64", "linux-64", "linux-aarch64"]
preview = ["pixi-build"]
[package]
name = "ish"
version = "1.4.0"
license = "Apache-2.0"
[package.build]
backend = { name = "pixi-build-mojo", version = "0.*" }
channels = [
"https://prefix.dev/pixi-build-backends",
"https://prefix.dev/conda-forge",
]
[package.host-dependencies]
mojo-compiler = "=0.25.6"
[package.build-dependencies]
extramojo = "=0.18.0"
mojo-compiler = "=0.25.6"
zlib = ">=1.3.1,<2"
[package.run-dependencies]
mojo-compiler = "=0.25.6"
zlib = ">=1.3.1,<2"
[tasks]
build = "mojo build -D ISH_LOG_LEVEL=info --march native -o ish main.mojo"
build_generic = "mojo build -D ISH_SIMD_TARGET=baseline -D ISH_LOG_LEVEL=info -o ish main.mojo"
debug = "mojo build -D ISH_LOG_LEVEL=debug --debug-level line-tables --march native -o ish main.mojo"
pkglib = "mojo package ./ishlib"
testlib = "mojo test tests -I . --co && pixi run mojo test tests -I ."
# Bench the gpu fun in ish using Bench
build-bench-gpu = "mojo build -D ISH_LOG_LEVEL=timing --march native -I . -o bench-gpu ./benchmarking/ish_bench_aligner_gpu_only.mojo"
# Bench any algorithm using internal timings
build-bench = "mojo build -D SIMD_MOD='none' --march native -I . -o ish-aligner ./benchmarking/ish_bench_aligner.mojo"
build-bench-128 = "mojo build -D SIMD_MOD='sse' --march native -I . -o ish-aligner-128 ./benchmarking/ish_bench_aligner.mojo"
build-bench-256 = "mojo build -D SIMD_MOD='avx2' --march native -I . -o ish-aligner-256 ./benchmarking/ish_bench_aligner.mojo"
build-bench-512 = "mojo build -D SIMD_MOD='avx512' --march native -I . -o ish-aligner-512 ./benchmarking/ish_bench_aligner.mojo"
build-bench-gpu-all = "mojo build -D ISH_LOG_LEVEL=timing -D SIMD_MOD='none' --march native -I . -o ish-aligner-gpu ./benchmarking/ish_bench_aligner_gpu.mojo"
# Below here all all tasks for running benchmarks
[tasks.get-bench-data]
cmd = """
mkdir -p bench/data &&
cd bench/data &&
git clone https://github.com/jeffdaily/parasail &&
mkdir refdata &&
cd refdata &&
curl https://ftp.uniprot.org/pub/databases/uniprot/previous_releases/release-2015_11/knowledgebase/uniprot_sprot-only2015_11.tar.gz --output uniprot_sprot-only2015_11.tar.gz && tar -xvzf uniprot_sprot-only2015_11.tar.gz &&
gunzip uniprot_sprot.fasta.gz &&
awk 'BEGIN {RS=">"} NR > 1 && NR < 12 { printf ">%s", $0 }' uniprot_sprot.fasta > uniprot_sprot.small.fasta &&
cat uniprot_sprot.fasta uniprot_sprot.fasta uniprot_sprot.fasta uniprot_sprot.fasta uniprot_sprot.fasta > uniprot_sprot_5x.fasta &&
cat uniprot_sprot_5x.fasta uniprot_sprot_5x.fasta > uniprot_sprot_10x.fasta
"""
outputs = ["bench/data/**/*.fasta"]
[tasks.compile-parasail]
depends-on = ["get-bench-data"]
cmd = """
cd bench/data/parasail &&
autoreconf -fi &&
./configure &&
make -j $(nproc)
"""
outputs = ["bench/data/parasail/apps/parasail_aligner"]
[tasks.run-bench-sw]
depends-on = [
"compile-parasail",
"build-bench-128",
"build-bench-256",
"build-bench-512",
]
cmd = """
bash -c '
mkdir -p bench_results/sw/plots &&
ARCH=$(uname -m) &&
ARCH_INFO="${ARCH_INFO:-$ARCH: $(lscpu | grep \"Model name\" | cut -d: -f2 | xargs || echo \"Unknown CPU\")}" &&
if [[ "$ARCH" == "x86_64" ]]; then
PARASAIL_INSTS="sse41_128 avx2_256"
ISH_BINS="$(readlink -f ish-aligner-128) $(readlink -f ish-aligner-256) $(readlink -f ish-aligner-512)"
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
PARASAIL_INSTS="neon_128"
ISH_BINS="$(readlink -f ish-aligner-128)"
else
echo "Unsupported architecture: $ARCH" >&2
exit 1
fi &&
python benchmarking/bench_scripts/bench.py \
--ish-binaries $ISH_BINS \
--ish-algorithm striped-local \
--parasail-aligner-binary $(readlink -f ./bench/data/parasail/apps/parasail_aligner) \
--parasail-algorithm sw \
--score-size adaptive \
--query-seqs-base-dir ./bench/data/parasail/data/ \
--ref-data bench/data/refdata/uniprot_sprot.fasta \
--parasail-instruction-set $PARASAIL_INSTS \
--output-dir ./bench_results/sw/ \
> ./bench_results/sw/benchmark_results.csv &&
python benchmarking/bench_scripts/plot.py \
./bench_results/sw/benchmark_results.csv \
"$ARCH_INFO" \
./bench_results/sw
'
"""
outputs = [
"./bench_results/sw/*.csv",
"./bench_results/sw/benchmark_results.csv",
]
[tasks.run-bench-sg]
depends-on = [
"compile-parasail",
"build-bench-128",
"build-bench-256",
"build-bench-512",
]
cmd = """
bash -c '
mkdir -p bench_results/sg/plots &&
ARCH=$(uname -m) &&
ARCH_INFO="${ARCH_INFO:-$ARCH: $(lscpu | grep \"Model name\" | cut -d: -f2 | xargs || echo \"Unknown CPU\")}" &&
if [[ "$ARCH" == "x86_64" ]]; then
PARASAIL_INSTS="sse41_128 avx2_256"
ISH_BINS="$(readlink -f ish-aligner-128) $(readlink -f ish-aligner-256) $(readlink -f ish-aligner-512)"
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
PARASAIL_INSTS="neon_128"
ISH_BINS="$(readlink -f ish-aligner-128)"
else
echo "Unsupported architecture: $ARCH" >&2
exit 1
fi &&
python benchmarking/bench_scripts/bench.py \
--ish-binaries $ISH_BINS \
--ish-algorithm striped-semi-global \
--parasail-aligner-binary $(readlink -f ./bench/data/parasail/apps/parasail_aligner) \
--parasail-algorithm sg \
--score-size word \
--query-seqs-base-dir ./bench/data/parasail/data/ \
--ref-data bench/data/refdata/uniprot_sprot.fasta \
--parasail-instruction-set $PARASAIL_INSTS \
--output-dir ./bench_results/sg/ \
> ./bench_results/sg/benchmark_results.csv &&
python benchmarking/bench_scripts/plot.py \
./bench_results/sg/benchmark_results.csv \
"$ARCH_INFO" \
./bench_results/sg
'
"""
outputs = [
"./bench_results/sg/*.csv",
"./bench_results/sg/benchmark_results.csv",
]
[tasks.run-bench-gpu]
depends-on = ["get-bench-data", "build-bench-gpu-all"]
cmd = """
bash -c '
mkdir -p bench_results/gpu/plots &&
if command -v nvidia-smi &> /dev/null; then
GPU_INFO=$(nvidia-smi --query-gpu=name --format=csv,noheader | head -n1 | sed "s/NVIDIA //;s/GeForce //;s/-.*//" | xargs)
elif command -v rocm-smi &> /dev/null; then
GPU_INFO=$(rocm-smi --showproductname | grep "GPU" | head -n1 | awk "{print $NF}" | sed "s/AMD //;s/Radeon //" | xargs)
elif command -v lspci &> /dev/null; then
GPU_INFO=$(lspci | grep -ioE "(NVIDIA|Radeon|GeForce|RTX|GTX|Quadro|Tesla|RX)[^[]*" | head -n1 | sed "s/NVIDIA //;s/GeForce //;s/Radeon //;s/Corporation //" | xargs)
else
echo "No suported GPU Found" && exit 1
fi &&
python benchmarking/bench_scripts/bench.py \
--ish-binaries $(readlink -f ./ish-aligner-gpu) \
--ish-algorithm basic-semi-global-gpu-parallel \
--score-size word \
--query-seqs-base-dir ./bench/data/parasail/data/ \
--ref-data bench/data/refdata/uniprot_sprot_5x.fasta \
--devices 4 \
--iterations 1 \
--output-dir ./bench_results/gpu/ \
> ./bench_results/gpu/benchmark_results.csv &&
python benchmarking/bench_scripts/plot.py \
--is-gpu \
./bench_results/gpu/benchmark_results.csv \
"$GPU_INFO" \
./bench_results/gpu
'
"""
outputs = [
"./bench_results/sg/*.csv",
"./bench_results/sg/benchmark_results.csv",
]
[tasks.get-chm13v2]
args = [{ arg = "download_location", default = "./bench/refdata/" }]
cmd = """
bash -c '
DOWNLOAD_LOC="{{ download_location }}"
mkdir -p $DOWNLOAD_LOC &&
curl -L https://s3-us-west-2.amazonaws.com/human-pangenomics/T2T/CHM13/assemblies/analysis_set/chm13v2.0.fa.gz | gunzip > $DOWNLOAD_LOC/chm13v2.0.fa
'
"""
[tasks.run-whole-genome-search]
depends-on = [
"build",
{ task = "get-chm13v2", args = [
"{{download_location}}",
] },
]
args = [{ arg = "download_location", default = "./bench/refdata/" }]
cmd = """
bash -c '
mkdir -p ./bench_results/whole_genome/
DOWNLOAD_LOC="{{ download_location }}"
SIZE=$(stat -c%s $DOWNLOAD_LOC/chm13v2.0.fa) &&
echo "Searching through CHM13 reference ($SIZE bytes)..." &&
START=$(date +%s.%N) &&
./ish --scoring-matrix actgn --record-type fastx --threads 16 ACCTTTTGGTTATATCATTCTTACATAAAGGACACTGTGAAGGCCCTTTCTTCTGGTTGAGA $DOWNLOAD_LOC/chm13v2.0.fa > /dev/null &&
END=$(date +%s.%N) &&
ELAPSED=$(echo "$END - $START" | bc) &&
BYTES_PER_SEC=$(echo "scale=2; $SIZE / $ELAPSED" | bc) &&
MB_PER_SEC=$(echo "scale=2; $BYTES_PER_SEC / 1048576" | bc) &&
echo "Search complete: $SIZE bytes in $ELAPSED seconds" &&
echo "Speed: $BYTES_PER_SEC bytes/sec ($MB_PER_SEC MB/sec)" > ./bench_results/whole_genome/speed.txt
'
"""
outputs = ["./bench_results/whole_genome/speed.txt"]
[tasks.bench-all-cpu]
depends-on = ["run-bench-sw", "run-bench-sg", "run-whole-genome-search"]
[tasks.bench-all-gpu]
depends-on = ["run-bench-gpu"]
[tasks.clean-benchmarks]
cmd = """
rm -rf ./bench_results
"""
[dependencies]
mojo = "=0.25.6"
# extramojo = { git = "https://github.com/ExtraMojo/ExtraMojo.git" }
extramojo = "=0.18.0"
defopt = ">=7.0.0,<8"
pandas = ">=2.3.3,<3"
matplotlib = ">=3.10.7,<4"
numpy = ">=2.3.4,<3"