在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:JuliaGPU/oneAPI.jl开源软件地址:https://github.com/JuliaGPU/oneAPI.jl开源编程语言:Julia 99.7%开源软件介绍:oneAPI.jlJulia 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. This package is still under significant development, so expect bugs and missing features. InstallationYou need to use Julia 1.6 or higher, and it is strongly advised to use the official binaries. For now, only Linux is supported. Once you have installed Julia, proceed by entering the package manager REPL mode by pressing
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, you can perform a smoke-test using the low-level wrappers for the Level Zero library: julia> using oneAPI
julia> using oneAPI.oneL0
julia> drv = first(drivers());
julia> dev = first(devices(drv))
ZeDevice(GPU, vendor 0x8086, device 0x1912): Intel(R) Gen9 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:
UsageThe functionality of oneAPI.jl is organized as follows:
The level zero wrappers are available in the 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> function kernel()
barrier()
return
end
julia> @oneapi items=1 kernel() Code reflection macros are available to see the generated code: julia> @device_code_llvm @oneapi items=1 kernel() ; @ 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> @device_code_spirv @oneapi items=1 kernel()
Finally, the 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 StatusThe current version of oneAPI.jl supports most of 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. There is no integration with vendor libraries like oneMKL or oneDNN, and as a result certain operations (like matrix multiplication) will be unavailable or slow. Using a local toolchainFor debugging issues with the underlying toolchain (NEO, IGC, etc), you may want the
package to use your local installation of these components instead of downloading the
prebuilt Julia binaries from Yggdrasil. This can be done using Preferences.jl, overriding
the paths to resources provided by the various JLLs that oneAPI.jl uses. A helpful script
to automate this is provided in the
The discovered paths will be written to a global file with preferences, typically
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论