Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test adding programs using non squashed Felt252Dict #1797

Merged
merged 13 commits into from
Jul 16, 2024

Conversation

FrancoGiachetta
Copy link
Contributor

@FrancoGiachetta FrancoGiachetta commented Jun 26, 2024

Add non squashed Felt252Dict tests

Description

PR #1721 modified felt tests so that the work with SquashedFelt252Dict. This PR adds the same tests with the difference that they use Felt252Dict.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

Copy link

github-actions bot commented Jun 26, 2024

**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.436 s ±  0.090 s    [User: 24.661 s, System: 0.774 s]
  Range (min … max):   25.373 s … 25.500 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     25.495 s ±  0.044 s    [User: 24.684 s, System: 0.810 s]
  Range (min … max):   25.463 s … 25.526 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.068 s ±  0.014 s    [User: 25.108 s, System: 0.781 s]
  Range (min … max):   14.058 s … 14.078 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.109 s ±  0.050 s    [User: 25.154 s, System: 0.794 s]
  Range (min … max):   14.074 s … 14.145 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.658 s ±  0.374 s    [User: 37.397 s, System: 0.980 s]
  Range (min … max):   10.394 s … 10.923 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.541 s ±  0.668 s    [User: 37.878 s, System: 0.983 s]
  Range (min … max):   10.069 s … 11.014 s    2 runs
 
Summary
  'hyper_threading_pr threads: 4' ran
    1.01 ± 0.07 times faster than 'hyper_threading_main 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.287 s ±  0.042 s    [User: 38.195 s, System: 0.973 s]
  Range (min … max):   10.257 s … 10.317 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.472 s ±  0.284 s    [User: 37.770 s, System: 0.927 s]
  Range (min … max):   10.271 s … 10.674 s    2 runs
 
Summary
  'hyper_threading_main threads: 6' ran
    1.02 ± 0.03 times faster than 'hyper_threading_pr 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.269 s ±  0.028 s    [User: 38.060 s, System: 0.984 s]
  Range (min … max):   10.249 s … 10.289 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.331 s ±  0.137 s    [User: 37.899 s, System: 1.016 s]
  Range (min … max):   10.234 s … 10.427 s    2 runs
 
Summary
  'hyper_threading_main threads: 8' ran
    1.01 ± 0.01 times faster than 'hyper_threading_pr 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.303 s ±  0.300 s    [User: 38.422 s, System: 1.044 s]
  Range (min … max):   10.091 s … 10.515 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.237 s ±  0.102 s    [User: 38.505 s, System: 1.073 s]
  Range (min … max):   10.164 s … 10.309 s    2 runs
 
