如何确定DPC++编译器是否与Intel MKL兼容?

huangapple go评论70阅读模式
英文:

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”接口,这导致了问题。

如何确定DPC++编译器是否与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.

如何确定DPC++编译器是否与Intel MKL兼容?

huangapple
  • 本文由 发表于 2023年5月25日 16:57:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76330510.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定