Running lattice QCD on Apple Silicon with native Metal GPU

  • Context: Graduate 
  • Thread starter Thread starter petruspennanen
  • Start date Start date
Click For Summary

SUMMARY

The discussion centers on porting lattice QCD flux-tube simulations to Apple Silicon using a native Metal GPU backend. The project utilizes Peter Boyle's Grid framework with a custom Metal backend implemented in Objective-C++ and Metal Shading Language (MSL), avoiding CUDA and third-party wrappers. Current work achieves verified SU(2) production runs on M-series Macs, leveraging Metal's zero-copy shared memory model for efficient gauge link and propagator data handling. The next development phase targets SU(3) simulations and multi-quark flux-tube fusion studies. The code is open source, and the author seeks community insights on Metal for scientific computing beyond the dominant CUDA ecosystem.

PREREQUISITES

  • Grid lattice QCD framework by Peter Boyle
  • Metal compute shaders and Metal Shading Language (MSL) on Apple Silicon
  • Objective-C++ integration with GPU compute APIs
  • Lattice QCD concepts including Wilson loops and Cornell potential fits

NEXT STEPS

  • Implement SU(3) lattice QCD simulations using the Metal backend
  • Develop multi-quark (6-quark) flux-tube fusion models on Apple Silicon
  • Benchmark Metal GPU performance against CPU and CUDA implementations
  • Explore Metal's shared memory optimizations for lattice gauge theory data structures

USEFUL FOR

Computational physicists specializing in lattice QCD, developers porting scientific codes to Apple Silicon, GPU programmers interested in Metal compute shaders, and researchers exploring alternatives to CUDA for high-performance scientific computing.

petruspennanen
Messages
1
Reaction score
0
TL;DR
I ported my old lattice QCD flux-tube code to Apple Metal. Running SU(2) on M-series Macs, verified against CPU. Anyone else tried Metal for scientific computing?
I've been working on reviving my old lattice QCD flux-tube code and porting it to run natively on Apple Silicon using Metal compute shaders. The project uses Grid (Peter Boyle's framework) with a custom Metal backend I wrote — no CUDA, no third-party wrappers, just native MSL kernels talking to Grid's memory managers through Objective-C++.

The immediate physics goal is high-statistics SU(2) measurements of chromofield flux distributions between static quarks — Wilson loops, Cornell potential fits, and transverse flux-tube profiles. This builds on work I did for my PhD (Pennanen et al., 1998) on multi-quark systems, but now with much better statistics and larger lattices than were feasible back then.

What makes this unusual is the hardware: everything runs on M-series Macs (MacBook Pro, Mac Studio). Metal's shared memory model gives you zero-copy between CPU and GPU, which turns out to work quite well for lattice gauge theory where you're constantly shuffling gauge links and propagators.

Current status: SU(2) production runs are working with the Metal backend verified against CPU results (SHA-256 config hashing + runtime metadata to confirm GPU dispatch). Next step is moving to SU(3) and eventually 6-quark systems to study flux-tube reorganisation during fusion.

Has anyone else tried running lattice simulations on Apple hardware? I'd be curious to hear about experiences with Metal for scientific computing in general. The whole CUDA ecosystem dominance makes it feel like uncharted territory.

Code is open source: [github link redacted by the Mentors]
 
Last edited by a moderator:
Physics news on Phys.org
Why is the GitHub link redacted? Are there references to published work on your code?
 
Paul Colby said:
Why is the GitHub link redacted?
Too spammy for a new poster.

Paul Colby said:
Are there references to published work on your code?
Good question.