question

Paul-5516 avatar image
0 Votes"
Paul-5516 asked EdSantiago-6511 answered

ML.NET 1.5.5 -> Microsoft.ML.Mkl.Redist : Unable to load DLL 'MklImports': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Windows .NETFramework 4.7.2
ML.NET packages 1.5.5 (I have tried a lower version too).

When calling Context.Forecasting.ForecastBySsa

"Unable to load DLL 'MklImports': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

The 1.5.5 version of Microsoft.ML.MKl.Redist is installed and the Microsoft.ML.Mkl.Redist.dll is present i.e. "Copy Local" has found it and copied it to the output directory.

I've seen issues around this for .NET core from 2019 / 2020 but how can I proceed to get this working in a .NETFramework environment ?


86492-image.png



<packages>
<package id="Microsoft.ML" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.CpuMath" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.DataView" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.Mkl.Redist" version="1.5.5" targetFramework="net472" />
<package id="Microsoft.ML.TimeSeries" version="1.5.5" targetFramework="net472" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net472" />
<package id="System.Buffers" version="4.4.0" targetFramework="net472" />
<package id="System.CodeDom" version="4.4.0" targetFramework="net472" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net472" />
<package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Channels" version="4.7.1" targetFramework="net472" />
<package id="System.Threading.Tasks.Dataflow" version="4.8.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>

windows-formsdotnet-ml-big-data
image.png (39.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Paul-5516 avatar image
0 Votes"
Paul-5516 answered

The issue here appears to be with my compiler tools - I do not use Microsoft C#, but RemObjects Oxygene.

If I build a simple example using standard Microsoft C# in .NetFramework , I get several DLL's copied to my bin/Debug directory that do not get copied in the equivalent Oxygene project. These are CpuMathNative.dll, LdaNative.dll, libiomp5md.dll, MklImports.dll and MklProxyNative.dll . The C# project works as expected and without issue.

87382-image.png



If I copy those same DLL's into the debug folder of my Oxygene project, it works as per the C# version.

The issue therefore appears to be with the RemObjects tool chain. I will take the issue up with them.


image.png (80.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DanielZhang-MSFT avatar image
0 Votes"
DanielZhang-MSFT answered Paul-5516 commented

Hi Paul-5516,
This issue is usually caused by improperly installed libraries. Please make sure your Visual Studio installation has these packages installed correctly.
Your DLL might depend on other DLLs to get its job done. If you didn't copy or install those too, you'd indeed get this error message.
I have some suggestions you can refer to.
1.Check to see if MklImports.dll is in your specific \bin folder.
2.Check the compatibility of dll with 32bit or 64bit CPU.
3.You can also try the solution in this thread.
And there are more suggestions in this thread you can refer to.
Best Regards,
Daniel Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentationto enable e-mail notifications if you want to receive the related email notification for this thread.


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Daniel.

I'm sorry, but those don't get at the actual issue. Some of your suggested links are about building ML.NET under .NET Core - I'm just trying to use the ML.NET packages in a Winforms environment.

All required packages are available, the solution builds, packages copy to the \bin\debug folder (including Microsoft.ML.MKl.Redist.dll). The exception is generated when calling the ".Fit" method on the IPipeline SSaForecastingEstimator. Versions of the native MklImports.dll do exist on the machine - under the nuget packages structure for the microsoft.ml.mkl.redist , both x64 and x86. Copying either of those two to my bin\debug folder, continues to generate an error - the x86 one returns a different error "'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)'".

0 Votes 0 ·

Hi @Paul-5516,
Have you tried to change "Any CPU" to "X86" or "X64"?
87170-413.png
And please provide your code to reproduce the situation.
Best Regards,
Daniel Zhang


0 Votes 0 ·
413.png (12.0 KiB)

Hi Daniel,

Thank you for the help.. I have diagnosed the issue. See my answer below.

0 Votes 0 ·
YuriiCherekh-6628 avatar image
0 Votes"
YuriiCherekh-6628 answered YuriiCherekh-6628 published

ML.NET support CUDA 11
Loading model from: F:\V2Sorter\DataSet\03.01.2021\imageClassifier_2.zip
2021-04-16 16:06:33.457209: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:03:00.0 name: GeForce RTX 3080 computeCapability: 8.6
coreClock: 1.905GHz coreCount: 68 deviceMemorySize: 10.00GiB deviceMemoryBandwidth: 707.88GiB/s
2021-04-16 16:06:33.458465: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-04-16 16:06:33.459114: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-04-16 16:06:33.459639: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-04-16 16:06:33.460164: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-04-16 16:06:33.460705: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-04-16 16:06:33.461270: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-04-16 16:06:33.461946: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-04-16 16:06:33.462589: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-04-16 16:06:33.463409: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-04-16 16:06:33.464111: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-04-16 16:06:33.464830: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-04-16 16:06:33.465221: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-04-16 16:06:33.465788: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7745 MB memory) -> physical GPU (device: 0, name: GeForce RTX 3080, pci bus id: 0000:03:00.0, compute capability: 8.6)
Exception thrown: 'System.EntryPointNotFoundException' in Microsoft.ML.Vision.dll
device is disconnected
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
The thread 0x2f80 has exited with code 0 (0x0).

I'm using "SciSharp.TensorFlow.Redist-Windows-GPU" with CUDA 2.4.0 support but get the exception "Exception thrown: 'System.EntryPointNotFoundException' in Microsoft.ML.Vision.dll"
what could be the problem?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EdSantiago-6511 avatar image
0 Votes"
EdSantiago-6511 answered

The cure for my issue was to compile the library that's using ML.net to target x86. Once you set the target and recompile the project, you should be good to go!

Ed

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.