Browse Source

Providers: change provider binary names and loading to be closer to conventions

dependabot/nuget/NUnit3TestAdapter-4.2.0
Christoph Ruegg 5 years ago
parent
commit
0cf753c12e
  1. 9
      MathNet.Numerics.sln
  2. 7
      build/MathNet.Numerics.CUDA.Win.nuspec
  3. 7
      build/MathNet.Numerics.MKL.Linux-x64.nuspec
  4. 7
      build/MathNet.Numerics.MKL.Linux-x86.nuspec
  5. 9
      build/MathNet.Numerics.MKL.Linux.nuspec
  6. 7
      build/MathNet.Numerics.MKL.Win-x64.nuspec
  7. 7
      build/MathNet.Numerics.MKL.Win-x86.nuspec
  8. 9
      build/MathNet.Numerics.MKL.Win.nuspec
  9. 6
      build/MathNet.Numerics.OpenBLAS.Win.nuspec
  10. 9
      build/NativeProvider.targets
  11. 6
      docs/MKL.md
  12. 4
      src/NativeProviders/Linux/mkl_build.sh
  13. 2
      src/NativeProviders/MKL/resource.rc
  14. 4
      src/NativeProviders/OSX/mkl_build.sh
  15. 2
      src/NativeProviders/OpenBLAS/resource.rc
  16. 8
      src/NativeProviders/Windows/CUDA/CUDAWrapper.vcxproj
  17. 2
      src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj
  18. 8
      src/NativeProviders/Windows/OpenBLAS/OpenBLASWrapper.vcxproj
  19. 16
      src/Numerics/SpecialFunctions/MarcumQ.cs
  20. 2
      src/Providers.CUDA/SafeNativeMethods.cs
  21. 4
      src/Providers.MKL/MklProvider.cs
  22. 252
      src/Providers.MKL/NativeProviderLoader.cs
  23. 2
      src/Providers.MKL/SafeNativeMethods.cs
  24. 2
      src/Providers.OpenBLAS/SafeNativeMethods.cs

9
MathNet.Numerics.sln

