Metal

Metal programming in Julia

https://github.com/juliagpu/metal.jl

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 24 committers (4.2%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords

apple-gpu apple-silicon gpu hacktoberfest julia mac metal-framework

Keywords from Contributors

julialang julia-package climate-change matrix-exponential pdes primitives automatic-differentiation ocean climate heterogeneous-parallel-programming
Last synced: 6 months ago · JSON representation ·

Repository

Metal programming in Julia

Basic Info
  • Host: GitHub
  • Owner: JuliaGPU
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Homepage:
  • Size: 10.5 MB
Statistics
  • Stars: 409
  • Watchers: 14
  • Forks: 47
  • Open Issues: 73
  • Releases: 25
Topics
apple-gpu apple-silicon gpu hacktoberfest julia mac metal-framework
Created almost 6 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

Metal.jl

Metal programming in Julia

With Metal.jl it's possible to program GPUs on macOS using the Metal programming framework.

The package is a work-in-progress. There are bugs, functionality is missing, and performance hasn't been optimized. Expect to have to make changes to this package if you want to use it. PRs are very welcome!

Requirements

  • Mac device with M-series chip
  • Julia 1.10-1.11
  • macOS 13-15

These requirements are fairly strict, and are due to our limited development resources (manpower, hardware). Supported OS versions follow Apple's support, which is typically the three latest major verions.

Quick start

Metal.jl can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add Metal

Or, equivalently, via the Pkg API:

julia-repl julia> import Pkg; Pkg.add("Metal")

For an overview of the toolchain in use, you can run the following command after importing the package:

```julia-repl julia> using Metal

julia> Metal.versioninfo() macOS 15.5.0, Darwin 24.5.0

Toolchain: - Julia: 1.11.6 - LLVM: 16.0.6

Julia packages: - Metal.jl: 1.6.3 - GPUArrays: 11.2.3 - GPUCompiler: 1.6.1 - KernelAbstractions: 0.9.37 - ObjectiveC: 3.4.2 - LLVM: 9.4.2 - LLVMDowngrader_jll: 0.6.0+1

1 device: - Apple M2 Max (64.000 KiB allocated) ```

Array abstraction

The easiest way to work with Metal.jl, is by using its array abstraction. The MtlArray type is both meant to be a convenient container for device memory, as well as provide a data-parallel abstraction for using the GPU without writing your own kernels:

```julia-repl julia> a = MtlArray([1]) 1-element MtlVector{Int64, Metal.PrivateStorage}: 1

julia> a .+ 1 1-element MtlVector{Int64, Metal.PrivateStorage}: 2 ```

Kernel programming

The above array abstractions are all implemented using Metal kernels written in Julia. These kernels follow a similar programming style to Julia's other GPU back-ends, and with that deviate from how kernels are implemented in Metal C (i.e., indexing intrinsics are functions not arguments, arbitrary aggregate arguments are supported, etc):

```julia-repl julia> function vadd(a, b, c) i = threadpositioningrid1d() c[i] = a[i] + b[i] return end vadd (generic function with 1 method)

julia> a = MtlArray([1,1,1,1]); b = MtlArray([2,2,2,2]); c = similar(a);

julia> @metal threads=2 groups=2 vadd(a, b, c);

julia> Array(c) 4-element Vector{Int64}: 3 3 3 3 ```

Metal API wrapper

Finally, all of the above functionality is made possible by interfacing with the Metal libraries through ObjectiveC.jl. We provide low-level objects and functions that map These low-level API wrappers, along with some slightly higher-level Julia wrappers, are available in the MTL submodule exported by Metal.jl:

```julia-repl julia> using Metal

julia> dev = device() name = Apple M1 Pro

julia> dev.name NSString("Apple M1 Pro") ```

Acknowledgements

This package builds upon the experience of several Julia contributors to CUDA.jl, AMDGPU.jl and oneAPI.jl.

Owner

  • Name: JuliaGPU
  • Login: JuliaGPU
  • Kind: organization

GPU Computing in Julia

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Besard
    given-names: Tim
    orcid: https://orcid.org/0000-0001-7826-8021
  - family-names: Hawkins
    given-names: Max
copyright: "© 2022 Julia Computing, and other contributors"
title: "Metal.jl"
version: 0.1.2
doi: 10.5281/zenodo.7139374
date-released: 2022-10-03
url: "https://github.com/JuliaGPU/Metal.jl"

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 704
  • Total Committers: 24
  • Avg Commits per committer: 29.333
  • Development Distribution Score (DDS): 0.506
Past Year
  • Commits: 170
  • Committers: 10
  • Avg Commits per committer: 17.0
  • Development Distribution Score (DDS): 0.441
Top Committers
Name Email Commits
Tim Besard t****d@g****m 348
Christian Guinard 2****d 137
Max Hawkins m****5@g****m 66
github-actions[bot] 4****] 53
Filippo Vicentini f****i@g****m 29
Tim Gymnich t****h@i****m 21
Max Ng m****f@g****m 10
chengchingwen c****4@g****m 7
Viral B. Shah V****h 7
Nehal Patel 1****m 5
dependabot[bot] 4****] 4
Daniel Karrasch d****h@p****e 4
Matt Fishman m****n 2
CompatHelper Julia c****y@j****g 1
Alexis 3****n 1
Anshul Singhvi a****i@g****m 1
Enrique de la Calle k****a@g****m 1
Fergus Baker f****r@g****m 1
Hendrik Ranocha r****a 1
Pietro Monticone 3****e 1
Sotiris Lamprinidis s****r@g****m 1
Valentin Churavy v****y 1
Zhen Wu z****u@m****u 1
atharva 6****w 1
Committer Domains (Top 20 + Academic)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 383 total
  • Total dependent packages: 2
  • Total dependent repositories: 0
  • Total versions: 25
juliahub.com: Metal

Metal programming in Julia

  • Versions: 25
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 383 Total
Rankings
Stargazers count: 3.1%
Forks count: 9.8%
Dependent repos count: 9.9%
Average: 15.4%
Dependent packages count: 38.9%
Last synced: 6 months ago

Dependencies

.github/workflows/CompatHelper.yml actions
  • actions/checkout v3 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite