-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced artifacts with JLL artifacts
Using extended platform selection based on platform augmentation tags, i.e. https://pkgdocs.julialang.org/v1.7/artifacts/#Extending-Platform-Selection - adapted for use with JLL Artifacts.
- Loading branch information
Showing
7 changed files
with
92 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Libdl, Base.BinaryPlatforms | ||
|
||
function augment_platform!(p::Platform, tag::Union{String,Nothing} = nothing) | ||
if tag === nothing | ||
return p | ||
end | ||
|
||
if tag === "cuda" | ||
# If this platform object already has a `cuda` tag set, don't augment | ||
if haskey(p, "cuda") | ||
return p | ||
end | ||
|
||
# Open libcuda explicitly, so it gets `dlclose()`'ed after we're done | ||
try | ||
dlopen("libcuda") do lib | ||
# find symbol to ask for driver version; if we can't find it, just silently continue | ||
cuDriverGetVersion = dlsym(lib, "cuDriverGetVersion"; throw_error=false) | ||
if cuDriverGetVersion !== nothing | ||
# Interrogate CUDA driver for driver version: | ||
driverVersion = Ref{Cint}() | ||
ccall(cuDriverGetVersion, UInt32, (Ptr{Cint},), driverVersion) | ||
|
||
# Store only the major version | ||
p["cuda"] = div(driverVersion, 1000) | ||
end | ||
end | ||
catch | ||
end | ||
|
||
# Return possibly-altered `Platform` object | ||
return p | ||
else | ||
@warn "Unexpected tag: $tag" | ||
return p | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using TOML, Artifacts, Base.BinaryPlatforms | ||
|
||
import ONNXRuntime_jll | ||
|
||
include("platform_augmentation.jl") | ||
|
||
artifacts_toml = Artifacts.find_artifacts_toml(pathof(ONNXRuntime_jll)) | ||
|
||
# Get "target triplet" from ARGS, if given (defaulting to the host triplet otherwise) | ||
target_triplet = get(ARGS, 1, Base.BinaryPlatforms.host_triplet()) | ||
|
||
# Augment this platform object with any special tags we require | ||
platform = augment_platform!(HostPlatform(parse(Platform, target_triplet))) | ||
|
||
# Select all downloadable artifacts that match that platform | ||
artifacts = select_downloadable_artifacts(artifacts_toml; platform) | ||
|
||
# Output the result to `stdout` as a TOML dictionary | ||
TOML.print(stdout, artifacts) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters