英文:
How to determine if DPC++ compiler works with intel MKL?
问题
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 2nd 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~
英文:
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~
答案1
得分: 0
我在英特尔论坛上提出了这个问题,版主解决了这个问题。
问题是由我的项目属性设置引起的:我使用了DPC++ API而不是“ILP64”接口,这导致了问题。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论