Skip to content

Commit 9e58ca8

Browse files
committed
ptxjitcompiler.so
1 parent 264876d commit 9e58ca8

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

examples/vecadd/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn load_ptx_with_log(ptx: &str) -> Result<Module, Box<dyn Error>> {
7878

7979
// The driver accepted the PTX; drop our raw handle and re-load via cust so the
8080
// caller gets a typed Module with cust's lifetime/drop machinery.
81-
unsafe { driver_sys::cuModuleUnload(module_ptr) };
81+
let _ = unsafe { driver_sys::cuModuleUnload(module_ptr) };
8282
Module::from_ptx(ptx, &[]).map_err(|e| e.into())
8383
}
8484

flake.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,18 @@
8484
CUDA_LIBRARY_PATH =
8585
"${cudaRoot}/targets/x86_64-linux/lib:${cudaRoot}/lib64:${cudaRoot}/lib64/stubs";
8686
};
87+
# Symlink every NVIDIA-shipped driver library (libcuda, libnvidia-*) into a
88+
# single shim dir that we then stick on LD_LIBRARY_PATH. libcuda alone is not
89+
# enough: the driver will dlopen companions like libnvidia-ptxjitcompiler.so.1
90+
# when JITing PTX, and failing to find them surfaces as
91+
# CUDA_ERROR_JIT_COMPILER_NOT_FOUND from cuModuleLoadDataEx.
8792
driverShimHook = ''
8893
driver_shim_dir="$PWD/.nix-driver-libs"
8994
mkdir -p "$driver_shim_dir"
90-
if [ -e "${driverLibPath}" ]; then
91-
ln -sf "${driverLibPath}" "$driver_shim_dir/libcuda.so.1"
92-
fi
95+
for src in "${driverLibDir}"/libcuda.so* "${driverLibDir}"/libnvidia-*.so*; do
96+
[ -e "$src" ] || continue
97+
ln -sf "$src" "$driver_shim_dir/$(basename "$src")"
98+
done
9399
'';
94100

95101
# ---- LLVM 7-only shell ----

0 commit comments

Comments
 (0)