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.
I asked this question in the Intel forum and the moderator solved this problem.
The problem is caused by my project property setting: I used the DPC++ API instead of the "ILP64" interface, which make things go wrong.