From 2c101247dca792f01cc3e8eec8c359147b0cf228 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Mon, 17 Apr 2023 12:34:38 -0300 Subject: [PATCH] Update make deps (#963) * 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 Co-authored-by: Mario Rugiero --- .gitignore | 3 +++ Makefile | 37 ++++++++++++++++++++++++++++--------- README.md | 2 +- bench/run_benchmarks.sh | 6 +++--- requirements.txt | 1 + 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 6d6c3eaba7..6ce6b063ab 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ **/*.memory **/*.swp bench/results +.python-version +cairo-rs-env/* +cairo-rs-pypy-env/* diff --git a/Makefile b/Makefile index 9494b6feff..3ffec8df5c 100644 --- a/Makefile +++ b/Makefile @@ -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 \ @@ -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 @@ -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 diff --git a/README.md b/README.md index f8d5a78031..ca6263249e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bench/run_benchmarks.sh b/bench/run_benchmarks.sh index d44130d21f..230092b4f0 100755 --- a/bench/run_benchmarks.sh +++ b/bench/run_benchmarks.sh @@ -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 diff --git a/requirements.txt b/requirements.txt index 9eca8e3b19..6e0951b922 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ ecdsa==0.18.0 +bitarray==2.7.3 fastecdsa==2.2.3 sympy==1.11.1 typeguard==2.13.3