Skip to content

Commit

Permalink
Update make deps (lambdaclass#963)
Browse files Browse the repository at this point in the history
* Add make deps-macos && update make deps

* Add .python-version to .gitignore

* pin bitarray version

* Add pypy to deps

* Modify python versions in un_benchmarks.sh

* Update run_benchmarks.sh layouts

* Add virtual envs to make deps

* Update README.md

* add make cargo-deps

---------

Co-authored-by: Pedro Fontana <pedro.fontana@lamdaclass.com>
Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com>
  • Loading branch information
3 people authored and kariy committed Jun 23, 2023
1 parent 8795e0d commit 2c10124
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
**/*.memory
**/*.swp
bench/results
.python-version
cairo-rs-env/*
cairo-rs-pypy-env/*
37 changes: 28 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RELBIN:=target/release/cairo-rs-run
DBGBIN:=target/debug/cairo-rs-run

.PHONY: deps build run check test clippy coverage benchmark flamegraph \
.PHONY: deps deps-macos cargo-deps build run check test clippy coverage benchmark flamegraph \
compare_benchmarks_deps compare_benchmarks docs clean \
compare_vm_output compare_trace_memory compare_trace compare_memory \
compare_trace_memory_proof compare_trace_proof compare_memory_proof \
Expand Down Expand Up @@ -88,18 +88,36 @@ COMPILED_BAD_TESTS:=$(patsubst $(BAD_TEST_DIR)/%.cairo, $(BAD_TEST_DIR)/%.json,
$(BAD_TEST_DIR)/%.json: $(BAD_TEST_DIR)/%.cairo
cairo-compile $< --output $@

deps:
cargo-deps:
cargo install --version 1.1.0 cargo-criterion
cargo install --version 0.6.1 flamegraph
cargo install --version 1.14.0 hyperfine
cargo install --version 0.9.49 cargo-nextest
cargo install --version 0.5.9 cargo-llvm-cov
pyenv install pypy3.7-7.3.9
pyenv global pypy3.7-7.3.9
pip install -r requirements.txt
pyenv install 3.7.12
pyenv global 3.7.12
pip install -r requirements.txt
cargo install --version 0.11.0 wasm-pack

deps:
$(MAKE) cargo-deps
pyenv install -s pypy3.9-7.3.9
PYENV_VERSION=pypy3.9-7.3.9 python -m venv cairo-rs-pypy-env
. cairo-rs-pypy-env/bin/activate ; \
pip install -r requirements.txt ; \
pyenv install -s 3.9.15
PYENV_VERSION=3.9.15 python -m venv cairo-rs-env
. cairo-rs-env/bin/activate ; \
pip install -r requirements.txt ; \

deps-macos:
$(MAKE) cargo-deps
brew install gmp
arch -x86_64 pyenv install -s pypy3.9-7.3.9
PYENV_VERSION=pypy3.9-7.3.9 python -m venv cairo-rs-pypy-env
. cairo-rs-pypy-env/bin/activate ; \
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib pip install -r requirements.txt ; \
pyenv install -s 3.9.15
PYENV_VERSION=3.9.15 python -m venv cairo-rs-env
. cairo-rs-env/bin/activate ; \
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib pip install -r requirements.txt ; \

$(RELBIN):
cargo build --release
Expand Down Expand Up @@ -182,4 +200,5 @@ clean:
rm -f $(TEST_PROOF_DIR)/*.json
rm -f $(TEST_PROOF_DIR)/*.memory
rm -f $(TEST_PROOF_DIR)/*.trace

rm -rf cairo-rs-env
rm -rf cairo-rs-pypy-env
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ It's Turing-complete and it was created by [Starkware](https://starkware.co/) as

**Optional**

These dependencies are only necessary in order to run the original VM and compile Cairo programs.
These dependencies are only necessary in order to run the original VM, compile Cairo programs, and run tests.
- PyEnv with Python 3.9
- cairo-lang

Expand Down
6 changes: 3 additions & 3 deletions bench/run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ for file in $(ls $tests_path | grep .cairo | sed -E 's/\.cairo//'); do
export PATH="$(pyenv root)/shims:$PATH"

hyperfine \
-n "Cairo VM (CPython)" "PYENV_VERSION=3.7.12 cairo-run --layout all --program $tests_path/$file.json" \
-n "Cairo VM (PyPy)" "PYENV_VERSION=pypy3.7-7.3.9 cairo-run --layout all --program $tests_path/$file.json" \
-n "cairo-rs (Rust)" "../target/release/cairo-vm-cli $tests_path/$file.json --layout all"
-n "Cairo VM (CPython)" "PYENV_VERSION=3.9.15 cairo-run --layout starknet_with_keccak --program $tests_path/$file.json" \
-n "Cairo VM (PyPy)" "PYENV_VERSION=pypy3.9-7.3.9 cairo-run --layout starknet_with_keccak --program $tests_path/$file.json" \
-n "cairo-rs (Rust)" "../target/release/cairo-vm-cli $tests_path/$file.json --layout starknet_with_keccak"
done
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ecdsa==0.18.0
bitarray==2.7.3
fastecdsa==2.2.3
sympy==1.11.1
typeguard==2.13.3
Expand Down

0 comments on commit 2c10124

Please sign in to comment.