Skip to content

Instantly share code, notes, and snippets.

@Benitoite
Last active September 12, 2024 15:48
Show Gist options
  • Save Benitoite/bd5f365a1783edf76caac4a6ed5e4f4a to your computer and use it in GitHub Desktop.
Save Benitoite/bd5f365a1783edf76caac4a6ed5e4f4a to your computer and use it in GitHub Desktop.
rawtherapee amaze timer for macos zsh
intel:
curl -L https://github.com/Benitoite/raw-test/releases/download/3FR/B0001131.3FR -o B0001131.3FR ; curl -L https://github.com/Benitoite/raw-test/releases/download/3FR/B0001131.3FR.pp3 -o B0001131.3FR.pp3 ; num=$(sysctl -n hw.physicalcpu) ; sockets=1 ; total_threads=$((num * sockets)) ; name=$(system_profiler SPHardwareDataType | grep 'Processor Name:' | sed 's/Processor Name: *//' | cut -c 7-) ; mhz=$(system_profiler SPHardwareDataType | grep 'Speed:' | awk '{print $3}') ; proc=$(cat ./AboutThisBuild.txt | grep 'Processor') ; echo "\`\`\`" ; echo "================================" ; echo "Available threads = $total_threads / CPU = $name / $mhz GHz / Target = $proc" ; for (( threads = 2; threads <= total_threads; threads *= 2 )); do export OMP_NUM_THREADS=$threads ; total_time=0.0 ; n=11 ; for file in B0001131.3FR ; do time_sum=0.0 ; for (( i = 0; i < n; i++ )); do start=$(( $(date +%s%N)/1000000 )) ; rawtherapee-cli -j -s -Y -c ./$file &> /dev/null ; finished=$(( $(date +%s%N) / 1000000 )) ; time_sum=$(( $time_sum + $finished - $start )) ; done ; avg_time=$(( $time_sum / $n )) ; total_time=$(( $total_time + $avg_time )) ; done ; echo "$(printf '%.0f\n' "$total_time") total milliseconds elapsed (average of $n runs) using OMP_NUM_THREADS = $threads" ; done ; echo "================================" ; echo "\`\`\`"
arm64:
curl -L https://github.com/Benitoite/raw-test/releases/download/3FR/B0001131.3FR -o B0001131.3FR ; curl -L https://github.com/Benitoite/raw-test/releases/download/3FR/B0001131.3FR.pp3 -o B0001131.3FR.pp3 ; num=$(sysctl -n hw.physicalcpu) ; sockets=1 ; total_threads=$((num * sockets)) ; name=$(system_profiler SPHardwareDataType | grep 'Chip:' | sed 's/Chip: *//' | cut -c 7-) ; mhz=$(i=0 ; total=0 ; for freq in $(sudo timeout 1s powermetrics -i 1 | grep 'P-Cluster HW active frequency:' | sed 's/P-Cluster HW active frequency:*//' | cut -c2-6) ; do echo $(( total+=$freq )) > /dev/null ; i+=1 ; done ; ave=$(( $total/$i )) ; echo $ave | grep -oE '^\s*[0-9]+') ; proc=$(cat ./AboutThisBuild.txt | grep 'Processor') ; echo "\`\`\`" ; echo "================================" ; echo "Available threads = $total_threads / CPU = $name / $mhz MHz / Target = $proc" ; for (( threads = 2; threads <= total_threads; threads *= 2 )); do export OMP_NUM_THREADS=$threads ; total_time=0.0 ; n=11 ; for file in B0001131.3FR; do time_sum=0.0 ; for (( i = 0; i < n; i++ )); do start=$(( $(date +%s%N)/1000000 )) ; rawtherapee-cli -j -s -Y -c ./$file &> /dev/null ; finished=$(( $(date +%s%N) / 1000000 )) ; time_sum=$(( $time_sum + $finished - $start )) ; done ; avg_time=$(( $time_sum / $n )) ; total_time=$(( $total_time + $avg_time )) ; done ; echo "$(printf '%.0f\n' "$total_time") total milliseconds elapsed (average of $n runs) using OMP_NUM_THREADS = $threads" ; done ; echo "================================" ; echo "\`\`\`"
@Benitoite
Copy link
Author

================================
Available threads = 8 / CPU = 8-Core Intel Xeon E5 / 3.3 GHz / Target = Processor: nehalem-westemere
22652 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 2
14643 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 4
9909 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 8
================================

@Benitoite
Copy link
Author

================================
Available threads = 8 / CPU = Apple M1 / 2751 MHz / Target = Processor: arm64
33278 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 2
19209 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 4
12617 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 8
================================

+simde

================================
Available threads = 8 / CPU = Apple M1 / 2897 MHz / Target = Processor: arm64
34558 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 2
20225 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 4
11812 total milliseconds elapsed (average of 11 runs) using OMP_NUM_THREADS = 8
================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment