Skip to content

Commit

Permalink
move parse_version to api
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Aug 27, 2014
1 parent b7461e1 commit b615753
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@ include("api/opencl_10.jl")
include("api/opencl_11.jl")
include("api/opencl_12.jl")

function parse_version(version_string)
mg = match(r"^OpenCL ([0-9]+)\.([0-9]+) .*$", version_string)
if mg == nothing
error("Non conform version string: $(ver)")
end
return VersionNumber(int(mg.captures[1]), int(mg.captures[2]))
end

end
10 changes: 1 addition & 9 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@ function create_compute_context()
return (device, ctx, queue)
end

function opencl_version(p::Platform)
ver = p[:version]
mg = match(r"^OpenCL ([0-9]+)\.([0-9]+) .*$", ver)
if mg == nothing
error("Platform $(p[:name]) returns non conformat platform string: $(ver)")
end
return VersionNumber(int(mg.captures[1]), int(mg.captures[2]))
end

opencl_version(p::Platform) = api.parse_version(p[:version])
opencl_version(d::Device) = opencl_version(d[:platform])
opencl_version(c::Context) = opencl_version(first(devices(c)))
opencl_version(q::CmdQueue) = opencl_version(q[:context])

0 comments on commit b615753

Please sign in to comment.