A "Hello World" program for the M1 GPU on MacOS using Metal, written in C++
This projects builds and runs on my personal MacBook Air M1, 2020, running macOS Ventura 13.1. It requires XCode and XCode Command Line Tools. The required Metal libraries will be downloaded when the program gets built.
System information:
% uname -a
Darwin Evans-MacBook-Air-2.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 arm64
Install XCode and XCode command line tools:
Compiler information:
% which c++
/usr/bin/c++
%% c++ --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
% xcode-select --version
xcode-select version 2396.
% xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
% xcrun --version
xcrun version 61
make clean all
./a.out