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

Tegra support with artifacts #2374

Merged
merged 2 commits into from
May 15, 2024
Merged
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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Adapt = "4"
BFloat16s = "0.2, 0.3, 0.4, 0.5"
CEnum = "0.2, 0.3, 0.4, 0.5"
CUDA_Driver_jll = "0.8"
CUDA_Runtime_Discovery = "0.2"
CUDA_Runtime_jll = "0.12"
CUDA_Runtime_Discovery = "0.2, 0.3"
CUDA_Runtime_jll = "0.12, 0.13"
ChainRulesCore = "1"
Crayons = "4"
DataFrames = "1"
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ kernels in Julia, and wrappers for various CUDA libraries.

The latest development version of CUDA.jl requires **Julia 1.8** or higher. If you are using
an older version of Julia, you need to use a previous version of CUDA.jl. This will happen
automatically when you install the package using Julia's package manager.

Note that CUDA.jl may not work with a custom build of Julia; it is recommended that you
install Julia using the [official binaries](https://julialang.org/downloads/) or
[juliaup](https://github.com/JuliaLang/juliaup).

CUDA.jl currently also requires a CUDA-capable GPU with **compute capability 3.5** (Kepler)
or higher, and an accompanying NVIDIA driver with support for **CUDA 11.0** or newer. These
requirements are not enforced by the Julia package manager when installing CUDA.jl.
Depending on your system and GPU, you may need to install an older version of the package:
automatically when you install the package using Julia's package manager.

Note that CUDA.jl may not work with a custom build of Julia; it is recommended that you
install Julia using the [official binaries](https://julialang.org/downloads/) or
[juliaup](https://github.com/JuliaLang/juliaup).

CUDA.jl also requires a CUDA-capable GPU with **compute capability 3.5** (Kepler) or
higher, and an accompanying **NVIDIA driver for CUDA 11.0** or newer. A compatible CUDA
toolkit will be downloaded automatically, but in case you want to use your own, CUDA.jl only
supports **CUDA toolkit 11.4+** or newer. These requirements are not enforced by the Julia
package manager when installing CUDA.jl. Depending on your system and GPU, you may need to
install an older version of the package:

* CUDA.jl v4.4 is the last version with support for CUDA 11.0-11.3 (deprecated in v5.0)
* CUDA.jl v4.0 is the last version to work with CUDA 10.2 (removed in v4.1)
Expand Down
2 changes: 1 addition & 1 deletion lib/cudnn/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ CUDNN_jll = "62b44479-cb7b-5706-934f-f13b2eb2e645"
[compat]
CEnum = "0.2, 0.3, 0.4, 0.5"
CUDA = "~5.4"
CUDA_Runtime_Discovery = "0.2"
CUDA_Runtime_Discovery = "0.2, 0.3"
CUDNN_jll = "~9.0"
julia = "1.8"
2 changes: 1 addition & 1 deletion lib/custatevec/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ cuQuantum_jll = "b75408ef-6fdf-5d74-b65a-7df000ad18e6"
[compat]
CEnum = "0.2, 0.3, 0.4, 0.5"
CUDA = "~5.4"
CUDA_Runtime_Discovery = "0.2"
CUDA_Runtime_Discovery = "0.2, 0.3"
cuQuantum_jll = "~24.03"
julia = "1.8"
2 changes: 1 addition & 1 deletion lib/cutensor/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[compat]
CEnum = "0.2, 0.3, 0.4, 0.5"
CUDA = "~5.4"
CUDA_Runtime_Discovery = "0.2"
CUDA_Runtime_Discovery = "0.2, 0.3"
CUTENSOR_jll = "~2.0"
LinearAlgebra = "1"
julia = "1.8"
2 changes: 1 addition & 1 deletion lib/cutensornet/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
[compat]
CEnum = "0.2, 0.3, 0.4, 0.5"
CUDA = "~5.4"
CUDA_Runtime_Discovery = "0.2"
CUDA_Runtime_Discovery = "0.2, 0.3"
cuQuantum_jll = "~24.3"
cuTENSOR = "2"
julia = "1.8"
Expand Down
2 changes: 2 additions & 0 deletions src/compatibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const cuda_ptx_db = Dict(
v"8.0" => between(v"12.0", highest),
v"8.1" => between(v"12.1", highest),
v"8.2" => between(v"12.2", highest),
v"8.3" => between(v"12.3", highest),
v"8.4" => between(v"12.4", highest),
)

function cuda_ptx_support(ver::VersionNumber)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/compilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ end

# determine the compute capabilities to use. this should match the capability of the
# current device, but if LLVM doesn't support it, we can target an older capability
# and pass a different `-arch` to `ptxa`.
# and pass a different `-arch` to `ptxas`.
ptx_support = ptx_compat(cuda_ptx)
requested_cap = something(cap, min(capability(dev), maximum(ptx_support.cap)))
llvm_caps = filter(<=(requested_cap), llvm_support.cap)
Expand Down
7 changes: 0 additions & 7 deletions src/initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ function __init__()
Ensure that you have not set the LD_LIBRARY_PATH environment variable, or that it does not contain paths to CUDA libraries."""
end
end

# warn about Tegra being incompatible with our artifacts
if is_tegra()
@warn """You are using a Tegra device, which is currently not supported by the CUDA.jl artifacts.
Please install the CUDA toolkit, and call `CUDA.set_runtime_version!(local_toolkit=true)`.
For more information, see JuliaGPU/CUDA.jl#1978."""
end
end

_initialized[] = true
Expand Down
24 changes: 0 additions & 24 deletions src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,3 @@ function versioninfo(io::IO=stdout)
println(io, " $(i-1): $str (sm_$(cap.major)$(cap.minor), $(Base.format_bytes(mem.free)) / $(Base.format_bytes(mem.total)) available)")
end
end

# this helper function encodes options for compute-sanitizer useful with Julia applications
function compute_sanitizer_cmd(tool::String="memcheck")
sanitizer = CUDA.compute_sanitizer()
cmd = `$sanitizer --tool $tool --launch-timeout=0 --target-processes=all --report-api-errors=no`
if runtime_version() >= v"12.3" &&
attribute(device(), DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS) == 1
cmd = `$cmd --hmm-support`
end
cmd
end

"""
run_compute_sanitizer([julia_args=``]; [tool="memcheck", sanitizer_args=``])

Run a new Julia session under the CUDA compute-sanitizer tool `tool`. This is useful to
detect various GPU-related issues, like memory errors or race conditions.
"""
function run_compute_sanitizer(julia_args=``; tool::String="memcheck", sanitizer_args=``)
cmd = `$(Base.julia_cmd()) --project=$(Base.active_project())`

println("Re-starting your active Julia session...")
run(`$(CUDA.compute_sanitizer_cmd(tool)) $sanitizer_args $cmd $julia_args`)
end
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
23 changes: 22 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ if first(gpus).compute_mode == CUDA.CU_COMPUTEMODE_EXCLUSIVE_PROCESS
jobs = 1
end

# install compute sanitizer
if do_sanitize
# install CUDA_SDK_jll in a temporary environment
using Pkg
project = Base.active_project()
Pkg.activate(; temp=true)
Pkg.add("CUDA_SDK_jll")
using CUDA_SDK_jll
Pkg.activate(project)

compute_sanitizer = joinpath(CUDA_SDK_jll.artifact_dir, "cuda/compute-sanitizer/compute-sanitizer")
if Sys.iswindows()
compute_sanitizer *= ".exe"
end
@info "Running under " * read(`$compute_sanitizer --version`, String)
end

# add workers
const test_exeflags = Base.julia_cmd()
filter!(test_exeflags.exec) do c
Expand All @@ -183,7 +200,11 @@ push!(test_exeflags.exec, "--project=$(Base.active_project())")
const test_exename = popfirst!(test_exeflags.exec)
function addworker(X; kwargs...)
exename = if do_sanitize
`$(CUDA.compute_sanitizer_cmd(sanitize_tool)) $test_exename`
```$compute_sanitizer --tool $sanitize_tool
--launch-timeout=0
--target-processes=all
--report-api-errors=no
$test_exename```
else
test_exename
end
Expand Down