- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I try to use intel MKL with DPC++ compiler, and reports "Unhandled exception at 0x00007FF61B91397A in test_parallel.exe: 0xC0000005: Access violation reading location 0x000002239F286444."
Below is my code to test MKL function:
int main()
{
//cl::sycl::stream cout(1024, 256);
int a = 1, b = 1;
int n = 5;
float* A = (float*)mkl_malloc(n * 1 * sizeof(float), 64);
float* B = (float*)mkl_malloc(n * 1 * sizeof(float), 64);
printf("The 1st vector is ");
for (int i = 0; i < n; i++) {
A[i] = i;
printf("%2.0f", A[i]);
}
printf("\n");
printf("The 2st vector is ");
for (int i = 0; i < n; i++) {
B[i] = i + 1;
printf("%2.0f", B[i]);
}
printf("\n");
//compute:a*A+b*B
cblas_saxpby(n, a, A, 1, b, B, 1);
printf("The a*A+b*B is ");
for(int i = 0; i < n; i++) //this is where the above error is reported
{
printf("%2.0f", B[i]);
}
printf("\n");
mkl_free(A);
mkl_free(B);
//getchar();
return 0;
}
The above code works when i use Intel C++ compiler, and i am sure intel DPC++ compiler is correctly installed because i have tested a vector-add program before.
I wonder if DPC++ compiler works with Intel MKL.
Thanks~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in Intel Communities.
>>I wonder if DPC++ compiler works with Intel MKL.
Yes, Intel MKL will work with Intel Classic compiler(icc,icpc), Intel LLVM compilers( ICX, ICPX, DPC++) as well as Fortran. Please find this link for the MKL System Requirements as well.
We tried the sample code provided by you and we are able to get the expected results without any error in the Microsoft Visual Studio 2019 and 2022 using the latest Intel oneAPI MKL and DPC++ compiler. Please find the below screenshot for the results:
Please find the below screenshot for the project properties settings to use Intel MKL with the DPCPP compiler in Visual Studio:
Also, we tried running the code on the Intel oneAPI command prompt and we are able to get the expected results:
For compiling the code: dpcpp -qmkl <filename>.cpp
use of 'dpcpp' is deprecated and will be removed in a future release. Use 'icpx -fsycl'
So, you can use for compiling: icpx -fsycl -qmkl <filename>.cpp
For running the code: a.exe
Also, you can use the Intel Link Line Advisor for the exact commands for compiling and linking the code with several compilers and third-party libraries and it provides different interfaces to the functionality. Please find the below link for more details:
Could you please try these and let us know if you are facing any issues?
Thanks & Regards,
Varsha
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in Intel Communities.
>>I wonder if DPC++ compiler works with Intel MKL.
Yes, Intel MKL will work with Intel Classic compiler(icc,icpc), Intel LLVM compilers( ICX, ICPX, DPC++) as well as Fortran. Please find this link for the MKL System Requirements as well.
We tried the sample code provided by you and we are able to get the expected results without any error in the Microsoft Visual Studio 2019 and 2022 using the latest Intel oneAPI MKL and DPC++ compiler. Please find the below screenshot for the results:
Please find the below screenshot for the project properties settings to use Intel MKL with the DPCPP compiler in Visual Studio:
Also, we tried running the code on the Intel oneAPI command prompt and we are able to get the expected results:
For compiling the code: dpcpp -qmkl <filename>.cpp
use of 'dpcpp' is deprecated and will be removed in a future release. Use 'icpx -fsycl'
So, you can use for compiling: icpx -fsycl -qmkl <filename>.cpp
For running the code: a.exe
Also, you can use the Intel Link Line Advisor for the exact commands for compiling and linking the code with several compilers and third-party libraries and it provides different interfaces to the functionality. Please find the below link for more details:
Could you please try these and let us know if you are facing any issues?
Thanks & Regards,
Varsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your prompt and helpful response!
You are right about the project properties settings in this screenshot:
I used the DPC++ API instead of "ILP64" interface. This may be the cause of my error.
Thank you once again for taking the time to address my question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
>>Thank you for your prompt and helpful response!
It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.
Have a Good Day!
Thanks & Regards,
Varsha
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page