Running a GPU WU on a Mac Studio

If you're new to FAH and need help getting started or you have very basic questions, start here.

Moderators: Site Moderators, FAHC Science Team

mfpotter
Posts: 8
Joined: Wed Mar 11, 2020 11:19 am

Running a GPU WU on a Mac Studio

Post by mfpotter »

My apologies in advance if this is a stupid question, but is it possible to run an FAH slot using the GPU on a Mac Studio? I have tried to add a slot for a GPU, and although the client allows me to do so, it never executes a WU. My Mac Studio has an M1 Max SoC, with a 32-core GPU, but, obviously, not a separate/dedicated GPU card.

Best regards,
Mike Potter
JimboPalmer
Posts: 2573
Joined: Mon Feb 16, 2009 4:12 am
Location: Greenwood MS USA

Re: Running a GPU WU on a Mac Studio

Post by JimboPalmer »

Welcome to Folding@Home!

For a long time the MacOS had a driver bug preventing OpenCL from working.
Shortly after they fixed it, they depreciated OpenCL in favor of metal.
Currently, only AMD and Nvidia have written GPU code for F@H, but if Apple wrote a Core for folding, I bet F@H would issue Work Units for it.

That said, Linux does not have the OpenCL issues, so a Mac with an AMD or Nvidia GPU wanted to fold, Linux might be the answer.
Tsar of all the Rushers
I tried to remain childlike, all I achieved was childish.
A friend to those who want no friends
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Running a GPU WU on a Mac Studio

Post by Joe_H »

That OpenCL bug was the beginning of a string of obstacles towards getting a working GPU folding solution for Mac's. Apple took 2-3 years before fixing the bug in their OpenCL implementation and releasing it in a software update. The bug also affected other software development doing number crunching on GPUs under the macOS besides F@h. By the time the fix was out, almost no Mac's were sold with suitable GPUs for folding, and almost all older GPUs were no longer usable. F@h ended up not expending developer time to create a GPU folding core for use by a small number of systems out there such as Mac Pros upgraded with third party AMD or Nvidia cards.

There is still some interest in getting GPU folding on macOS. Either support for Metal would need to be added to GROMACS or OpenMM, or a core would have to be created using the available OpenCL support. While deprecated, Apple still supports OpenCL including for GPU processing on M1 and M2 Mac's. I don't have any information though on progress towards that happening.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
mfpotter
Posts: 8
Joined: Wed Mar 11, 2020 11:19 am

Re: Running a GPU WU on a Mac Studio

Post by mfpotter »

Thank you both for your replies, I greatly appreciate it!
hbeamu
Posts: 1
Joined: Sun Dec 04, 2022 8:22 am

Re: Running a GPU WU on a Mac Studio

Post by hbeamu »

I also appreciate the background history leading to no gpu support for Macs. My Mac Pro (2019) has a Radeon Pro Vega II with a lot of processing power which often just sits, and I have wondered why fah does not use it. I am pleased to hear there is still interest in getting f@h running on Mac gpus.
randoPrime
Posts: 2
Joined: Sat Dec 31, 2022 10:25 pm

Re: Running a GPU WU on a Mac Studio

Post by randoPrime »

Is it possible to utilize the GPUs on an M1 Mac if I was to install Linux or Windows? Is it the MacOS software specifically that is keeping the GPU cores from folding?
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Running a GPU WU on a Mac Studio

Post by Joe_H »

randoPrime wrote: Fri Jan 06, 2023 4:44 pm Is it possible to utilize the GPUs on an M1 Mac if I was to install Linux or Windows? Is it the MacOS software specifically that is keeping the GPU cores from folding?
The macOS is not the only thing keeping GPU cores from folding. They would still need to create a folding core to utilize the M1 integrated GPU. An obstacle that came up for someone investigating utilizing the M1 iGPU was that the normal client method of identifying a GPU being present - checking for a PCI ID - doesn't work.

I also haven't been keeping in touch with the progress of creating an Apple Silicon port of Linux to run on recent Mac hardware. At this point all I can say is that some investigation into using the newer hardware from Apple is being done, no idea if it will make it to a release that will also include the GPU. They did compile a native code version of the CPU folding core, that replaced the version that was Intel code running in Rosetta2.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
MaineDPCdoc
Posts: 2
Joined: Sat Dec 19, 2020 9:35 pm

Re: Running a GPU WU on a Mac Studio

Post by MaineDPCdoc »

For what it's worth, the BOINC project PrimeGrid now can use Mac M1 and M2 GPUs for distributed computing.

I'm trying it on my M2 MBA and it seems to work well. Based on the task names, it appears they are using OpenCL, not Metal. I imagine a Mac Studio would scream through GPU tasks compared to my fanless MBA.

https://www.primegrid.com/forum_thread. ... 207#161570

https://developer.apple.com/forums/thread/694866

https://www.reddit.com/r/BOINC/comments ... wto_guide/
Last edited by MaineDPCdoc on Tue Apr 18, 2023 11:54 am, edited 1 time in total.
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Running a GPU WU on a Mac Studio

Post by Joe_H »

Just a note that the responses in the Apple forum that Apple doesn't have anything posted on OpenCL are not correct. There are several places where Apple has posted variations of the following:
OpenGL is deprecated, but is available on Apple silicon.

OpenCL is deprecated, but is available on Apple silicon when targeting the GPU. The OpenCL CPU device is not available to arm64 apps.
This still applies to macOS Ventura, though a few months ago I did come across a post claiming one of the updates broke OpenCL usage. Didn't have anything to test that out with, so consider that claim as unverified.
calxalot
Site Moderator
Posts: 878
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: Running a GPU WU on a Mac Studio

Post by calxalot »

What user does PrimeGrid GPU run as? Does it need to run as the logged in user, or can an unprivileged daemon access the GPU?
MaineDPCdoc
Posts: 2
Joined: Sat Dec 19, 2020 9:35 pm

Re: Running a GPU WU on a Mac Studio

Post by MaineDPCdoc »

calxalot wrote: Wed Apr 19, 2023 10:10 pm What user does PrimeGrid GPU run as? Does it need to run as the logged in user, or can an unprivileged daemon access the GPU?
The user is listed as "boinc_project" in Activity Monitor, not the logged in user.
MacGyver
Posts: 24
Joined: Sat Jan 04, 2020 10:50 am

Re: Running a GPU WU on a Mac Studio

Post by MacGyver »

Any updates to native Apple Silicon Support for CPU folding? Is the new client still being worked on? M2 Mac Studio on Rosetta 2 pumping out 500k PPD currently...
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Running a GPU WU on a Mac Studio

Post by Joe_H »

If you meant GPU folding which this topic is about, no updates. As for CPU folding the current CPU folding core is Apple native code, not Intel running under Rosetta 2. Development on the v7 client has ended, it never received an Apple native release. But the client uses little CPU time, so that is not an issue. The v8 public Beta client is native and uses the same CPU folding cores as v7. So on your system if you check in Activity Monitor you should see the CPU folding core is listed as "Apple", not "Intel", for kind of processing. That is where almost all of the CPU usage by F@h will be.

I have a M1 Max Mac Studio putting out about 260K for PPD using 6 cores, keep the rest available for my usage in other apps.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
MacGyver
Posts: 24
Joined: Sat Jan 04, 2020 10:50 am

Re: Running a GPU WU on a Mac Studio

Post by MacGyver »

Thank you very much for your kind reply, @Joe_H!

As I'm new on Mac, I still have to learn how things work in detail. However, it at least seams to me as if FahCore_a8 uses x86-Code (Intel/AMD), which has to be translated via Rosetta 2 for macOS on Apple Silicon. Here a snippet from the process analysis:

Code: Select all

Analysis of sampling FahCore_a8 (pid 4760) every 1 millisecond
Process:         FahCore_a8 [4760]
Path:            /Library/Application Support/FAHClient/*/FahCore_a8
Load Address:    0x1028a7000
Identifier:      FahCore_a8
Version:         ???
Code Type:       X86-64 (translated)
Platform:        macOS
Parent Process:  FAHCoreWrapper [4759]
Do I look at the wrong process, maybe I misunderstood you?

Here is a screenshot from the process explorer:

https://www.dropbox.com/scl/fi/uazkbps0 ... jjvk6&dl=0
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Running a GPU WU on a Mac Studio

Post by Joe_H »

It looks like you are sampling the correct process, it is possible the WU specified an older version of Core_A8 than is running on my Mac Studio at the moment. Here is the same section from a sample report I just did:

Code: Select all

Analysis of sampling FahCore_a8 (pid 25594) every 1 millisecond
Process:         FahCore_a8 [25594]
Path:            /Library/Application Support/FAHClient/*/FahCore_a8
Load Address:    0x100a90000
Identifier:      FahCore_a8
Version:         0
Code Type:       ARM64
Platform:        macOS
Parent Process:  fah-client [337]
Looking at the log for the running WU, it shows version 0.0.12 of the Core_A8. The other possibility is that the client and server misidentified which core was needed for the newer M2 processor and downloaded the Intel version for macOS instead go the ARM64 one.
Post Reply