Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create "Apple" GPU scheduling group #5036

Closed
pg-tern opened this issue Dec 2, 2022 · 9 comments · Fixed by #5047
Closed

Create "Apple" GPU scheduling group #5036

pg-tern opened this issue Dec 2, 2022 · 9 comments · Fixed by #5047

Comments

@pg-tern
Copy link

pg-tern commented Dec 2, 2022

Currently there are three hardcoded scheduling groups for GPUs, Nvidia, AMD, and Intel.

When a Mac requests a task for GPU, it does so as an unknown vendor and includes the full description; ie "Apple M1"

The server must know "Apple M1" as a coprocessor in order to send tasks. However, there's now an Apple M1 Max, M1 Pro, M1 Ultra, M2... with more to come. On the server side, each of these must be individually hard coded; currently 8(?) with the probability of continuous changes in the future.

If "Apple" was also a scheduling group, all Mxxxxx GPUs would be lumped together by the client as "Apple GPU" and the server would only have one "thing" to deal with. I realize this requires a change to both client and server, and would only work with those running up-to-date code on both sides, but it would be an improvement. At the least, a project could say "if you're running a Mac M3 ProUltraMaxExtreme or newer, you must use BOINC 7.22.7 or later" instead of having a list a mile long.

@davidpanderson
Copy link
Contributor

This is definitely worth doing if it's possible to run OpenCL apps on the M1 GPU.
I posted to boinc_projects asking if anyone had tried this.

@ILW8
Copy link

ILW8 commented Dec 2, 2022

At PrimeGrid, we have genefer22 built for both the M1 CPU and GPU using OpenCL. Some of us were also successful in using app_info to run the GPU version by requesting CPU tasks while swapping out the genefer22 binaries.
We've done some benchmarking and found that an M1 Ultra (48 GPU cores version) is faster than a 3060 while the base M2 is similar in speed to a 1060Ti. In both cases, the Apple silicon SoCs were drawing significantly less power than their NVidia counterparts.

@davidpanderson
Copy link
Contributor

Nice! When you run BOINC on an M1 Ultra, does it detect the GPU as an OpenCL device? (I don't have a Mac to test on).

@ILW8
Copy link

ILW8 commented Dec 2, 2022

It does! See this host http://www.primegrid.com/show_host_detail.php?hostid=1143842

In the boinc logs, we see something along the lines of
Thu 1 Dec 20:12:30 2022 | | OpenCL: Apple M2 0: Apple M2 (driver version 1.2 1.0, device version OpenCL 1.2, 10923MB, 10923MB available, 10 GFLOPS peak)
(this is on my M2, not the same as the M1 Ultra host linked above)

@davidpanderson
Copy link
Contributor

It looks like we can handle this exactly like Intel GPUs. @CharlieFenton, I'm happy to do this unless you want to.

@CharlieFenton
Copy link
Contributor

@davidpanderson Please go ahead and take care of it. BOINC reports my M1 GPU as:

Thu Dec 1 04:12:03 2022 | | OpenCL: Apple M1 0: Apple M1 (driver version 1.2 1.0, device version OpenCL 1.2, 10923MB, 10923MB available, 8 GFLOPS peak)

This computer has 16GB RAM. It appears the 10923MB, 10923MB available implies that the GPU uses the system's RAM.

@ILW8
Copy link

ILW8 commented Dec 3, 2022

You're right, the Apple Silicon SoCs uses a unified memory architecture where both CPU and GPU use the same RAM

@davidpanderson
Copy link
Contributor

Do scheduler requests request work for the M1 GPU?
If so, what vendor name do they have?

If so, maybe no client changes are needed
(and maybe we don't need the COPROC_INTEL class)

@ILW8
Copy link

ILW8 commented Dec 5, 2022

The coproc section in a scheduler request looks like this:

<coproc>
   <type>Apple M2</type>
   <count>1</count>
   <peak_flops>10485760000.000000</peak_flops>
   <req_secs>1.000000</req_secs>
   <req_instances>1.000000</req_instances>
   <estimated_delay>0.000000</estimated_delay>
   <coproc_opencl>
      <name>Apple M2</name>
      <vendor>Apple</vendor>
      <vendor_id>16940800</vendor_id>
      <available>1</available>
      <half_fp_config>0</half_fp_config>
      <single_fp_config>190</single_fp_config>
      <double_fp_config>0</double_fp_config>
      <endian_little>1</endian_little>
      <execution_capabilities>1</execution_capabilities>
      <extensions>cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images</extensions>
      <global_mem_size>11453251584</global_mem_size>
      <local_mem_size>32768</local_mem_size>
      <max_clock_frequency>1000</max_clock_frequency>
      <max_compute_units>10</max_compute_units>
      <nv_compute_capability_major>0</nv_compute_capability_major>
      <nv_compute_capability_minor>0</nv_compute_capability_minor>
      <amd_simd_per_compute_unit>0</amd_simd_per_compute_unit>
      <amd_simd_width>0</amd_simd_width>
      <amd_simd_instruction_width>0</amd_simd_instruction_width>
      <opencl_platform_version>OpenCL 1.2 (Sep 30 2022 01:38:14)</opencl_platform_version>
      <opencl_device_version>OpenCL 1.2</opencl_device_version>
      <opencl_driver_version>1.2 1.0</opencl_driver_version>
   </coproc_opencl>
</coproc>

and the event log show this when requesting work:

Mon  5 Dec 04:55:58 2022 | CompositeGrid | Requesting new tasks for CPU and Apple M2

To answer your questions, yes... maybe. I think GPU work is being requested and that the vendor name is Apple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants