oneAPI

Julia support for the oneAPI programming toolkit.

https://github.com/juliagpu/oneapi.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 18 committers (5.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.2%) to scientific vocabulary

Keywords

gpu hacktoberfest julia oneapi

Keywords from Contributors

numeric apple-gpu apple-silicon julialang mac metal-framework programming-language pde interface neural-sde
Last synced: 6 months ago · JSON representation ·

Repository

Julia support for the oneAPI programming toolkit.

Basic Info
Statistics
  • Stars: 198
  • Watchers: 11
  • Forks: 28
  • Open Issues: 41
  • Releases: 33
Topics
gpu hacktoberfest julia oneapi
Created almost 6 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

oneAPI.jl

Julia support for the oneAPI programming toolkit.

oneAPI.jl provides support for working with the oneAPI unified programming model. The package is verified to work with the (currently) only implementation of this interface that is part of the Intel Compute Runtime, only available on Linux. Windows support is experimental.

Status

oneAPI.jl is looking for contributors and/or a maintainer. Reach out if you can help!

The current version of oneAPI.jl supports most of the oneAPI Level Zero interface, has good kernel programming capabilties, and as a demonstration of that it fully implements the GPUArrays.jl array interfaces. This results in a full-featured GPU array type.

However, the package has not been extensively tested, and performance issues might be present. The integration with vendor libraries like oneMKL or oneDNN is still in development, and as result certain array operations may be unavailable or slow.

Quick start

You need to use Julia 1.8 or higher, and it is strongly advised to use the official binaries. For now, only Linux is supported. On Windows, you need to use the second generation Windows Subsystem for Linux (WSL2). If you're using Intel Arc GPUs (A580, A750, A770, etc), you need to use at least Linux 6.2. For other hardware, any recent Linux distribution should work.

Once you have installed Julia, proceed by entering the package manager REPL mode by pressing ] and adding theoneAPI package:

pkg> add oneAPI

This installation will take a couple of minutes to download necessary binaries, such as the oneAPI loader, several SPIR-V tools, etc. For now, the oneAPI.jl package also depends on the Intel implementation of the oneAPI spec. That means you need compatible hardware; refer to the Intel documentation for more details.

Once you have oneAPI.jl installed, perform a smoke test by calling the versioninfo() function:

```julia julia> using oneAPI

julia> oneAPI.versioninfo() Binary dependencies: - NEO: 24.26.30049+0 - libigc: 1.0.17193+0 - gmmlib: 22.3.20+0 - SPIRVLLVMTranslator: 20.1.0+1 - SPIRV_Tools: 2025.1.0+1

Toolchain: - Julia: 1.11.5 - LLVM: 16.0.6

1 driver: - 00000000-0000-0000-173d-d94201036013 (v1.3.24595, API v1.3.0)

2 devices: - Intel(R) Graphics [0x56a0] - Intel(R) HD Graphics P630 [0x591d] ```

If you have multiple compatible drivers or devices, use the driver! and device! functions to configure which one to use in the current task:

```julia julia> devices() ZeDevice iterator for 2 devices: 1. Intel(R) Graphics [0x56a0] 2. Intel(R) HD Graphics P630 [0x591d]

julia> device() ZeDevice(GPU, vendor 0x8086, device 0x56a0): Intel(R) Graphics [0x56a0]

julia> device!(2) ZeDevice(GPU, vendor 0x8086, device 0x591d): Intel(R) HD Graphics P630 [0x591d] ```

To ensure other functionality works as expected, you can run the test suite from the package manager REPL mode. Note that this will pull and run the test suite for GPUArrays, which takes quite some time:

``` pkg> test oneAPI ... Testing finished in 16 minutes, 27 seconds, 506 milliseconds

Test Summary: | Pass Total Time Overall | 4945 4945 SUCCESS Testing oneAPI tests passed ```

Usage

The functionality of oneAPI.jl is organized as follows:

  • low-level wrappers for the Level Zero library
  • kernel programming capabilities
  • abstractions for high-level array programming

The level zero wrappers are available in the oneL0 submodule, and expose all flexibility of the underlying APIs with user-friendly wrappers:

```julia julia> using oneAPI, oneAPI.oneL0

julia> drv = first(drivers());

julia> ctx = ZeContext(drv);

julia> dev = first(devices(drv)) ZeDevice(GPU, vendor 0x8086, device 0x1912): Intel(R) Gen9

julia> compute_properties(dev) (maxTotalGroupSize = 256, maxGroupSizeX = 256, maxGroupSizeY = 256, maxGroupSizeZ = 256, maxGroupCountX = 4294967295, maxGroupCountY = 4294967295, maxGroupCountZ = 4294967295, maxSharedLocalMemory = 65536, subGroupSizes = (8, 16, 32))

julia> queue = ZeCommandQueue(ctx, dev);

julia> execute!(queue) do list append_barrier!(list) end ```

Built on top of that, are kernel programming capabilities for executing Julia code on oneAPI accelerators. For now, we reuse OpenCL intrinsics, and compile to SPIR-V using Khronos' translator:

```julia julia> function kernel() barrier() return end

julia> @oneapi items=1 kernel() ```

Code reflection macros are available to see the generated code:

julia julia> @device_code_llvm @oneapi items=1 kernel()

llvm ; @ REPL[18]:1 within `kernel' define dso_local spir_kernel void @_Z17julia_kernel_3053() local_unnamed_addr { top: ; @ REPL[18]:2 within `kernel' ; ┌ @ oneAPI.jl/src/device/opencl/synchronization.jl:9 within `barrier' @ oneAPI.jl/src/device/opencl/synchronization.jl:9 ; │┌ @ oneAPI.jl/src/device/opencl/utils.jl:34 within `macro expansion' call void @_Z7barrierj(i32 0) ; └└ ; @ REPL[18]:3 within `kernel' ret void }

julia julia> @device_code_spirv @oneapi items=1 kernel()

```spirv ; SPIR-V ; Version: 1.0 ; Generator: Khronos LLVM/SPIR-V Translator; 14 ; Bound: 9 ; Schema: 0 OpCapability Addresses OpCapability Kernel %1 = OpExtInstImport "OpenCL.std" OpMemoryModel Physical64 OpenCL OpEntryPoint Kernel %4 "Z17juliakernel3067" OpSource OpenCLC 200000 OpName %top "top" %uint = OpTypeInt 32 0 %uint2 = OpConstant %uint 2 %uint0 = OpConstant %uint 0 %void = OpTypeVoid %3 = OpTypeFunction %void %4 = OpFunction %void None %3 %top = OpLabel OpControlBarrier %uint2 %uint2 %uint_0 OpReturn OpFunctionEnd

```

Finally, the oneArray type makes it possible to use your oneAPI accelerator without the need to write custom kernels, thanks to Julia's high-level array abstractions:

```julia julia> a = oneArray(rand(Float32, 2,2)) 2×2 oneArray{Float32,2}: 0.592979 0.996154 0.874364 0.232854

julia> a .+ 1 2×2 oneArray{Float32,2}: 1.59298 1.99615 1.87436 1.23285 ```

Float64 support

Not all oneAPI GPUs support Float64 datatypes. You can test if your GPU does using the following code:

julia julia> using oneAPI julia> oneL0.module_properties(device()).fp64flags & oneL0.ZE_DEVICE_MODULE_FLAG_FP64 == oneL0.ZE_DEVICE_MODULE_FLAG_FP64 false

If your GPU doesn't, executing code that relies on Float64 values will result in an error:

julia julia> oneArray([1.]) .+ 1 ┌ Error: Module compilation failed: │ │ error: Double type is not supported on this platform.

Development

To work on oneAPI.jl, you just need to dev the package. In addition, you may need to build the binary support library that's used to interface with oneMKL and other C++ vendor libraries. This library is normally provided by the oneAPISupportjll.jl package, however, we only guarantee to update this package when releasing oneAPI.jl. You can build this library yourself by simply executing deps/build_local.jl.

To facilitate development, there are other things you may want to configure:

Enabling the oneAPI validation layer