Summary
  'hyper_threading_pr threads: 16' ran
    1.01 ± 0.03 times faster than 'hyper_threading_main threads: 16'


Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.89%. Comparing base (309c8a7) to head (9f111a6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1797      +/-   ##
==========================================
+ Coverage   94.79%   94.89%   +0.09%     
==========================================
  Files         102      102              
  Lines       40150    40151       +1     
==========================================
+ Hits        38059    38100      +41     
+ Misses       2091     2051      -40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jun 26, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.006 ± 0.053 1.980 2.154 1.02 ± 0.03
head big_factorial 1.974 ± 0.009 1.961 1.986 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.918 ± 0.022 1.896 1.964 1.00
head big_fibonacci 1.939 ± 0.015 1.911 1.959 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.286 ± 0.142 7.059 7.449 1.00
head blake2s_integration_benchmark 7.628 ± 0.872 7.060 9.376 1.05 ± 0.12
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.024 ± 0.030 1.964 2.066 1.00
head compare_arrays_200000 2.075 ± 0.061 2.031 2.229 1.03 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.340 ± 0.017 1.319 1.368 1.00
head dict_integration_benchmark 1.346 ± 0.017 1.320 1.379 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.175 ± 0.013 1.151 1.190 1.00 ± 0.02
head field_arithmetic_get_square_benchmark 1.175 ± 0.012 1.158 1.199 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.309 ± 0.132 7.139 7.521 1.00
head integration_builtins 7.356 ± 0.189 7.171 7.812 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.540 ± 0.107 7.373 7.651 1.00
head keccak_integration_benchmark 7.777 ± 0.506 7.355 9.186 1.03 ± 0.07
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.049 ± 0.030 2.001 2.084 1.00
head linear_search 2.069 ± 0.040 2.030 2.143 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.425 ± 0.010 1.414 1.447 1.00
head math_cmp_and_pow_integration_benchmark 1.444 ± 0.042 1.422 1.561 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.410 ± 0.063 1.361 1.584 1.02 ± 0.05
head math_integration_benchmark 1.382 ± 0.013 1.364 1.409 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.143 ± 0.005 1.137 1.152 1.00
head memory_integration_benchmark 1.168 ± 0.007 1.156 1.180 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.480 ± 0.016 1.454 1.503 1.00
head operations_with_data_structures_benchmarks 1.498 ± 0.032 1.458 1.576 1.01 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 512.3 ± 2.8 507.0 517.1 1.00
head pedersen 513.0 ± 7.4 497.2 527.4 1.00 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 724.3 ± 13.6 694.1 739.3 1.01 ± 0.02
head poseidon_integration_benchmark 716.2 ± 8.7 702.5 729.7 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.723 ± 0.022 1.694 1.768 1.00
head secp_integration_benchmark 1.727 ± 0.012 1.710 1.755 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 621.4 ± 10.3 601.0 636.7 1.00
head set_integration_benchmark 622.7 ± 7.5 614.7 635.6 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.015 ± 0.065 3.932 4.174 1.00 ± 0.02
head uint256_integration_benchmark 4.006 ± 0.059 3.899 4.077 1.00

@FrancoGiachetta FrancoGiachetta changed the title adding programs using non squashed Felt252 Test adding programs using non squashed Felt252Dict Jun 26, 2024
@FrancoGiachetta FrancoGiachetta marked this pull request as ready for review June 26, 2024 17:18
@FrancoGiachetta FrancoGiachetta marked this pull request as draft June 26, 2024 17:54
@FrancoGiachetta FrancoGiachetta marked this pull request as ready for review June 26, 2024 20:31
@FrancoGiachetta FrancoGiachetta marked this pull request as draft June 27, 2024 12:40
@FrancoGiachetta FrancoGiachetta marked this pull request as ready for review June 27, 2024 19:30
Copy link
Collaborator

@pefontana pefontana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice @FrancoGiachetta
I leaved you some comments and we can merge it

Another point. I think it is a good idea to move the non squashed programs to another folder like

cairo_programs/cairo-1-programs/dict_without_squash or something similar

@@ -320,13 +320,6 @@ mod tests {
None
)]
#[case("array_integer_tuple.cairo", "[1] 1", "[1 1 1]", None, None)]
#[case(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this test?


// TODO: remove this temporary fix once fixed in cairo
#[inline(never)]
fn identity<T>(t: T) -> T { t }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add endline

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont get why we change this file,
The idea was to add two new test, not removing the existing ones

"{66675: [8 9 10 11] 66676: [1 2 3]}",
None
)]
fn test_run_progarm_non_proof(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here explaining why we test these programs in a different way than the others

@FrancoGiachetta
Copy link
Contributor Author

@pefontana changes were done. Sorry about the files, seems I've had some trouble renaming the files.

@FrancoGiachetta FrancoGiachetta added the tests Implementation of tests label Jun 28, 2024
cairo1-run/src/main.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except for a small typo

cairo1-run/src/main.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file?

@pefontana pefontana added this pull request to the merge queue Jul 16, 2024
Merged via the queue into main with commit 0f29713 Jul 16, 2024
72 checks passed
@pefontana pefontana deleted the test/cario_felt252_dict branch July 16, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Implementation of tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants