Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maurycy/c5794586854d72abc07e6f76087c5d5b to your computer and use it in GitHub Desktop.

Select an option

Save maurycy/c5794586854d72abc07e6f76087c5d5b to your computer and use it in GitHub Desktop.
M4 STREAM
2026-05-03T17:44:41.139075000+0200 maurycy@gimel /Users/maurycy/Desktop % curl -O https://www.cs.virginia.edu/stream/FTP/Code/stream.c
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 19967 100 19967 0 0 30569 0 0
2026-05-03T17:44:42.289261000+0200 maurycy@gimel /Users/maurycy/Desktop % cc -O3 -march=native -DSTREAM_ARRAY_SIZE=80000000 -DNTIMES=10 -o stream stream.c
2026-05-03T17:44:44.972800000+0200 maurycy@gimel /Users/maurycy/Desktop % ./stream
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 80000000 (elements), Offset = 0 (elements)
Memory per array = 610.4 MiB (= 0.6 GiB).
Total memory required = 1831.1 MiB (= 1.8 GiB).
Each kernel will be executed 10 times.
The *best* time for each kernel (excluding the first iteration)
will be used to compute the reported bandwidth.
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 31163 microseconds.
(= 31163 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function Best Rate MB/s Avg time Min time Max time
Copy: 83154.6 0.015737 0.015393 0.016262
Scale: 81435.4 0.016312 0.015718 0.018327
Add: 90196.0 0.021656 0.021287 0.022439
Triad: 90609.1 0.021670 0.021190 0.022623
-------------------------------------------------------------
Solution Validates: avg error less than 1.000000e-13 on all three arrays
-------------------------------------------------------------
2026-05-03T17:49:17.663140000+0200 maurycy@gimel /Users/maurycy/Desktop % sysctl -n machdep.cpu.brand_string
Apple M4
2026-05-03T17:49:19.935279000+0200 maurycy@gimel /Users/maurycy/Desktop % sysctl -n hw.perflevel0.physicalcpu
4
2026-05-03T17:49:24.465012000+0200 maurycy@gimel /Users/maurycy/Desktop % sysctl -n hw.perflevel1.physicalcpu
6
2026-05-03T17:52:02.917169000+0200 maurycy@gimel /Users/maurycy/Desktop % clang -O3 -mcpu=native -Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include -L/opt/homebrew/opt/libomp/lib -lomp -DSTREAM_ARRAY_SIZE=80000000 -DNTIMES=20 -o stream_omp stream.c
2026-05-03T17:52:03.456892000+0200 maurycy@gimel /Users/maurycy/Desktop % OMP_NUM_THREADS=4 OMP_PROC_BIND=true OMP_PLACES=cores ./stream_omp
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 80000000 (elements), Offset = 0 (elements)
Memory per array = 610.4 MiB (= 0.6 GiB).
Total memory required = 1831.1 MiB (= 1.8 GiB).
Each kernel will be executed 20 times.
The *best* time for each kernel (excluding the first iteration)
will be used to compute the reported bandwidth.
-------------------------------------------------------------
Number of Threads requested = 4
Number of Threads counted = 4
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 25874 microseconds.
(= 25874 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function Best Rate MB/s Avg time Min time Max time
Copy: 100417.3 0.013073 0.012747 0.013282
Scale: 98787.6 0.013304 0.012957 0.013560
Add: 94154.8 0.020795 0.020392 0.021787
Triad: 93961.5 0.020802 0.020434 0.022271
-------------------------------------------------------------
Solution Validates: avg error less than 1.000000e-13 on all three arrays
-------------------------------------------------------------
2026-05-03T17:52:12.239295000+0200 maurycy@gimel /Users/maurycy/Desktop % OMP_NUM_THREADS=10 OMP_PROC_BIND=true OMP_PLACES=cores ./stream_omp
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 80000000 (elements), Offset = 0 (elements)
Memory per array = 610.4 MiB (= 0.6 GiB).
Total memory required = 1831.1 MiB (= 1.8 GiB).
Each kernel will be executed 20 times.
The *best* time for each kernel (excluding the first iteration)
will be used to compute the reported bandwidth.
-------------------------------------------------------------
Number of Threads requested = 10
Number of Threads counted = 10
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 17848 microseconds.
(= 17848 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function Best Rate MB/s Avg time Min time Max time
Copy: 105202.8 0.012812 0.012167 0.014068
Scale: 92492.2 0.014519 0.013839 0.016639
Add: 93091.5 0.020968 0.020625 0.021812
Triad: 93141.0 0.020993 0.020614 0.021813
-------------------------------------------------------------
Solution Validates: avg error less than 1.000000e-13 on all three arrays
-------------------------------------------------------------
2026-05-03T17:52:17.355789000+0200 maurycy@gimel /Users/maurycy/Desktop %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment