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

Hyper Threading Crate #1679

Merged
merged 8 commits into from
Mar 20, 2024
Merged

Hyper Threading Crate #1679

merged 8 commits into from
Mar 20, 2024

Conversation

pefontana
Copy link
Member

@pefontana pefontana commented Mar 19, 2024

Hyper Threading Crate

Description

New crate to benchmark the performance of Cairo-VM in a hyper-threaded environment

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.

Comment on lines +9 to +13
# Build the command string with all thread counts
for threads in "${thread_counts[@]}"; do
# For hyperfine, wrap each command in 'sh -c' to correctly handle the environment variable
cmd+=" -n \"threads: ${threads}\" 'sh -c \"RAYON_NUM_THREADS=${threads} ${binary}\"'"
done
Copy link
Member

Choose a reason for hiding this comment

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

You can use hyperfine own options here:

  -P, --parameter-scan <VAR> <MIN> <MAX>                                                                                                                                                                                                      
          Perform benchmark runs for each value in the range MIN..MAX. Replaces                                                                                                                                                               
          the string '{VAR}' in each command by the current parameter value.                                                                                                                                                                  
                                                                                                                                                                                                                                              
            Example:  hyperfine -P threads 1 8 'make -j {threads}'                                                                                                                                                                            
                                                                                                                                                                                                                                              
          This performs benchmarks for 'make -j 1', 'make -j 2', …, 'make -j 8'.                                                                                                                                                              
                                                                                                                                                                                                                                              
          To have the value increase following different patterns, use shell                                                                                                                                                                  
          arithmetics.                                                                                                                                                                                                                        
                                                                                                                                                                                                                                              
            Example: hyperfine -P size 0 3 'sleep $((2**{size}))'                                                                                                                                                                             
                                                                                                                                                                                                                                              
          This performs benchmarks with power of 2 increases: 'sleep 1', 'sleep                                                                                                                                                               
          2', 'sleep 4', …                                                                                                                                                                                                                    
          The exact syntax may vary depending on your shell and OS.                                                                                                                                                                           
  -D, --parameter-step-size <DELTA>                                                                                                                                                                                                           
          This argument requires --parameter-scan to be specified as well.                                                                                                                                                                    
          Traverse the range MIN..MAX in steps of DELTA.                                                                                                                                                                                      
                                                                                                                                                                                                                                              
            Example:  hyperfine -P delay 0.3 0.7 -D 0.2 'sleep {delay}'                                                                                                                                                                       
                                                                                                                                                                                                                                              
          This performs benchmarks for 'sleep 0.3', 'sleep 0.5' and 'sleep 0.7'.                                                                                                                                                              
  -L, --parameter-list <VAR> <VALUES>                                                                                                                                                                                                         
          Perform benchmark runs for each value in the comma-separated list                                                                                                                                                                   
          VALUES. Replaces the string '{VAR}' in each command by the current                                                                                                                                                                  
          parameter value.                                                                                             
                                                                                                                       
          Example:  hyperfine -L compiler gcc,clang '{compiler} -O2 main.cpp'                                          
                                                                                                                       
          This performs benchmarks for 'gcc -O2 main.cpp' and 'clang -O2                                               
          main.cpp'.                                                                                                   
                                                                                                                       
          The option can be specified multiple times to run benchmarks for all
          possible parameter combinations.                    

Copy link
Member

Choose a reason for hiding this comment

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

There's also no need to fire up the shell explicitly. The default behavior is to spawn one, unless you pass the -N option.

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.70%. Comparing base (ef9ef5b) to head (f96f139).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1679   +/-   ##
=======================================
  Coverage   96.70%   96.70%           
=======================================
  Files          95       95           
  Lines       38151    38151           
=======================================
  Hits        36894    36894           
  Misses       1257     1257           

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

Copy link

github-actions bot commented Mar 19, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.297 ± 0.043 2.270 2.410 1.01 ± 0.02
head big_factorial 2.265 ± 0.013 2.247 2.288 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.267 ± 0.014 2.249 2.289 1.00
head big_fibonacci 2.275 ± 0.017 2.256 2.320 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.417 ± 0.157 8.268 8.642 1.00
head blake2s_integration_benchmark 8.455 ± 0.127 8.287 8.576 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.355 ± 0.051 2.316 2.496 1.01 ± 0.03
head compare_arrays_200000 2.328 ± 0.053 2.288 2.469 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.448 ± 0.009 1.437 1.463 1.01 ± 0.01
head dict_integration_benchmark 1.439 ± 0.011 1.422 1.460 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.308 ± 0.017 1.287 1.350 1.00
head field_arithmetic_get_square_benchmark 1.314 ± 0.041 1.287 1.420 1.00 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.427 ± 0.138 8.289 8.605 1.00
head integration_builtins 8.588 ± 0.477 8.274 9.560 1.02 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.693 ± 0.156 8.507 8.851 1.00 ± 0.02
head keccak_integration_benchmark 8.675 ± 0.132 8.524 8.833 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.346 ± 0.013 2.330 2.362 1.01 ± 0.01
head linear_search 2.327 ± 0.022 2.307 2.380 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.567 ± 0.009 1.558 1.589 1.00
head math_cmp_and_pow_integration_benchmark 1.576 ± 0.009 1.558 1.589 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.432 ± 0.021 1.415 1.483 1.00 ± 0.03
head math_integration_benchmark 1.429 ± 0.029 1.408 1.507 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.263 ± 0.014 1.247 1.286 1.00 ± 0.01
head memory_integration_benchmark 1.258 ± 0.011 1.244 1.276 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.604 ± 0.012 1.589 1.624 1.00
head operations_with_data_structures_benchmarks 1.606 ± 0.021 1.588 1.661 1.00 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 591.9 ± 5.4 584.5 602.0 1.00 ± 0.01
head pedersen 590.0 ± 4.1 584.2 597.4 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 987.3 ± 5.1 979.8 995.9 1.00 ± 0.01
head poseidon_integration_benchmark 987.1 ± 5.7 977.4 994.2 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.865 ± 0.013 1.853 1.901 1.00 ± 0.01
head secp_integration_benchmark 1.865 ± 0.005 1.859 1.876 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 727.6 ± 3.7 721.0 732.8 1.00
head set_integration_benchmark 728.4 ± 8.3 723.5 751.5 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.668 ± 0.119 4.574 4.990 1.01 ± 0.03
head uint256_integration_benchmark 4.620 ± 0.049 4.567 4.685 1.00

@Oppen Oppen added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit dc603ce Mar 20, 2024
52 checks passed
@Oppen Oppen deleted the hyper-threading-crate branch March 20, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Crate to Benchmark Cairo-VM Performance in Hyper-Threading Contexts
3 participants