Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Math Kernel Library failes ?

MG12
New Contributor I
1,707 Views

Hello,

here is a test to use a random generator funtion from the math kernel library:

---

#include <iostream>

#include <mathimf.h>
#include <mkl.h>

int main()
{
unsigned int iseeds[32];
VSLStreamStatePtr iRNDStream[2];

iseeds[0] = 123456;
memset(iRNDStream, 0, sizeof(iRNDStream));

vslNewStreamEx(&iRNDStream[0], VSL_BRNG_MCG59, 1, iseeds);

std::cout << "Hello World!\n";
}

--

The call to vslNewStreamEx immediately kills the application. It doesn matter

if I apply the sequential or the parallel version.

I copy the dll (mkl_sequential.2.dll, mkl_intel_thread.2.dll) manually to the executable folder.

I have used that functionality very successful in the older C Compiler back in 2021 but

I fail to re-use it in the current version.

What do I wrong ?

I'm using VS2022, 64 Bit Compile Mode

Thank you

 

0 Kudos
1 Solution
MG12
New Contributor I
1,502 Views

Hello,

I finally found the missing part:

The system "Path" variable needs to have the mkl path included:

C:\Program Files (x86)\Intel\oneAPI\mkl\latest\redist\intel64

 

Actually, that is quite natural but it would be nice if the oneApi setup would do this for us under Windows.

You may close this thread.

Thansk again

Kind regards

Marcus

View solution in original post

0 Kudos
7 Replies
VarshaS_Intel
Moderator
1,673 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Could you please let us know the Intel C++ compiler, Intel MKL version, and Microsoft Visual Studio 2022 sub-version you are using?

 

At our end, when we tried to run the sample reproducer code provided by you on Visual Studio 2022, we are able to run it without any errors in both sequential as well as parallel mode. Please find the below-attached screenshots for more details.

 

Could you please try running on the Intel oneAPI command prompt and let us know if you are still facing any errors?

 

Thanks & Regards,

Varsha

 

0 Kudos
MG12
New Contributor I
1,663 Views

Hello,

thank you for looking into this. Encouraging.

I'm not sure how to obtain the requested version info but this is what I get from the VS2022 about box:

--

Microsoft Visual Studio Professional 2022
Version 17.6.3
VisualStudio.17.Release/17.6.3+33801.468
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2022 00483-10700-19571-AA866
Microsoft Visual C++ 2022

ASP.NET and Web Tools 17.6.326.62524
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.6.326.62524
Azure App Service Tools v3.0.0

C# Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Intel Libraries for oneAPI 2023.1
Intel Libraries for oneAPI 2023.1, Copyright © 2019-2023 Intel Corporation. All rights reserved.

Intel® C++ Compiler 2023.1
Intel® C++ Compiler 2023.1, Copyright © 2002-2023 Intel Corporation. All rights reserved.

Intel® C++ Compiler Classic 2021.9
Intel® C++ Compiler Classic 2021.9, Copyright © 2002-2023 Intel Corporation. All rights reserved.

Intel® oneAPI DPC++ Compiler 2023.1
Intel® oneAPI DPC++ Compiler 2023.1, Copyright © 2019-2023 Intel Corporation. All rights reserved.

Intel® oneAPI Menu & Samples 10.10.392.9731
Intel® oneAPI Visual Studio Menu & Samples Extension

Intel® VTune™ Profiler 2023 1.3.10
Intel® VTune™ Profiler 2023, (Plugin Version 1.3.10), Copyright © 2009-2023 Intel Corporation. All rights reserved.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager 6.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools 17.0.20329.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

--

But: From your screen shot I see that you run the example within visual studio in debugging mode. When I try this

I get the same result as you. If I compile in release mode and run again within visual studio I get also the

desired result.

But when I run the generated executable from a windows command prompt (or just double click on the exe) it doesnt work.

Perhaps something to do with the referenced dlls ?

(I had to manually search for them and copy in the exe folder)

 

0 Kudos
MG12
New Contributor I
1,628 Views

Some additional info:

If I run the TestApp.exe from the Intel oneApi command line it works - it doesn even complain about a missing dll.

If I run it from windows it complains about the missing dll: mkl_intel_thread.2.dll

If I copy this dll from

C:\Program Files (x86)\Intel\oneAPI\mkl\2023.1.0\redist\intel64

and put it in the exe folder I can start the test exe by double click but it fails or is killed  and does nothing.

I just tried a different call to the mkl: mkl_get_version_string(buf, 128); --> same result.

 

Thats really confusing:

Why it magically runs under the control of Visual Studion and/or the Intel oneApi command line tool

but not in a native way under Windows ?

I am lost ...What I have to do ?

 

Thanks in advance!

0 Kudos
VarshaS_Intel
Moderator
1,621 Views

Hi,

 

Thanks for the details and reply.

 

>>Why it magically runs under the control of Visual Studion and/or the Intel oneApi command line tool but not in a native way under Windows ?

Yes, while using both the Intel oneAPI command prompt as well as setting Intel oneAPI in Microsoft Visual Studio the Intel Environment will be initialized.

 

But when you try to do it on the Windows command prompt you need to initialize the oneAPI environment so that it will include all the necessary files and path that is required. You can also initialize by using the below command on the Windows command prompt and try running as same in Intel oneAPI Command Prompt. Please find the below screenshot for more information.

"C:\Program Files (x86)\Intel\oneAPI\setvars.bat"

VarshaS_Intel_0-1688148881800.png

 

Could you please try and let us know if you have any other queries?

 

Thanks & Regards,

Varsha

 

 

 

0 Kudos
MG12
New Contributor I
1,545 Views

Hello Varsha,

I tried the command with mixed success:

If I open a CMD shell under windows and run the setvar script it makes the TestApp.exe working within the 

command shell.

However, I'm still not able to get the TestApp.exe running in the standard windows environment by simply

double clicking on that exe. This works on your side ?

Seems the question is: What is needed to be setup globally under windows in order to make the mkl running?

Sorry, I looked around for a while in the documentation but so far no luck.

 

PS: I'm using Windows 10 Pro

 

Thanks and kind regards

Marcus

 

0 Kudos
MG12
New Contributor I
1,503 Views

Hello,

I finally found the missing part:

The system "Path" variable needs to have the mkl path included:

C:\Program Files (x86)\Intel\oneAPI\mkl\latest\redist\intel64

 

Actually, that is quite natural but it would be nice if the oneApi setup would do this for us under Windows.

You may close this thread.

Thansk again

Kind regards

Marcus

0 Kudos
VarshaS_Intel
Moderator
1,406 Views

Hi,


It’s great to know that the issue has been resolved. Thanks for sharing the solution with us. In case you run into any other issues please feel free to create a new thread.


>>Actually, that is quite natural but it would be nice if the oneApi setup would do this for us under Windows.

Thanks for your feedback. We will let the development team know about it.


Have a Good Day!


Thanks & Regards,

Varsha


0 Kudos
Reply