@@ -129,31 +129,33 @@ private static string GetCudaVersionFromPath(string cudaPath)
129
129
}
130
130
131
131
#if NET6_0_OR_GREATER
132
- private static string GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel avxLevel , string prefix , string suffix )
132
+ private static string GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel avxLevel , string prefix , string suffix , string libraryNamePrefix )
133
133
{
134
134
var avxStr = NativeLibraryConfig . AvxLevelToString ( avxLevel ) ;
135
135
if ( ! string . IsNullOrEmpty ( avxStr ) )
136
136
{
137
137
avxStr += "/" ;
138
138
}
139
- return $ "{ prefix } { avxStr } { libraryName } { suffix } ";
139
+ return $ "{ prefix } { avxStr } { libraryNamePrefix } { libraryName } { suffix } ";
140
140
}
141
141
142
142
private static List < string > GetLibraryTryOrder ( NativeLibraryConfig . Description configuration )
143
143
{
144
144
OSPlatform platform ;
145
- string prefix , suffix ;
145
+ string prefix , suffix , libraryNamePrefix ;
146
146
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
147
147
{
148
148
platform = OSPlatform . Windows ;
149
149
prefix = "runtimes/win-x64/native/" ;
150
150
suffix = ".dll" ;
151
+ libraryNamePrefix = "" ;
151
152
}
152
153
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
153
154
{
154
155
platform = OSPlatform . Linux ;
155
156
prefix = "runtimes/linux-x64/native/" ;
156
157
suffix = ".so" ;
158
+ libraryNamePrefix = "lib" ;
157
159
}
158
160
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
159
161
{
@@ -163,6 +165,7 @@ private static List<string> GetLibraryTryOrder(NativeLibraryConfig.Description c
163
165
prefix = System . Runtime . Intrinsics . Arm . ArmBase . Arm64 . IsSupported
164
166
? "runtimes/osx-arm64/native/"
165
167
: "runtimes/osx-x64/native/" ;
168
+ libraryNamePrefix = "lib" ;
166
169
}
167
170
else
168
171
{
@@ -181,8 +184,8 @@ private static List<string> GetLibraryTryOrder(NativeLibraryConfig.Description c
181
184
// if check skipped, we just try to load cuda libraries one by one.
182
185
if ( configuration . SkipCheck )
183
186
{
184
- result . Add ( $ "{ prefix } cuda12/{ libraryName } { suffix } ") ;
185
- result . Add ( $ "{ prefix } cuda11/{ libraryName } { suffix } ") ;
187
+ result . Add ( $ "{ prefix } cuda12/{ libraryNamePrefix } { libraryName } { suffix } ") ;
188
+ result . Add ( $ "{ prefix } cuda11/{ libraryNamePrefix } { libraryName } { suffix } ") ;
186
189
}
187
190
else
188
191
{
@@ -209,25 +212,25 @@ private static List<string> GetLibraryTryOrder(NativeLibraryConfig.Description c
209
212
// use cpu (or mac possibly with metal)
210
213
if ( ! configuration . AllowFallback && platform != OSPlatform . OSX )
211
214
{
212
- result . Add ( GetAvxLibraryPath ( configuration . AvxLevel , prefix , suffix ) ) ;
215
+ result . Add ( GetAvxLibraryPath ( configuration . AvxLevel , prefix , suffix , libraryNamePrefix ) ) ;
213
216
}
214
217
else if ( platform != OSPlatform . OSX ) // in macos there's absolutely no avx
215
218
{
216
219
if ( configuration . AvxLevel >= NativeLibraryConfig . AvxLevel . Avx512 )
217
- result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . Avx512 , prefix , suffix ) ) ;
220
+ result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . Avx512 , prefix , suffix , libraryNamePrefix ) ) ;
218
221
219
222
if ( configuration . AvxLevel >= NativeLibraryConfig . AvxLevel . Avx2 )
220
- result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . Avx2 , prefix , suffix ) ) ;
223
+ result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . Avx2 , prefix , suffix , libraryNamePrefix ) ) ;
221
224
222
225
if ( configuration . AvxLevel >= NativeLibraryConfig . AvxLevel . Avx )
223
- result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . Avx , prefix , suffix ) ) ;
226
+ result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . Avx , prefix , suffix , libraryNamePrefix ) ) ;
224
227
225
- result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . None , prefix , suffix ) ) ;
228
+ result . Add ( GetAvxLibraryPath ( NativeLibraryConfig . AvxLevel . None , prefix , suffix , libraryNamePrefix ) ) ;
226
229
}
227
230
228
231
if ( platform == OSPlatform . OSX )
229
232
{
230
- result . Add ( $ "{ prefix } { libraryName } { suffix } ") ;
233
+ result . Add ( $ "{ prefix } { libraryNamePrefix } { libraryName } { suffix } ") ;
231
234
}
232
235
233
236
return result ;
0 commit comments