From 0f26fa7474801b49669e49afa30931404e189125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Mon, 13 Jan 2025 22:11:02 +0000 Subject: [PATCH 1/5] [Reactant] Check CUDA version number in platform augmentation [skip build] --- R/Reactant/build_tarballs.jl | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/R/Reactant/build_tarballs.jl b/R/Reactant/build_tarballs.jl index daa1c1dd38e..786ede3bfc0 100644 --- a/R/Reactant/build_tarballs.jl +++ b/R/Reactant/build_tarballs.jl @@ -323,6 +323,26 @@ augment_platform_block=""" nothing end + # copied from CUDA_Runtime_jll + function cudaRuntimeGetVersion(library_handle) + function_handle = Libdl.dlsym(library_handle, "cudaRuntimeGetVersion"; throw_error=false) + if function_handle === nothing + @debug "Runtime library seems invalid (does not contain 'cudaRuntimeGetVersion')" + return nothing + end + version_ref = Ref{Cint}() + status = ccall(function_handle, Cint, (Ptr{Cint},), version_ref) + if status != 0 + @debug "Call to 'cudaRuntimeGetVersion' failed with status \$(status)" + return nothing + end + major, ver = divrem(version_ref[], 1000) + minor, patch = divrem(ver, 10) + version = VersionNumber(major, minor, patch) + @debug "Detected CUDA Runtime version \$(version)" + return version + end + function augment_platform!(platform::Platform) mode = get(ENV, "REACTANT_MODE", something(mode_preference, "opt")) @@ -348,12 +368,19 @@ augment_platform_block=""" # so that we get recompiled if the driver changes. if cuname != "" && gpu == "undecided" handle = Libdl.dlopen(cuname) + cuda_version = cuDriverGetVersion(handle) path = Libdl.dlpath(handle) Libdl.dlclose(handle) - @debug "Adding include dependency on \$path" - Base.include_dependency(path) - gpu = "cuda" + if cuda_version isa VersionNumber + if cuda_version == v"12.6" + @debug "Adding include dependency on \$path" + Base.include_dependency(path) + gpu = "cuda" + else + @debug "CUDA version \$(cuda_version) not supported with this version of Reactant" + end + end end roname = "" From 487512f1acc092b7045eca5a8a995af7827fd0c4 Mon Sep 17 00:00:00 2001 From: William Moses Date: Mon, 13 Jan 2025 16:56:32 -0600 Subject: [PATCH 2/5] Update build_tarballs.jl --- R/Reactant/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Reactant/build_tarballs.jl b/R/Reactant/build_tarballs.jl index 786ede3bfc0..944e6d3f976 100644 --- a/R/Reactant/build_tarballs.jl +++ b/R/Reactant/build_tarballs.jl @@ -373,7 +373,7 @@ augment_platform_block=""" Libdl.dlclose(handle) if cuda_version isa VersionNumber - if cuda_version == v"12.6" + if cuda_version >= v"12.6" @debug "Adding include dependency on \$path" Base.include_dependency(path) gpu = "cuda" From f743a6e2414add87efba30658b5cb0b859141086 Mon Sep 17 00:00:00 2001 From: William Moses Date: Tue, 14 Jan 2025 23:11:38 -0600 Subject: [PATCH 3/5] Update build_tarballs.jl --- R/Reactant/build_tarballs.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/Reactant/build_tarballs.jl b/R/Reactant/build_tarballs.jl index 944e6d3f976..0842f50a050 100644 --- a/R/Reactant/build_tarballs.jl +++ b/R/Reactant/build_tarballs.jl @@ -6,10 +6,10 @@ include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl")) name = "Reactant" repo = "https://github.com/EnzymeAD/Reactant.jl.git" -version = v"0.0.39" +version = v"0.0.40" sources = [ - GitSource(repo, "eef65ce615a95f02b3b3c3c507f4f856161b7208"), + GitSource(repo, "31290218feacb1499bc0b74eb72697f76bb7647c"), FileSource("https://github.com/wsmoses/binaries/releases/download/v0.0.1/bazel-dev", "8b43ffdf519848d89d1c0574d38339dcb326b0a1f4015fceaa43d25107c3aade") ] From f9d73f55a3403f889d6917ae0ca38c174a2909ce Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 15 Jan 2025 00:15:38 -0600 Subject: [PATCH 4/5] Update build_tarballs.jl --- R/Reactant/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Reactant/build_tarballs.jl b/R/Reactant/build_tarballs.jl index 0842f50a050..cde333a0b1c 100644 --- a/R/Reactant/build_tarballs.jl +++ b/R/Reactant/build_tarballs.jl @@ -9,7 +9,7 @@ repo = "https://github.com/EnzymeAD/Reactant.jl.git" version = v"0.0.40" sources = [ - GitSource(repo, "31290218feacb1499bc0b74eb72697f76bb7647c"), + GitSource(repo, "6c98d9ace9043bd797d767377706874f4772468d"), FileSource("https://github.com/wsmoses/binaries/releases/download/v0.0.1/bazel-dev", "8b43ffdf519848d89d1c0574d38339dcb326b0a1f4015fceaa43d25107c3aade") ] From 039e8e7e303dd1da7a3e7e7a504282bac2877db0 Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 15 Jan 2025 09:25:11 -0600 Subject: [PATCH 5/5] Update build_tarballs.jl --- R/Reactant/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Reactant/build_tarballs.jl b/R/Reactant/build_tarballs.jl index cde333a0b1c..266ff639905 100644 --- a/R/Reactant/build_tarballs.jl +++ b/R/Reactant/build_tarballs.jl @@ -9,7 +9,7 @@ repo = "https://github.com/EnzymeAD/Reactant.jl.git" version = v"0.0.40" sources = [ - GitSource(repo, "6c98d9ace9043bd797d767377706874f4772468d"), + GitSource(repo, "ab946703ee6935887b7b441fbe16a3dac260fbc0"), FileSource("https://github.com/wsmoses/binaries/releases/download/v0.0.1/bazel-dev", "8b43ffdf519848d89d1c0574d38339dcb326b0a1f4015fceaa43d25107c3aade") ]