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

Support Metal as device #108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support Metal as device #108

wants to merge 1 commit into from

Conversation

haakon-e
Copy link
Member

@haakon-e haakon-e commented Mar 13, 2025

Purpose

This is a speculative PR for adding Metal as a supported device type.
Merging this PR is not useful for simulations that depend on ClimaCore, since that package currently only supports CUDA. But, other packages like CloudMicrophysics may enjoy local GPU-enabled development without the need for an external server-based GPU. The broader Julia ecosystem may also enjoy this contribution, as this package is useful for non-CliMA projects too.

Content

  • Added ClimaCommsMetalExt extension that largely mirrors the ClimaCommsCUDAExt extension.
  • updated docs, including README.md, apis.md, faqs.md, index.md, internals.md, with description of the proposed Metal support.
  • Added MetalDevice struct, and extended methods like device_type and device to make use of it.
  • Added metal_ext_is_loaded and metal_is_required to look for Metal support, and extended the @import_required_backends macro to load Metal when applicable.
  • Updated tests, including:
    • arrays in hygiene.jl are now all Float32, which is required for Metal
    • runtests.jl is successful on Metal, but only Float32 is tested. Any Float64 tests are skipped.
  • Added test_cuda.jl and test_metal.jl for convenient execution of tests on the respective devices. Can remove these files if not desired.
    • Note: test_metal.jl is useful for manual testing since, as far as I know, we don't have easy access to a remote test server with a Metal-compatible GPU. Given this, it may be useful to label Metal support as "experimental" or "untested" or similar.

  • I have read and checked the items on the review checklist.

@haakon-e haakon-e requested review from Sbozzolo, dennisYatunin and charleskawczynski and removed request for Sbozzolo March 13, 2025 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant