lambdaclass / cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
https://lambdaclass.github.io/cairo-vm
Apache License 2.0
514 stars 144 forks source link

Fix: make coverage command #1795

Closed FrancoGiachetta closed 2 months ago

FrancoGiachetta commented 3 months ago

Change coverage command

Description

This PR changes make coverage command so that it executes the following command:

cargo llvm-cov --html --workspace --features "test_utils, cairo-1-hints"

Checklist

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.79%. Comparing base (309c8a7) to head (19a8858).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1795 +/- ## ======================================= Coverage 94.79% 94.79% ======================================= Files 102 102 Lines 40150 40150 ======================================= Hits 38059 38059 Misses 2091 2091 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 3 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.035 ± 0.014 2.016 2.056 1.00
head big_factorial 2.065 ± 0.076 2.031 2.279 1.01 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.010 ± 0.098 1.961 2.283 1.01 ± 0.05
head big_fibonacci 1.988 ± 0.025 1.969 2.054 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.525 ± 0.201 7.322 7.986 1.00 ± 0.06
head blake2s_integration_benchmark 7.519 ± 0.388 7.251 8.432 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.114 ± 0.017 2.086 2.134 1.00
head compare_arrays_200000 2.119 ± 0.026 2.095 2.184 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.366 ± 0.004 1.359 1.373 1.00
head dict_integration_benchmark 1.385 ± 0.022 1.364 1.438 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.202 ± 0.013 1.189 1.234 1.01 ± 0.01
head field_arithmetic_get_square_benchmark 1.194 ± 0.011 1.182 1.213 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.447 ± 0.110 7.309 7.643 1.00
head integration_builtins 7.486 ± 0.090 7.305 7.584 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.688 ± 0.105 7.538 7.827 1.00
head keccak_integration_benchmark 7.965 ± 0.353 7.548 8.555 1.04 ± 0.05
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.117 ± 0.023 2.096 2.170 1.00 ± 0.01
head linear_search 2.107 ± 0.021 2.083 2.149 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.471 ± 0.008 1.461 1.483 1.00
head math_cmp_and_pow_integration_benchmark 1.490 ± 0.016 1.473 1.518 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.422 ± 0.007 1.405 1.429 1.00
head math_integration_benchmark 1.423 ± 0.009 1.417 1.448 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.177 ± 0.006 1.171 1.189 1.00
head memory_integration_benchmark 1.178 ± 0.004 1.173 1.185 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.541 ± 0.011 1.527 1.564 1.00
head operations_with_data_structures_benchmarks 1.542 ± 0.013 1.529 1.571 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 520.4 ± 2.0 518.3 524.2 1.00
head pedersen 521.6 ± 1.5 519.2 524.1 1.00 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 766.5 ± 2.5 762.8 769.2 1.00 ± 0.01
head poseidon_integration_benchmark 764.6 ± 3.7 760.8 770.1 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.797 ± 0.009 1.786 1.809 1.00
head secp_integration_benchmark 1.802 ± 0.012 1.778 1.820 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 645.0 ± 2.3 641.5 647.8 1.00 ± 0.00
head set_integration_benchmark 644.6 ± 1.8 642.1 647.9 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.199 ± 0.065 4.121 4.347 1.00
head uint256_integration_benchmark 4.210 ± 0.130 4.097 4.570 1.00 ± 0.03
FrancoGiachetta commented 3 months ago

Changes were done @pefontana

github-actions[bot] commented 3 months ago
**Hyper Thereading Benchmark results**

hyperfine -r 2 -n "hyper_threading_main threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_main' -n "hyper_threading_pr threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 1
  Time (mean ± σ):     25.512 s ±  0.040 s    [User: 24.682 s, System: 0.827 s]
  Range (min … max):   25.483 s … 25.540 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     25.583 s ±  0.034 s    [User: 24.802 s, System: 0.779 s]
  Range (min … max):   25.559 s … 25.607 s    2 runs

Summary
  'hyper_threading_main threads: 1' ran
    1.00 ± 0.00 times faster than 'hyper_threading_pr threads: 1'

hyperfine -r 2 -n "hyper_threading_main threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_main' -n "hyper_threading_pr threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 2
  Time (mean ± σ):     14.105 s ±  0.000 s    [User: 25.082 s, System: 0.889 s]
  Range (min … max):   14.105 s … 14.105 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.115 s ±  0.056 s    [User: 25.201 s, System: 0.756 s]
  Range (min … max):   14.075 s … 14.154 s    2 runs

Summary
  'hyper_threading_main threads: 2' ran
    1.00 ± 0.00 times faster than 'hyper_threading_pr threads: 2'

hyperfine -r 2 -n "hyper_threading_main threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_main' -n "hyper_threading_pr threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 4
  Time (mean ± σ):     10.364 s ±  0.104 s    [User: 37.748 s, System: 1.034 s]
  Range (min … max):   10.290 s … 10.437 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.650 s ±  0.492 s    [User: 37.479 s, System: 0.986 s]
  Range (min … max):   10.302 s … 10.998 s    2 runs

Summary
  'hyper_threading_main threads: 4' ran
    1.03 ± 0.05 times faster than 'hyper_threading_pr threads: 4'

hyperfine -r 2 -n "hyper_threading_main threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_main' -n "hyper_threading_pr threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 6
  Time (mean ± σ):     10.573 s ±  0.225 s    [User: 37.749 s, System: 1.010 s]
  Range (min … max):   10.414 s … 10.732 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.367 s ±  0.167 s    [User: 37.703 s, System: 1.041 s]
  Range (min … max):   10.249 s … 10.485 s    2 runs

Summary
  'hyper_threading_pr threads: 6' ran
    1.02 ± 0.03 times faster than 'hyper_threading_main threads: 6'

hyperfine -r 2 -n "hyper_threading_main threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_main' -n "hyper_threading_pr threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 8
  Time (mean ± σ):     10.446 s ±  0.175 s    [User: 37.995 s, System: 0.998 s]
  Range (min … max):   10.322 s … 10.569 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.310 s ±  0.001 s    [User: 38.184 s, System: 1.005 s]
  Range (min … max):   10.310 s … 10.311 s    2 runs

Summary
  'hyper_threading_pr threads: 8' ran
    1.01 ± 0.02 times faster than 'hyper_threading_main threads: 8'

hyperfine -r 2 -n "hyper_threading_main threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_main' -n "hyper_threading_pr threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 16
  Time (mean ± σ):     10.337 s ±  0.147 s    [User: 38.379 s, System: 1.115 s]
  Range (min … max):   10.233 s … 10.441 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.458 s ±  0.215 s    [User: 38.196 s, System: 1.082 s]
  Range (min … max):   10.306 s … 10.609 s    2 runs

Summary
  'hyper_threading_main threads: 16' ran
    1.01 ± 0.03 times faster than 'hyper_threading_pr threads: 16'
pefontana commented 3 months ago

@FrancoGiachetta Put the "Tests" label to the PR so the changelog check doesn't fail

Oppen commented 3 months ago

I'm not sure this was broken in the first place, though I failed to document properly how it works. make test produces coverage data, what make coverage currently does is consolidate it into a report we can upload to codecov.io. That's so we can run the different features in parallel in the CI. The original way took us a long time for each PR. Is this no longer working?

FrancoGiachetta commented 3 months ago

Hi! The idea behind this change is so that we can run make coverage without the need to run make test before that. It also changes the args passed to the command, mainly to change the output's format.