fix: Use system search path when locate driver library#1820
Conversation
d06b791 to
589fb1b
Compare
| "/lib/aarch64-linux-gnu/nvidia/current", | ||
| libcudasoParentDirPath, | ||
| } | ||
| for _, dir := range additionalDirs { |
There was a problem hiding this comment.
We already search these paths for libcuda.so.RM_VERSION and now we're specifying them again. I agree that we can make this more robust, but I would rather use a specific set of directories here than broadening the set again.
As a follow-up question: Could we plumb through the other directories through additionalDirs instead of hardcoding them here?
|
@reddevillg I have added a commit on top that should allow multiple driver library paths to be supported. Could you confirm that this works in your environment? |
It works perfectly. |
That's great! Did you want to squash the two commits and then we could get @cdesiniotis or @tariq1890 to also review this? |
it's ok, you can edit it directly, or tell me what I need to do |
I have squashed the commits. |
|
|
||
| // buildXOrgSearchPaths returns the ordered list of search paths for XOrg files. | ||
| func buildXOrgSearchPaths(libRoot string) []string { | ||
| func buildXOrgSearchPathsForSingle(libRoot string) []string { |
There was a problem hiding this comment.
Can we update the comment so it matches the new method name?
| return match | ||
| } | ||
|
|
||
| func buildXOrgSearchPaths(roots ...string) []string { |
There was a problem hiding this comment.
This comment needs to be moved above this method?
// buildXOrgSearchPaths returns the ordered list of search paths for XOrg files.
There was a problem hiding this comment.
Add comment "// buildXOrgSearchPaths returns search paths from all roots"
| driverLibPaths, err := r.Libraries().Locate(driverLib + versionSuffix) | ||
| if err != nil { | ||
| errs = errors.Join(errs, fmt.Errorf("failed to locate libcuda.so: %w", err)) | ||
| errs = errors.Join(errs, fmt.Errorf("failed to locate %v: %w", driverLib, err)) |
There was a problem hiding this comment.
| errs = errors.Join(errs, fmt.Errorf("failed to locate %v: %w", driverLib, err)) | |
| errs = errors.Join(errs, fmt.Errorf("failed to locate %q: %w", driverLib, err)) |
37ea7cc to
a787f48
Compare
On some systems (e.g. Debian), the driver libraries may be located in multiple paths on the system. This change allows these driver libraries to be found by locating all libraries with the expected version suffix. Signed-off-by: Evan Lezar <elezar@nvidia.com> Co-authored--by: Guo Lv <reddevillg@gmail.com> Signed-off-by: Guo Lv <reddevillg@gmail.com>
a787f48 to
8e83f9f
Compare
| Name: "NVIDIA_CTK_LIBCUDA_DIR", | ||
| Value: driverLibDirectory, | ||
| Value: strings.Join(driverLibDirectories, string(filepath.ListSeparator)), |
There was a problem hiding this comment.
Can we add a test case to this file that locates two driver library directories?
| } | ||
|
|
||
| // buildXOrgSearchPathsForSingle returns the ordered list of search paths for XOrg files. | ||
| func buildXOrgSearchPathsForSingle(libRoot string) []string { |
There was a problem hiding this comment.
nit: can we rename this method to buildXOrgSearchPathsAtRoot?
on Debian driver library may installed on both
/usr/lib/<archtriplet>and/usr/lib/<archtriplet>/nvidia/currentfix #1559