The oneAPI Level Zero libraries feature a so-called validation layer, which validates the arguments to API calls. This can be useful to spot potential isssues, and can be enabled by setting the following environment variables:

  • ZE_ENABLE_VALIDATION_LAYER=1
  • ZE_ENABLE_PARAMETER_VALIDATION=1
  • EnableDebugBreak=0 (this is needed to work around intel/compute-runtime#639)

Using a debug toolchain

If you're experiencing an issue with the underlying toolchain (NEO, IGC, etc), you may want to use a debug build of these components, which also perform additional validation. This can be done simply by calling oneAPI.set_debug!(true) and restarting your Julia session. This sets a preference used by the respective JLL packages.

Using a local toolchain

To further debug the toolchain, you may need a custom build and point oneAPI.jl towards it. This can also be done using preferences, overriding the paths to resources provided by the various JLLs that oneAPI.jl uses. A helpful script to automate this is provided in the res folder of this repository:

``` $ julia res/local.jl

Trying to find local IGC... - found libigc at /usr/local/lib/libigc.so - found libiga64 at /usr/local/lib/libiga64.so - found libigdfcl at /usr/local/lib/libigdfcl.so - found libopencl-clang at /usr/local/lib/libopencl-clang.so.11

Trying to find local gmmlib... - found libigdgmm at /usr/local/lib/libigdgmm.so

Trying to find local NEO... - found libzeintelgpu.so.1 at /usr/local/lib/libzeintelgpu.so.1 - found libigdrcl at /usr/local/lib/intel-opencl/libigdrcl.so

Trying to find local oneAPI loader... - found libzeloader at /lib/x8664-linux-gnu/libzeloader.so - found libzevalidationlayer at /lib/x8664-linux-gnu/libzevalidationlayer.so

Writing preferences... ```

The discovered paths will be written to a global file with preferences, typically $HOME/.julia/environments/vX.Y/LocalPreferences.toml (where vX.Y refers to the Julia version you are using). You can modify this file, or remove it when you want to revert to default set of binaries.

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
copyright: "© 2022 Julia Computing, and other contributors"
title: "oneAPI.jl"
version: 0.3.0
doi: 10.5281/zenodo.7139359
date-released: 2022-10-03
url: "https://github.com/JuliaGPU/oneAPI.jl"

GitHub Events

Total
  • Create event: 27
  • Commit comment event: 12
  • Release event: 5
  • Issues event: 15
  • Watch event: 20
  • Delete event: 18
  • Issue comment event: 82
  • Push event: 51
  • Pull request review event: 11
  • Pull request review comment event: 7
  • Pull request event: 55
  • Fork event: 4
Last Year
  • Create event: 27
  • Commit comment event: 12
  • Release event: 5
  • Issues event: 15
  • Watch event: 20
  • Delete event: 18
  • Issue comment event: 82
  • Push event: 51
  • Pull request review event: 11
  • Pull request review comment event: 7
  • Pull request event: 55
  • Fork event: 4

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 676
  • Total Committers: 18
  • Avg Commits per committer: 37.556
  • Development Distribution Score (DDS): 0.297
Past Year
  • Commits: 58
  • Committers: 7
  • Avg Commits per committer: 8.286
  • Development Distribution Score (DDS): 0.276
Top Committers
Name Email Commits
Tim Besard t****d@g****m 475
github-actions[bot] 4****] 120
Alexis Montoison a****n@p****a 33
kballeda k****a@i****m 16
Peng Tu p****u@i****m 7
Sarbojit2019 s****r@g****m 4
dependabot[bot] 4****] 4
Daniel Karrasch d****h@p****e 3
Tim Gymnich t****h@i****m 3
Christian Guinard 2****d 2
Gnimuc q****i@g****m 2
Hendrik Ranocha r****a 1
Jerry Ling p****n@j****v 1
KALI UDAY BALLEDA 1****l 1
Matt Fishman m****n 1
Mosè Giordano m****o@u****k 1
Troels Nielsen b****s@g****m 1
Valentin Churavy v****y 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 82
  • Total pull requests: 288
  • Average time to close issues: 4 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 35
  • Total pull request authors: 17
  • Average comments per issue: 3.09
  • Average comments per pull request: 1.52
  • Merged pull requests: 238
  • Bot issues: 0
  • Bot pull requests: 77
Past Year
  • Issues: 15
  • Pull requests: 58
  • Average time to close issues: 8 days
  • Average time to close pull requests: about 22 hours
  • Issue authors: 11
  • Pull request authors: 8
  • Average comments per issue: 0.93
  • Average comments per pull request: 1.05
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 9
Top Authors
Issue Authors
  • maleadt (25)
  • kballeda (9)
  • amontoison (5)
  • michel2323 (4)
  • BenjaminRemez (3)
  • jinz2014 (3)
  • pvillacorta (2)
  • foglienimatteo (2)
  • cdsousa (1)
  • cncastillo (1)
  • rkierulf (1)
  • fredlarochelle (1)
  • rashidrafeek (1)
  • jgreener64 (1)
  • JuliaTagBot (1)
Pull Request Authors
  • maleadt (111)
  • github-actions[bot] (71)
  • amontoison (50)
  • kballeda (14)
  • pengtu (9)
  • dependabot[bot] (6)
  • tgymnich (5)
  • christiangnrd (5)
  • michel2323 (5)
  • Sarbojit2019 (5)
  • dkarrasch (4)
  • leios (2)
  • vchuravy (2)
  • mtfishman (2)
  • giordano (2)
Top Labels
Issue Labels
enhancement (11) bug (9) kernels (8) libraries (5) performance (5) upstream (3) arrays (2) speculative (2) help wanted (2) needs info (1) good first issue (1)
Pull Request Labels
enhancement (7) dependencies (6) libraries (5) bug (1) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 91 total
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 31
juliahub.com: oneAPI

Julia support for the oneAPI programming toolkit.

  • Versions: 31
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 91 Total
Rankings
Stargazers count: 5.0%
Forks count: 9.3%
Dependent repos count: 9.9%
Average: 11.8%
Dependent packages count: 23.0%
Last synced: 6 months ago

Dependencies

.github/workflows/CompatHelper.yml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/ManifestUpdater.yml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia v1 composite
  • peter-evans/create-pull-request v3 composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite