@@ -46,21 +46,18 @@ public static SystemInfo Get()
4646 {
4747 // Get Vulkan Summary
4848 string ? vulkanSummary = GetVulkanSummary ( ) ;
49-
5049 // If we have a Vulkan summary
5150 if ( vulkanSummary != null )
5251 {
5352 // Extract Vulkan version from summary
5453 string ? vulkanVersion = ExtractVulkanVersionFromSummary ( vulkanSummary ) ;
55-
5654 // If we have a Vulkan version
5755 if ( vulkanVersion != null )
5856 {
5957 // Return the Vulkan version
6058 return vulkanVersion ;
6159 }
6260 }
63-
6461 // Return null if we failed to get the Vulkan version
6562 return null ;
6663 }
@@ -83,7 +80,6 @@ public static SystemInfo Get()
8380 }
8481 } ;
8582 var ( exitCode , output , error , ok ) = process . SafeRun ( TimeSpan . FromSeconds ( 12 ) ) ;
86-
8783 // If ok return the output else return null
8884 return ok ? output :
8985 null ;
@@ -99,32 +95,25 @@ public static SystemInfo Get()
9995 // We have three ways of parsing the Vulkan version from the summary (output is a different between Windows and Linux)
10096 // For now, I have decided to go with the full version number, and leave it up to the user to parse it further if needed
10197 // I have left the other patterns in, in case we need them in the future
102-
10398 // Output on linux : 4206847 (1.3.255)
10499 // Output on windows : 1.3.255
105100 string pattern = @"apiVersion\s*=\s*([^\r\n]+)" ;
106-
107101 // Output on linux : 4206847
108102 // Output on windows : 1.3.255
109103 //string pattern = @"apiVersion\s*=\s*([\d\.]+)";
110-
111104 // Output on linux : 1.3.255
112105 // Output on windows : 1.3.255
113106 //string pattern = @"apiVersion\s*=\s*(?:\d+\s*)?(?:\(\s*)?([\d]+\.[\d]+\.[\d]+)(?:\s*\))?";
114-
115107 // Create a Regex object to match the pattern
116108 Regex regex = new Regex ( pattern ) ;
117-
118109 // Match the pattern in the input string
119110 Match match = regex . Match ( vulkanSummary ) ;
120-
121111 // If a match is found
122112 if ( match . Success )
123113 {
124114 // Return the version number
125115 return match . Groups [ 1 ] . Value ;
126116 }
127-
128117 // Return null if no match is found
129118 return null ;
130119 }
@@ -142,15 +131,12 @@ private static int GetCudaMajorVersion()
142131 {
143132 return - 1 ;
144133 }
145-
146134 //Ensuring cuda bin path is reachable. Especially for MAUI environment.
147135 string cudaBinPath = Path . Combine ( cudaPath , "bin" ) ;
148-
149136 if ( Directory . Exists ( cudaBinPath ) )
150137 {
151138 AddDllDirectory ( cudaBinPath ) ;
152139 }
153-
154140 version = GetCudaVersionFromPath ( cudaPath ) ;
155141 }
156142 else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
@@ -160,14 +146,12 @@ private static int GetCudaMajorVersion()
160146 {
161147 return ExtractMajorVersion ( ref env_version ) ;
162148 }
163-
164149 // List of default cuda paths
165150 string [ ] defaultCudaPaths =
166151 [
167152 "/usr/local/bin/cuda" ,
168153 "/usr/local/cuda" ,
169154 ] ;
170-
171155 // Loop through every default path to find the version
172156 foreach ( var path in defaultCudaPaths )
173157 {
@@ -178,7 +162,6 @@ private static int GetCudaMajorVersion()
178162 if ( ! string . IsNullOrEmpty ( version ) )
179163 break ;
180164 }
181-
182165 if ( string . IsNullOrEmpty ( version ) )
183166 {
184167 cudaPath = Environment . GetEnvironmentVariable ( "LD_LIBRARY_PATH" ) ;
@@ -233,7 +216,6 @@ private static string GetCudaVersionFromPath(string cudaPath)
233216 // Put it here to avoid calling NativeApi when getting the cuda version.
234217 [ DllImport ( "kernel32.dll" , CharSet = CharSet . Unicode , SetLastError = true ) ]
235218 internal static extern int AddDllDirectory ( string NewDirectory ) ;
236-
237219 private const string cudaVersionFile = "version.json" ;
238220 #endregion
239221 }
0 commit comments