-
Notifications
You must be signed in to change notification settings - Fork 136
/
Makefile
79 lines (56 loc) · 2.03 KB
/
Makefile
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
.PHONY: test clippy docker-shell nix-shell benchmarks benchmark docs build-cuda build-metal clippy-metal test-metal coverage clean
FUZZ_DIR = fuzz/no_gpu_fuzz
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
test:
cargo test
clippy:
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy --workspace --all-targets --features wasm -- -D warnings
cargo clippy --workspace --all-targets --features parallel -- -D warnings
cargo clippy --tests
clippy-cuda:
cargo clippy --workspace -F cuda -- -D warnings
docker-shell:
docker build -t rust-curves .
docker run -it rust-curves bash
nix-shell:
nix-shell
benchmarks:
cargo criterion --workspace
# BENCHMARK should be one of the [[bench]] names in Cargo.toml
benchmark:
cargo criterion --bench ${BENCH}
flamegraph_stark:
CARGO_PROFILE_BENCH_DEBUG=true cargo flamegraph --root --bench stark_benchmarks -- --bench
coverage:
cargo llvm-cov nextest --lcov --output-path lcov.info
METAL_DIR = math/src/gpu/metal
build-metal:
xcrun -sdk macosx metal $(METAL_DIR)/all.metal -o $(METAL_DIR)/lib.metallib
clippy-metal:
cargo clippy --workspace --all-targets -F metal -- -D warnings
test-metal:
cargo test -F metal
CUDA_DIR = math/src/gpu/cuda/shaders
CUDA_FILES:=$(wildcard $(CUDA_DIR)/**/*.cu)
CUDA_COMPILED:=$(patsubst $(CUDA_DIR)/%.cu, $(CUDA_DIR)/%.ptx, $(CUDA_FILES))
CUDA_HEADERS:=$(wildcard $(CUDA_DIR)/**/*.cuh)
$(CUDA_DIR)/%.ptx: $(CUDA_DIR)/%.cu $(CUDA_HEADERS)
nvcc -ptx $< -o $@
# This part compiles all .cu files in $(CUDA_DIR)
build-cuda: $(CUDA_COMPILED)
CUDAPATH = math/src/gpu/cuda/shaders
build-cuda:
nvcc -ptx $(CUDAPATH)/field/stark256.cu -o $(CUDAPATH)/field/stark256.ptx
docs:
cd docs && mdbook serve --open
run-fuzzer:
cargo +nightly fuzz run --fuzz-dir $(FUZZ_DIR) $(FUZZER)
proof-deserializer-fuzzer:
cargo +nightly fuzz run --fuzz-dir $(FUZZ_DIR) deserialize_stark_proof
run-metal-fuzzer:
cd fuzz/metal_fuzz
cargo +nightly fuzz run --fuzz-dir $(FUZZ_DIR) fft_diff
run-cuda-fuzzer:
cd fuzz/cuda_fuzz
cargo hfuzz run $(CUDAFUZZER)