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

Use the platform OpenCL library on Apple. #221

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions lib/api.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import OpenCL_jll

const libopencl = OpenCL_jll.libopencl
const libopencl = if Sys.isapple()
"/System/Library/Frameworks/OpenCL.framework/OpenCL"
else
import OpenCL_jll
OpenCL_jll.libopencl
end

"""
@checked function foo(...)
Expand Down Expand Up @@ -76,6 +79,8 @@ const initialized = Ref{Bool}(false)
@noinline function initialize()
initialized[] = true

Sys.isapple() && return

if isempty(OpenCL_jll.drivers)
@warn """No OpenCL driver JLLs were detected at the time of the first call into OpenCL.jl.
Only system drivers will be available."""
Expand All @@ -96,7 +101,9 @@ const initialized = Ref{Bool}(false)
end

function __init__()
if !OpenCL_jll.is_available()
if Sys.isapple()
@warn "on macOS, OpenCL.jl uses the system OpenCL framework, which is deprecated."
elseif !OpenCL_jll.is_available()
@error "OpenCL_jll is not available for your platform, OpenCL.jl. will not work."
end
end
Expand Down
6 changes: 5 additions & 1 deletion src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ function versioninfo(io::IO=stdout)

println(io, "Toolchain:")
println(io, " - Julia v$(VERSION)")
for pkg in [cl.OpenCL_jll]
pkgs = []
if !Sys.isapple()
push!(pkgs, OpenCL_jll)
end
for pkg in pkgs
println(io, " - $(string(pkg)) v$(pkgversion(pkg))")
end
println(io)
Expand Down
Loading