I had wanted to try this on my MacBook Air M2 almost a year ago. Finally got to doing it. There was a bit of fiddling to get it to compile, which I've encapsulated in the script below in case someone else wants to try it on their mac.
Here's the script:Here's my system:Here are the results:
Here's the script:
Code:
# first, get bits from homebrewif [ ! -d /opt/homebrew/opt/llvm ]then brew install llvm libompelse echo llvm already herefi# demonstrate that we will find the new compilerexport PATH="/opt/homebrew/opt/llvm/bin:$PATH"which clang# patch the original Makefile to work with llvm and libompcat <<- EOF | patch --output Makefile.new Makefile ---- Makefile2023-01-20 15:50:46.000000000 -0600+++ Makefile.new2025-12-17 15:44:13.318329568 -0600@@ -1,4 +1,4 @@-CFLAGS=-std=gnu99 -O3 -mtune=native -march=native -Wall+CFLAGS=-std=gnu99 -O3 -mtune=native -march=native -Wall -I/opt/homebrew/opt/libomp/include #CFLAGS=-O3 -ffast-math -mtune=znver2 -march=znver2 -Wall #CFLAGS=-O3 -mtune=native -march=native -ffast-math -Wall #CFLAGS=-O5 -Wall@@ -6,7 +6,7 @@ #CFLAGS=-std=gnu99 -O3 -ffast-math -Wall #CFLAGS=-O3 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -ffast-math -Wall #CFLAGS=-O3 -mcpu=power9 -mtune=power9 -ffast-math -Wall-CC=gcc+CC=/opt/homebrew/opt/llvm/bin/clang #CC=xlc #CC=icc #CC=/usr/local/gcc-6.2/bin/gcc@@ -18,7 +18,7 @@ #CC=/usr/local/llvm-7.0.1/bin/clang #CC=/usr/bin/clang-9 #LDFLAGS=-lm -lrt-LDFLAGS=-lm+LDFLAGS=-lm -L/opt/homebrew/opt/libomp/lib OC=/opt/opencilk-2/bin/clang #OCFLAGS=-O3 -mcpu=cortex-a72 -mtune=cortex-a72 -Wall #OCFLAGS=-O3 -mtune=znver2 -march=znver2 -WallEOF# then run make on that slightly modified Makefilemake -f Makefile.newCode:
Hardware Overview: Model Name: MacBook Air Model Identifier: Mac14,2 Model Number: MNQP3LL/A Chip: Apple M2 Total Number of Cores: 8 (4 performance and 4 efficiency) Memory: 16 GBCode:
./pichart-openmp -t "MacBook Air M2"pichart -- Raspberry Pi Performance OPENMP version 40Prime Sieve P=14630843 Workers=8 Sec=0.14224 Mops=6568.68Merge Sort N=16777216 Workers=8 Sec=0.149066 Mops=2701.17Fourier Transform N=4194304 Workers=8 Sec=0.0648509 Mflops=7114.37Lorenz 96 N=32768 K=16384 Workers=4 Sec=0.0371205 Mflops=86777.6The MacBook Air M2 has Raspberry Pi ratio=287.267Making pie charts...done.Statistics: Posted by tinker2much — Wed Dec 17, 2025 10:48 pm