@ -32,6 +32,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{B54A0B40
paket.dependencies = paket.dependencies paket.dependencies = paket.dependencies
paket.lock = paket.lock paket.lock = paket.lock
Directory.Build.props = Directory.Build.props Directory.Build.props = Directory.Build.props
build\MathNet.Numerics.CUDA.Win.nuspec = build\MathNet.Numerics.CUDA.Win.nuspec
build\MathNet.Numerics.MKL.Linux.nuspec = build\MathNet.Numerics.MKL.Linux.nuspec
build\MathNet.Numerics.MKL.Linux-x64.nuspec = build\MathNet.Numerics.MKL.Linux-x64.nuspec
build\MathNet.Numerics.MKL.Linux-x86.nuspec = build\MathNet.Numerics.MKL.Linux-x86.nuspec
build\MathNet.Numerics.MKL.Win.nuspec = build\MathNet.Numerics.MKL.Win.nuspec
build\MathNet.Numerics.MKL.Win-x64.nuspec = build\MathNet.Numerics.MKL.Win-x64.nuspec
build\MathNet.Numerics.MKL.Win-x86.nuspec = build\MathNet.Numerics.MKL.Win-x86.nuspec
build\MathNet.Numerics.OpenBLAS.Win.nuspec = build\MathNet.Numerics.OpenBLAS.Win.nuspec
build\NativeProvider.targets = build\NativeProvider.targets
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestData", "src\TestData\TestData.csproj", "{AF3253C9-4DB5-45A0-98CF-C105FDA9DA47}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestData", "src\TestData\TestData.csproj", "{AF3253C9-4DB5-45A0-98CF-C105FDA9DA47}"

7
build/MathNet.Numerics.CUDA.Win.nuspec

@ -20,8 +20,11 @@
<file src="..\..\out\CUDA\Windows\x64\cublas64_70.dll" target="runtimes\win-x64\native\cublas64_70.dll" /> <file src="..\..\out\CUDA\Windows\x64\cublas64_70.dll" target="runtimes\win-x64\native\cublas64_70.dll" />
<file src="..\..\out\CUDA\Windows\x64\cudart64_70.dll" target="runtimes\win-x64\native\cudart64_70.dll" /> <file src="..\..\out\CUDA\Windows\x64\cudart64_70.dll" target="runtimes\win-x64\native\cudart64_70.dll" />
<file src="..\..\out\CUDA\Windows\x64\cusolver64_70.dll" target="runtimes\win-x64\native\cusolver64_70.dll" /> <file src="..\..\out\CUDA\Windows\x64\cusolver64_70.dll" target="runtimes\win-x64\native\cusolver64_70.dll" />
<file src="..\..\out\CUDA\Windows\x64\MathNet.Numerics.CUDA.dll" target="runtimes\win-x64\native\MathNet.Numerics.CUDA.dll" /> <file src="..\..\out\CUDA\Windows\x64\libMathNetNumericsCUDA.dll" target="runtimes\win-x64\native\libMathNetNumericsCUDA.dll" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.CUDA.Win.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.CUDA.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.CUDA.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.CUDA.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.CUDA.Win.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

7
build/MathNet.Numerics.MKL.Linux-x64.nuspec

@ -19,8 +19,11 @@
</metadata> </metadata>
<files> <files>
<file src="..\..\out\MKL\Linux\x64\libiomp5.so" target="runtimes\linux-x64\native\libiomp5.so" /> <file src="..\..\out\MKL\Linux\x64\libiomp5.so" target="runtimes\linux-x64\native\libiomp5.so" />
<file src="..\..\out\MKL\Linux\x64\MathNet.Numerics.MKL.dll" target="runtimes\linux-x64\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Linux\x64\libMathNetNumercisMKL.so" target="runtimes\linux-x64\native\libMathNetNumercisMKL.so" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.MKL.Linux-x64.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.MKL.Linux-x64.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.MKL.Linux-x64.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.MKL.Linux-x64.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.MKL.Linux-x64.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

7
build/MathNet.Numerics.MKL.Linux-x86.nuspec

@ -19,8 +19,11 @@
</metadata> </metadata>
<files> <files>
<file src="..\..\out\MKL\Linux\x86\libiomp5.so" target="runtimes\linux-x86\native\libiomp5.so" /> <file src="..\..\out\MKL\Linux\x86\libiomp5.so" target="runtimes\linux-x86\native\libiomp5.so" />
<file src="..\..\out\MKL\Linux\x86\MathNet.Numerics.MKL.dll" target="runtimes\linux-x86\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Linux\x86\libMathNetNumercisMKL.so" target="runtimes\linux-x86\native\libMathNetNumercisMKL.so" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.MKL.Linux-x86.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.MKL.Linux-x86.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.MKL.Linux-x86.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.MKL.Linux-x86.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.MKL.Linux-x86.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

9
build/MathNet.Numerics.MKL.Linux.nuspec

@ -19,10 +19,13 @@
</metadata> </metadata>
<files> <files>
<file src="..\..\out\MKL\Linux\x64\libiomp5.so" target="runtimes\linux-x64\native\libiomp5.so" /> <file src="..\..\out\MKL\Linux\x64\libiomp5.so" target="runtimes\linux-x64\native\libiomp5.so" />
<file src="..\..\out\MKL\Linux\x64\MathNet.Numerics.MKL.dll" target="runtimes\linux-x64\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Linux\x64\libMathNetNumercisMKL.so" target="runtimes\linux-x64\native\libMathNetNumercisMKL.so" />
<file src="..\..\out\MKL\Linux\x86\libiomp5.so" target="runtimes\linux-x86\native\libiomp5.so" /> <file src="..\..\out\MKL\Linux\x86\libiomp5.so" target="runtimes\linux-x86\native\libiomp5.so" />
<file src="..\..\out\MKL\Linux\x86\MathNet.Numerics.MKL.dll" target="runtimes\linux-x86\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Linux\x86\libMathNetNumercisMKL.so" target="runtimes\linux-x86\native\libMathNetNumercisMKL.so" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.MKL.Linux.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.MKL.Linux.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.MKL.Linux.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.MKL.Linux.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.MKL.Linux.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

7
build/MathNet.Numerics.MKL.Win-x64.nuspec

@ -19,8 +19,11 @@
</metadata> </metadata>
<files> <files>
<file src="..\..\out\MKL\Windows\x64\libiomp5md.dll" target="runtimes\win-x64\native\libiomp5md.dll" /> <file src="..\..\out\MKL\Windows\x64\libiomp5md.dll" target="runtimes\win-x64\native\libiomp5md.dll" />
<file src="..\..\out\MKL\Windows\x64\MathNet.Numerics.MKL.dll" target="runtimes\win-x64\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Windows\x64\libMathNetNumercisMKL.dll" target="runtimes\win-x64\native\libMathNetNumercisMKL.dll" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.MKL.Win-x64.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.MKL.Win-x64.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.MKL.Win-x64.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.MKL.Win-x64.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.MKL.Win-x64.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

7
build/MathNet.Numerics.MKL.Win-x86.nuspec

@ -19,8 +19,11 @@
</metadata> </metadata>
<files> <files>
<file src="..\..\out\MKL\Windows\x86\libiomp5md.dll" target="runtimes\win-x86\native\libiomp5md.dll" /> <file src="..\..\out\MKL\Windows\x86\libiomp5md.dll" target="runtimes\win-x86\native\libiomp5md.dll" />
<file src="..\..\out\MKL\Windows\x86\MathNet.Numerics.MKL.dll" target="runtimes\win-x86\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Windows\x86\libMathNetNumercisMKL.dll" target="runtimes\win-x86\native\libMathNetNumercisMKL.dll" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.MKL.Win-x86.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.MKL.Win-x86.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.MKL.Win-x86.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.MKL.Win-x86.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.MKL.Win-x86.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

9
build/MathNet.Numerics.MKL.Win.nuspec

@ -19,10 +19,13 @@
</metadata> </metadata>
<files> <files>
<file src="..\..\out\MKL\Windows\x64\libiomp5md.dll" target="runtimes\win-x64\native\libiomp5md.dll" /> <file src="..\..\out\MKL\Windows\x64\libiomp5md.dll" target="runtimes\win-x64\native\libiomp5md.dll" />
<file src="..\..\out\MKL\Windows\x64\MathNet.Numerics.MKL.dll" target="runtimes\win-x64\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Windows\x64\libMathNetNumercisMKL.dll" target="runtimes\win-x64\native\libMathNetNumercisMKL.dll" />
<file src="..\..\out\MKL\Windows\x86\libiomp5md.dll" target="runtimes\win-x86\native\libiomp5md.dll" /> <file src="..\..\out\MKL\Windows\x86\libiomp5md.dll" target="runtimes\win-x86\native\libiomp5md.dll" />
<file src="..\..\out\MKL\Windows\x86\MathNet.Numerics.MKL.dll" target="runtimes\win-x86\native\MathNet.Numerics.MKL.dll" /> <file src="..\..\out\MKL\Windows\x86\libMathNetNumercisMKL.dll" target="runtimes\win-x86\native\libMathNetNumercisMKL.dll" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.MKL.Win.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.MKL.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.MKL.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.MKL.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.MKL.Win.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

6
build/MathNet.Numerics.OpenBLAS.Win.nuspec

@ -27,8 +27,12 @@
<file src="..\..\out\OpenBLAS\Windows\x86\libgfortran-3.dll" target="runtimes\win-x86\native\libgfortran-3.dll" /> <file src="..\..\out\OpenBLAS\Windows\x86\libgfortran-3.dll" target="runtimes\win-x86\native\libgfortran-3.dll" />
<file src="..\..\out\OpenBLAS\Windows\x86\libopenblas.dll" target="runtimes\win-x86\native\libopenblas.dll" /> <file src="..\..\out\OpenBLAS\Windows\x86\libopenblas.dll" target="runtimes\win-x86\native\libopenblas.dll" />
<file src="..\..\out\OpenBLAS\Windows\x86\libquadmath-0.dll" target="runtimes\win-x86\native\libquadmath-0.dll" /> <file src="..\..\out\OpenBLAS\Windows\x86\libquadmath-0.dll" target="runtimes\win-x86\native\libquadmath-0.dll" />
<file src="..\..\out\OpenBLAS\Windows\x86\MathNet.Numerics.OpenBLAS.dll" target="runtimes\win-x86\native\MathNet.Numerics.OpenBLAS.dll" /> <file src="..\..\out\OpenBLAS\Windows\x86\libMathNetNumericsOpenBLAS.dll" target="runtimes\win-x86\native\libMathNetNumericsOpenBLAS.dll" />
<file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.OpenBLAS.Win.targets" /> <file src="..\..\build\NativeProvider.targets" target="build\MathNet.Numerics.OpenBLAS.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net461\MathNet.Numerics.OpenBLAS.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="build\net48\MathNet.Numerics.OpenBLAS.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net461\MathNet.Numerics.OpenBLAS.Win.targets" />
<file src="..\..\build\NativeProvider.targets" target="buildTransitive\net48\MathNet.Numerics.OpenBLAS.Win.targets" />
<file src="..\..\build\icon.png" target="icon.png" /> <file src="..\..\build\icon.png" target="icon.png" />
</files> </files>
</package> </package>

9
build/NativeProvider.targets

@ -4,11 +4,12 @@
** Math.NET Native Provider Interop Files ** ** Math.NET Native Provider Interop Files **
****************************************************************************** ******************************************************************************
--> -->
<ItemGroup Condition="'$(UsingMicrosoftNETSdk)' != 'true' And '$(MSBuildThisFileDirectory)' != '' And HasTrailingSlash('$(MSBuildThisFileDirectory)')"> <ItemGroup Condition="'$(MSBuildThisFileDirectory)' != '' And HasTrailingSlash('$(MSBuildThisFileDirectory)')">
<MathNetInteropFiles Include="$(MSBuildThisFileDirectory)..\runtimes\**\*.dll" /> <MathNetInteropFiles Include="$(MSBuildThisFileDirectory)..\..\runtimes\**\*.dll" />
<MathNetInteropFiles Include="$(MSBuildThisFileDirectory)..\runtimes\**\*.so" /> <MathNetInteropFiles Include="$(MSBuildThisFileDirectory)..\..\runtimes\**\*.so" />
<MathNetInteropFiles Include="$(MSBuildThisFileDirectory)..\..\runtimes\**\*.dylib" />
<None Include="@(MathNetInteropFiles)"> <None Include="@(MathNetInteropFiles)">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link> <Link>runtimes/%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

6
docs/MKL.md

@ -75,7 +75,7 @@ Default Behavior on Windows
On Windows it is usually enough to make sure the native libraries are in the On Windows it is usually enough to make sure the native libraries are in the
same folder as the executable. Reference the appropriate NuGet package and set same folder as the executable. Reference the appropriate NuGet package and set
"Copy to Output Directory" for both MathNet.Numerics.MKL.dll and libiomp5md.dll "Copy to Output Directory" for both libMathNetNumercisMKL.dll and libiomp5md.dll
to "Copy always", or place the two native DLLs manually into the same directory to "Copy always", or place the two native DLLs manually into the same directory
as your application's executable. There is no need to set the native provider as your application's executable. There is no need to set the native provider
path explicitly. path explicitly.
@ -119,7 +119,7 @@ To build the MKL native provider for OSX:
mkl_build.sh mkl_build.sh
lionel:OSX Lionel$ sh mkl_build.sh lionel:OSX Lionel$ sh mkl_build.sh
Check the /x86 and /x64 folders in mathnet-numerics/out/MKL: you should now find the `libiomp5.dylib` and `MathNet.Numerics.MKL.dll` libaries. Check the /x86 and /x64 folders in mathnet-numerics/out/MKL: you should now find the `libiomp5.dylib` and `libMathNetNumercisMKL.dll` libaries.
You need to add the path to the generated libraries in your `DYLD_LIBRARY_PATH` environment variable (which you can move to the folder of you choice before). You need to add the path to the generated libraries in your `DYLD_LIBRARY_PATH` environment variable (which you can move to the folder of you choice before).
To do that, open your /Users/Lionel/.bas_profile.sh file with a text editor and add the following statements. To do that, open your /Users/Lionel/.bas_profile.sh file with a text editor and add the following statements.
@ -190,7 +190,7 @@ and use `ldconfig` to tell where to look for the libraries, but for now we'll ju
[lang=sh] [lang=sh]
sudo cp packages/MathNet.Numerics.MKL.Linux-x64.1.3.0/content/libiomp5.so /usr/lib/ sudo cp packages/MathNet.Numerics.MKL.Linux-x64.1.3.0/content/libiomp5.so /usr/lib/
sudo cp packages/MathNet.Numerics.MKL.Linux-x64.1.3.0/content/MathNet.Numerics.MKL.dll /usr/lib/ sudo cp packages/MathNet.Numerics.MKL.Linux-x64.1.3.0/content/libMathNetNumercisMKL.dll /usr/lib/
Then we're all set and can just call `Control.UseNativeMKL()` if we want to use the native provider. Then we're all set and can just call `Control.UseNativeMKL()` if we want to use the native provider.
Let's create the following C# file `Example.cs`: Let's create the following C# file `Example.cs`:

4
src/NativeProviders/Linux/mkl_build.sh

@ -7,10 +7,10 @@ export OUT=../../../out/MKL/Linux
mkdir -p $OUT/x64 mkdir -p $OUT/x64
mkdir -p $OUT/x86 mkdir -p $OUT/x86
g++ -std=c++11 -D_M_X64 -DGCC -m64 --shared -fPIC -o $OUT/x64/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp -Wl,--start-group $MKL/lib/intel64/libmkl_intel_lp64.a $MKL/lib/intel64/libmkl_intel_thread.a $MKL/lib/intel64/libmkl_core.a -Wl,--end-group -L$OPENMP/intel64 -liomp5 -lpthread -lm g++ -std=c++11 -D_M_X64 -DGCC -m64 --shared -fPIC -o $OUT/x64/libMathNetNumercisMKL.so -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp -Wl,--start-group $MKL/lib/intel64/libmkl_intel_lp64.a $MKL/lib/intel64/libmkl_intel_thread.a $MKL/lib/intel64/libmkl_core.a -Wl,--end-group -L$OPENMP/intel64 -liomp5 -lpthread -lm
cp $OPENMP/intel64/libiomp5.so $OUT/x64/ cp $OPENMP/intel64/libiomp5.so $OUT/x64/
g++ -std=c++11 -D_M_IX86 -DGCC -m32 --shared -fPIC -o $OUT/x86/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp -Wl,--start-group $MKL/lib/ia32/libmkl_intel.a $MKL/lib/ia32/libmkl_intel_thread.a $MKL/lib/ia32/libmkl_core.a -Wl,--end-group -L$OPENMP/ia32 -liomp5 -lpthread -lm g++ -std=c++11 -D_M_IX86 -DGCC -m32 --shared -fPIC -o $OUT/x86/libMathNetNumercisMKL.so -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp -Wl,--start-group $MKL/lib/ia32/libmkl_intel.a $MKL/lib/ia32/libmkl_intel_thread.a $MKL/lib/ia32/libmkl_core.a -Wl,--end-group -L$OPENMP/ia32 -liomp5 -lpthread -lm
cp $OPENMP/ia32/libiomp5.so $OUT/x86/ cp $OPENMP/ia32/libiomp5.so $OUT/x86/

2
src/NativeProviders/MKL/resource.rc

@ -73,7 +73,7 @@ BEGIN
VALUE "FileVersion", "2.6.0.0" VALUE "FileVersion", "2.6.0.0"
VALUE "InternalName", "Math.NET" VALUE "InternalName", "Math.NET"
VALUE "LegalCopyright", "Copyright (C) Math.NET 2009-2021" VALUE "LegalCopyright", "Copyright (C) Math.NET 2009-2021"
VALUE "OriginalFilename", "MathNet.Numerics.MKL" VALUE "OriginalFilename", "libMathNetNumercisMKL"
VALUE "ProductName", "Math.NET Numerics" VALUE "ProductName", "Math.NET Numerics"
VALUE "ProductVersion", "2.6.0.0" VALUE "ProductVersion", "2.6.0.0"
END END

4
src/NativeProviders/OSX/mkl_build.sh

@ -6,10 +6,10 @@ export OUT=../../../out/MKL/OSX
mkdir -p $OUT/x64 mkdir -p $OUT/x64
mkdir -p $OUT/x86 mkdir -p $OUT/x86
clang++ -std=c++11 -D_M_X64 -DGCC -m64 --shared -fPIC -o $OUT/x64/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm clang++ -std=c++11 -D_M_X64 -DGCC -m64 --shared -fPIC -o $OUT/x64/libMathNetNumercisMKL.dylib -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm
cp $OPENMP/libiomp5.dylib $OUT/x64/ cp $OPENMP/libiomp5.dylib $OUT/x64/
clang++ -std=c++11 -D_M_IX86 -DGCC -m32 --shared -fPIC -o $OUT/x86/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm clang++ -std=c++11 -D_M_IX86 -DGCC -m32 --shared -fPIC -o $OUT/x86/libMathNetNumercisMKL.dylib -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp ../MKL/fft.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm
cp $OPENMP/libiomp5.dylib $OUT/x86/ cp $OPENMP/libiomp5.dylib $OUT/x86/

2
src/NativeProviders/OpenBLAS/resource.rc

@ -73,7 +73,7 @@ BEGIN
VALUE "FileVersion", "0.2.0.0" VALUE "FileVersion", "0.2.0.0"
VALUE "InternalName", "Math.NET" VALUE "InternalName", "Math.NET"
VALUE "LegalCopyright", "Copyright (C) Math.NET 2009-2015" VALUE "LegalCopyright", "Copyright (C) Math.NET 2009-2015"
VALUE "OriginalFilename", "MathNet.Numerics.OpenBLAS" VALUE "OriginalFilename", "libMathNetNumericsOpenBLAS"
VALUE "ProductName", "Math.NET Numerics" VALUE "ProductName", "Math.NET Numerics"
VALUE "ProductVersion", "0.2.0.0" VALUE "ProductVersion", "0.2.0.0"
END END

8
src/NativeProviders/Windows/CUDA/CUDAWrapper.vcxproj

@ -81,21 +81,21 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x86\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.CUDA</TargetName> <TargetName>libMathNetNumericsCUDA</TargetName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.CUDA</TargetName> <TargetName>libMathNetNumericsCUDA</TargetName>
<OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x64\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x64\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x86\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.CUDA</TargetName> <TargetName>libMathNetNumericsCUDA</TargetName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.CUDA</TargetName> <TargetName>libMathNetNumericsCUDA</TargetName>
<OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x64\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\CUDA\Windows\x64\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

2
src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj

@ -26,7 +26,7 @@
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<TargetName>MathNet.Numerics.MKL</TargetName> <TargetName>libMathNetNumercisMKL</TargetName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

8
src/NativeProviders/Windows/OpenBLAS/OpenBLASWrapper.vcxproj

@ -74,25 +74,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x86\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.OpenBLAS</TargetName> <TargetName>libMathNetNumericsOpenBLAS</TargetName>
<IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath> <IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x64\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x64\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.OpenBLAS</TargetName> <TargetName>libMathNetNumericsOpenBLAS</TargetName>
<IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath> <IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x86\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.OpenBLAS</TargetName> <TargetName>libMathNetNumericsOpenBLAS</TargetName>
<IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath> <IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x64\</OutDir> <OutDir>$(ProjectDir)..\..\..\..\out\OpenBLAS\Windows\x64\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir> <IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.OpenBLAS</TargetName> <TargetName>libMathNetNumericsOpenBLAS</TargetName>
<IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath> <IncludePath>$(OpenBLASIncludeDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

16
src/Numerics/SpecialFunctions/MarcumQ.cs

@ -64,14 +64,6 @@ namespace MathNet.Numerics
/// </summary> /// </summary>
static readonly double Huge = 1.7976931348623157e+308; static readonly double Huge = 1.7976931348623157e+308;
/// <summary> /// <summary>
/// The number 3*pi/4
/// </summary>
static readonly double Pi3Over4 = 2.3561944901923449288;
/// <summary>
/// The number sqrt(2/pi)
/// </summary>
static readonly double Sqrt2OverPi = 0.7978845608028653559;
/// <summary>
/// The number 2**(1/4) /// The number 2**(1/4)
/// </summary> /// </summary>
static readonly double TwoExp1Over4 = 1.18920711500272106671749997; static readonly double TwoExp1Over4 = 1.18920711500272106671749997;
@ -92,18 +84,10 @@ namespace MathNet.Numerics
/// </summary> /// </summary>
static readonly double Giant = Huge / 1000; static readonly double Giant = Huge / 1000;
/// <summary> /// <summary>
/// The number 2/sqrt(pi)
/// </summary>
static readonly double TwoOverSqrtPi = 1.1283791670955125739;
/// <summary>
/// Lower limit of exponential /// Lower limit of exponential
/// </summary> /// </summary>
static readonly double ExpLow = -300; static readonly double ExpLow = -300;
/// <summary> /// <summary>
/// Upper limit of exponential
/// </summary>
static readonly double ExpHigh = 300;
/// <summary>
/// Demanded accuracy /// Demanded accuracy
/// </summary> /// </summary>
static readonly double Epss = 1e-15; static readonly double Epss = 1e-15;

2
src/Providers.CUDA/SafeNativeMethods.cs

@ -46,7 +46,7 @@ namespace MathNet.Numerics.Providers.CUDA
/// <summary> /// <summary>
/// Name of the native DLL. /// Name of the native DLL.
/// </summary> /// </summary>
internal const string DllName = "MathNet.Numerics.CUDA.dll"; internal const string DllName = "libMathNetNumercisCUDA";
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int query_capability(int capability); internal static extern int query_capability(int capability);

4
src/Providers.MKL/MklProvider.cs

@ -35,8 +35,8 @@ namespace MathNet.Numerics.Providers.MKL
{ {
public static class MklProvider public static class MklProvider
{ {
const int DesignTimeRevision = 14; const int DesignTimeRevision = 15;
const int MinimumCompatibleRevision = 4; const int MinimumCompatibleRevision = 15;
static int _nativeRevision; static int _nativeRevision;
static Version _mklVersion; static Version _mklVersion;

252
src/Providers.MKL/NativeProviderLoader.cs

@ -39,15 +39,12 @@ using System.Threading;
namespace MathNet.Numerics.Providers.Common namespace MathNet.Numerics.Providers.Common
{ {
internal enum Runtime internal enum ProcArchitecture
{ {
Unknown = 0, X64,
WindowsX64, X86,
WindowsX86, Arm,
WindowsArm64, Arm64
WindowsArm,
LinuxX64,
LinuxX86,
} }
/// <summary> /// <summary>
@ -62,55 +59,52 @@ namespace MathNet.Numerics.Providers.Common
/// </summary> /// </summary>
static readonly Lazy<Dictionary<string, IntPtr>> NativeHandles = new Lazy<Dictionary<string, IntPtr>>(LazyThreadSafetyMode.PublicationOnly); static readonly Lazy<Dictionary<string, IntPtr>> NativeHandles = new Lazy<Dictionary<string, IntPtr>>(LazyThreadSafetyMode.PublicationOnly);
/// <summary>
/// Gets a string indicating the architecture and bitness of the current process.
/// </summary>
static readonly Lazy<Runtime> RuntimeKey = new Lazy<Runtime>(EvaluateRuntime, LazyThreadSafetyMode.PublicationOnly);
/// <summary> /// <summary>
/// If the last native library failed to load then gets the corresponding exception /// If the last native library failed to load then gets the corresponding exception
/// which occurred or null if the library was successfully loaded. /// which occurred or null if the library was successfully loaded.
/// </summary> /// </summary>
internal static Exception LastException { get; private set; } internal static Exception LastException { get; private set; }
static bool IsUnix static bool IsWindows { get; }
{ static bool IsLinux { get; }
get static bool IsMac { get; }
{ static bool IsUnix { get; }
var p = Environment.OSVersion.Platform;
return p == PlatformID.Unix || p == PlatformID.MacOSX;
}
}
static Runtime EvaluateRuntime() static ProcArchitecture ProcArchitecture { get; }
{ static string Extension { get; }
//return (IntPtr.Size == 8) ? X64 : X86;
if (IsUnix)
{
// Only support x86 and amd64 on Unix as there isn't a reliable way to detect the architecture
return Environment.Is64BitProcess ? Runtime.LinuxX64 : Runtime.LinuxX86;
}
var architecture = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"); static NativeProviderLoader()
{
if (string.Equals(architecture, "x86", StringComparison.OrdinalIgnoreCase)) #if !NET461
{ IsLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
return Runtime.WindowsX86; IsMac = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
}
if (string.Equals(architecture, "amd64", StringComparison.OrdinalIgnoreCase) var a = RuntimeInformation.ProcessArchitecture;
|| string.Equals(architecture, "x64", StringComparison.OrdinalIgnoreCase)) bool arm = a == Architecture.Arm || a == Architecture.Arm64;
{ #else
return Environment.Is64BitProcess ? Runtime.WindowsX64 : Runtime.WindowsX86; var p = Environment.OSVersion.Platform;
} IsLinux = p == PlatformID.Unix;
IsMac = p == PlatformID.MacOSX;
if (string.Equals(architecture, "arm", StringComparison.OrdinalIgnoreCase)) bool arm = false;
{ #endif
return Environment.Is64BitProcess ? Runtime.WindowsArm64 : Runtime.WindowsArm;
}
// Fallback if unknown IsUnix = IsLinux || IsMac;
return Runtime.Unknown; IsWindows = !IsUnix;
Extension = IsWindows
? ".dll"
: IsLinux
? ".so"
: ".dylib";
ProcArchitecture = Environment.Is64BitProcess
? arm
? ProcArchitecture.Arm64
: ProcArchitecture.X64
: arm
? ProcArchitecture.Arm
: ProcArchitecture.X86;
} }
/// <summary> /// <summary>
@ -126,6 +120,11 @@ namespace MathNet.Numerics.Providers.Common
throw new ArgumentNullException(nameof(fileName)); throw new ArgumentNullException(nameof(fileName));
} }
if (string.IsNullOrEmpty(Path.GetExtension(fileName)))
{
fileName = Path.ChangeExtension(fileName, Extension);
}
// If we have hint path provided by the user, look there first // If we have hint path provided by the user, look there first
if (hintPath != null && TryLoadFromDirectory(fileName, hintPath)) if (hintPath != null && TryLoadFromDirectory(fileName, hintPath))
{ {
@ -168,67 +167,110 @@ namespace MathNet.Numerics.Providers.Common
directory = Path.GetFullPath(directory); directory = Path.GetFullPath(directory);
// If we have a know architecture, try the matching subdirectory first if (IsWindows)
switch (RuntimeKey.Value) {
switch (ProcArchitecture)
{
case ProcArchitecture.X64:
return TryLoadFile(directory, "runtimes/win-x64/native", fileName)
|| TryLoadFile(directory, "win-x64/native", fileName)
|| TryLoadFile(directory, "win-x64", fileName)
|| TryLoadFile(directory, "x64", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.X86:
return TryLoadFile(directory, "runtimes/win-x86/native", fileName)
|| TryLoadFile(directory, "win-x86/native", fileName)
|| TryLoadFile(directory, "win-x86", fileName)
|| TryLoadFile(directory, "x86", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.Arm64:
return TryLoadFile(directory, "runtimes/win-arm64/native", fileName)
|| TryLoadFile(directory, "win-arm64/native", fileName)
|| TryLoadFile(directory, "win-arm64", fileName)
|| TryLoadFile(directory, "arm64", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.Arm:
return TryLoadFile(directory, "runtimes/win-arm/native", fileName)
|| TryLoadFile(directory, "win-arm/native", fileName)
|| TryLoadFile(directory, "win-arm", fileName)
|| TryLoadFile(directory, "arm", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
default:
return TryLoadFile(directory, string.Empty, fileName);
}
}
if (IsLinux)
{ {
case Runtime.WindowsX64: switch (ProcArchitecture)
if (TryLoadFile(directory, "x64", fileName) {
|| TryLoadFile(directory, "runtimes/win-x64/native", fileName) case ProcArchitecture.X64:
|| TryLoadFile(directory, "win-x64/native", fileName) return TryLoadFile(directory, "runtimes/linux-x64/native", fileName)
|| TryLoadFile(directory, "win-x64", fileName)) || TryLoadFile(directory, "linux-x64/native", fileName)
{ || TryLoadFile(directory, "linux-x64", fileName)
return true; || TryLoadFile(directory, "x64", fileName)
} || TryLoadFile(directory, string.Empty, fileName);
break; case ProcArchitecture.X86:
case Runtime.WindowsX86: return TryLoadFile(directory, "runtimes/linux-x86/native", fileName)
if (TryLoadFile(directory, "x86", fileName) || TryLoadFile(directory, "linux-x86/native", fileName)
|| TryLoadFile(directory, "runtimes/win-x86/native", fileName) || TryLoadFile(directory, "linux-x86", fileName)
|| TryLoadFile(directory, "win-x86/native", fileName) || TryLoadFile(directory, "x86", fileName)
|| TryLoadFile(directory, "win-x86", fileName)) || TryLoadFile(directory, string.Empty, fileName);
{ case ProcArchitecture.Arm64:
return true; return TryLoadFile(directory, "runtimes/linux-arm64/native", fileName)
} || TryLoadFile(directory, "linux-arm64/native", fileName)
break; || TryLoadFile(directory, "linux-arm64", fileName)
case Runtime.WindowsArm64: || TryLoadFile(directory, "arm64", fileName)
if (TryLoadFile(directory, "arm64", fileName) || TryLoadFile(directory, string.Empty, fileName);
|| TryLoadFile(directory, "runtimes/win-arm64/native", fileName) case ProcArchitecture.Arm:
|| TryLoadFile(directory, "win-arm64/native", fileName) return TryLoadFile(directory, "runtimes/linux-arm/native", fileName)
|| TryLoadFile(directory, "win-arm64", fileName)) || TryLoadFile(directory, "linux-arm/native", fileName)
{ || TryLoadFile(directory, "linux-arm", fileName)
return true; || TryLoadFile(directory, "arm", fileName)
} || TryLoadFile(directory, string.Empty, fileName);
break; default:
case Runtime.WindowsArm: return TryLoadFile(directory, string.Empty, fileName);
if (TryLoadFile(directory, "arm", fileName) }
|| TryLoadFile(directory, "runtimes/win-arm/native", fileName)
|| TryLoadFile(directory, "win-arm/native", fileName)
|| TryLoadFile(directory, "win-arm", fileName))
{
return true;
}
break;
case Runtime.LinuxX64:
if (TryLoadFile(directory, "x64", fileName)
|| TryLoadFile(directory, "runtimes/linux-x64/native", fileName)
|| TryLoadFile(directory, "linux-x64/native", fileName)
|| TryLoadFile(directory, "linux-x64", fileName))
{
return true;
}
break;
case Runtime.LinuxX86:
if (TryLoadFile(directory, "x86", fileName)
|| TryLoadFile(directory, "runtimes/linux-x86/native", fileName)
|| TryLoadFile(directory, "linux-x86/native", fileName)
|| TryLoadFile(directory, "linux-x86", fileName))
{
return true;
}
break;
} }
// Otherwise try to load directly from the provided directory if (IsMac)
return TryLoadFile(directory, string.Empty, fileName); {
switch (ProcArchitecture)
{
case ProcArchitecture.X64:
return TryLoadFile(directory, "runtimes/osx-x64/native", fileName)
|| TryLoadFile(directory, "osx-x64/native", fileName)
|| TryLoadFile(directory, "osx-x64", fileName)
|| TryLoadFile(directory, "x64", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.Arm64:
return TryLoadFile(directory, "runtimes/osx-arm64/native", fileName)
|| TryLoadFile(directory, "osx-arm64/native", fileName)
|| TryLoadFile(directory, "osx-arm64", fileName)
|| TryLoadFile(directory, "arm64", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
default:
return TryLoadFile(directory, string.Empty, fileName);
}
}
switch (ProcArchitecture)
{
case ProcArchitecture.X64:
return TryLoadFile(directory, "x64", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.X86:
return TryLoadFile(directory, "x86", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.Arm64:
return TryLoadFile(directory, "arm64", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
case ProcArchitecture.Arm:
return TryLoadFile(directory, "arm", fileName)
|| TryLoadFile(directory, string.Empty, fileName);
default:
return TryLoadFile(directory, string.Empty, fileName);
}
} }
/// <summary> /// <summary>
@ -302,7 +344,7 @@ namespace MathNet.Numerics.Providers.Common
const int RTLD_NOW = 2; const int RTLD_NOW = 2;
[DllImport("libdl", SetLastError = true)] [DllImport("dl", SetLastError = true)]
static extern IntPtr dlopen(String fileName, int flags); static extern IntPtr dlopen(String fileName, int flags);
} }
#endif #endif

2
src/Providers.MKL/SafeNativeMethods.cs

@ -46,7 +46,7 @@ namespace MathNet.Numerics.Providers.MKL
/// <summary> /// <summary>
/// Name of the native DLL. /// Name of the native DLL.
/// </summary> /// </summary>
internal const string DllName = "MathNet.Numerics.MKL.dll"; internal const string DllName = "libMathNetNumercisMKL";
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int query_capability(int capability); internal static extern int query_capability(int capability);

2
src/Providers.OpenBLAS/SafeNativeMethods.cs

@ -44,7 +44,7 @@ namespace MathNet.Numerics.Providers.OpenBLAS
/// <summary> /// <summary>
/// Name of the native DLL. /// Name of the native DLL.
/// </summary> /// </summary>
internal const string DllName = "MathNET.Numerics.OpenBLAS.dll"; internal const string DllName = "libMathNetNumercisOpenBLAS";
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int query_capability(int capability); internal static extern int query_capability(int capability);

Loading…
Cancel
Save