Skip to content

Commit

Permalink
Fix CUDA detection on WSL (#847)
Browse files Browse the repository at this point in the history
Improve CUDA detection on WSL
  • Loading branch information
m0nsky authored Jul 12, 2024
1 parent 9661299 commit 23bf941
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions LLama/Native/Load/SystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,24 @@ private static int GetCudaMajorVersion()
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
// Try the default first
cudaPath = "/usr/local/bin/cuda";
version = GetCudaVersionFromPath(cudaPath);
// List of default cuda paths
string[] defaultCudaPaths =
{
"/usr/local/bin/cuda",
"/usr/local/cuda",
};

// Loop through every default path to find the version
foreach (var path in defaultCudaPaths)
{
// Attempt to get the version from the path
version = GetCudaVersionFromPath(path);

// If a CUDA version is found, break the loop
if (!string.IsNullOrEmpty(version))
break;
}

if (string.IsNullOrEmpty(version))
{
cudaPath = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH");
Expand Down

0 comments on commit 23bf941

Please sign in to comment.