- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear community,
I met the situation that currently couldn't be explained.
Situation 1: If I call MKL_Verbose(1), then DASUM() and DGEMM() fail with External exception C06D007E.
Situation 2: if I call MKL_Set_Num_Threads(n) where n>1, DGEMM() fails with same exception but DASUM() works as expected. Before setting the number of threads, MKL_Set_Dynamic(0) is called.
Actually, I work with my code from https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Failed-to-use-MKL-linked-dynamically-from-Delphi-x64/m-p/1552112
Everything is fine in case of MKL_Set_Dynamic(0) and MKL_Set_Num_Threads(1).
I also tried to use MKL_malloc() to allocate the memory, but it changed nothing. Playing with MKL_Enable_Instructions() and MKL_Set_Threading_Layer() didn't help as well.
Internet is full of the DGEMM() + MKL_Set_Num_Threads() examples, so they should work together.
Could you please help in this?
- Tags:
- Delphi
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in Intel Communities.
We are looking into your issue internally. We will get back to you soon with an update.
Regards,
Jilani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Based on the provided link, it appears that the code you shared is written in Pascal. Could you please confirm if this is indeed the case?
Regards,
Jilani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jilani,
I confirm that the code is written in Delphi 11 and targeted Win64 platform.
Best regards,
Roman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your reply.
Could you kindly refer to the link provided below?. The provided link contains information regarding hardware and software requirements for the Intel® oneAPI Math Kernel Library.
Regards,
Jilani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Jilani,
Thank you very much for the information provided. I checked the requirements and discovered that the Intel® oneAPI Threading Building Blocks is not installed in the system. I installed it to c:\Program Files (x86)\Intel\oneAPI\tbb\2021.11 and added "c:\Program Files (x86)\Intel\oneAPI\tbb\2021.11\bin" to the PATH for the testing purposes.
Unfortunately, it didn't change the situation. I even put all MKL and TBB dlls from their bins together with my exe and loaded mkl_rt.2.dll dynamically from this folder - no results.
If TBB is required by MKL to implement multithreading, could you please suggest me how to make the MKL use the installed TBB correctly if I load MKL dynamically?
Best regards,
Roman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As you can see in the system requirements link above, oneMKL provides C++, Fortran (and also DPC++/SYCL) interfaces. It looks like you were able to use oneMKL with Delphi Pascal but I'm not sure if we can support Delphi Pascal issues with oneMKL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reply. Could you please give a link to any C/C++ example of the dynamic oneMKL + TBB loading?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would recommend to start from installing oneAPI Base Toolkit on Windows. It sounds that you are already using Visual Studio. You can choose to integrate oneAPI Base Toolkit into Visual Studio. After that, you should have an option to start command prompt "Intel oneAPI command prompt for Intel 64 for Visual Studio". Clicking on that prompt, should open the command window with Intel oneAPI tools initialized. That way, you don't need to install Intel tools piece-wise and wondering why they won't work together. By the way, you could choose at the time of installation the only tools you need, e.g., C/C++ compiler, oneMKL, oneTBB.
When you use the Intel oneAPI tools command prompt, oneMKL and oneTBB will be available without extra effort. If you later decide to experiment with your own way to access MKL APIs, you could check what environmental variables are set in the oneAPI command prompt and try to emulate them.
oneTBB is not required for oneMKL to use multi-threading. By default oneMKL should use OpenMP for multi-threading. It is called "intel_thread" in the output below. To check what threading model you are using, please "set MKL_VERBOSE=1". Then, when you are running the code, you should see something similar to the following:
MKL_VERBOSE oneMKL 2023.0 Update 2 Product build 20230613 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX-2) with support of Intel(R) Deep Learning Boost (Intel(R) DL Boost), Win 3.78GHz cdecl intel_thread
MKL_VERBOSE DGEMM(N,N,1000,2000,200,000000386B93FAF0,00000235BA889080,1000,00000235BA565080,200,000000386B93FB18,00000235BAA23080,1000) 10.50ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:10
as you can see, there is "intel_thread" in the output now. If you'd like to use oneTBB threading for oneMKL, you can enter "set MKL_THREADING_LAYER=tbb" into the command window. Then you should see something like this:
MKL_VERBOSE oneMKL 2023.0 Update 2 Product build 20230613 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX-2) with support of Intel(R) Deep Learning Boost (Intel(R) DL Boost), Win 3.78GHz lp64 tbb_thread
MKL_VERBOSE DGEMM(N,N,2,2,2,0000006A2038F7C8,0000006A2038F7D0,2,0000006A2038F810,2,0000006A2038F7C0,0000006A2038F7F0,2) 5.22ms CNR:OFF Dyn:1 FastMM:1
with "tbb_thread" in the output. You could switch back to OpenMP by "MKL_THREADING_LAYER=INTEL". As always, please check the value of the threading variable, e.g., "echo %MKL_THREADING_LAYER%".
After that, I'd recommend to build and run matrix multiply example multiplying-matrices-using-dgemm. And then, try measuring-effect-of-threading-on-dgemm example. Please use icpx for C++ or icx for C to compile your code or examples.
Also, you could add the following into your C++ code to check on the number of threads you are running.
std::cout << "mkl_get_max_threads = " << mkl_get_max_threads () << std::endl;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @RomanN, we have not heard back from you. The issue will no longer be monitored by Intel. Thank you for posting at oneMKL Community Forum.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page