Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

oneMKL Lapack functions with DPC++ compiler

FelipeDicler
Beginner
783 Views

I am getting the following error employing lapack functions with DPC++ compiler


Error no matching function for call to 'dgeqrf_' VectorFittingOptimization 

 

1>C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include/mkl_lapack.h(15252,6): note: candidate function not viable: no known conversion from 'integer *' (aka 'long *') to 'const int *' for 1st argument
1>void dgeqrf_( const MKL_INT* m, const MKL_INT* n, double* a,
1> ^

 

The same code runs properly with C++ Compiler Classic and Visual C++.

 

Thank you.

0 Kudos
5 Replies
IntelSupport
Community Manager
734 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Could you please let us know the OS details, Intel MKL you are using?

 

Also, could you please provide us with the complete sample reproducer code you are using to reproduce the similar behavior and investigate more at our end?

 

Thanks & Regards,

Jilani


0 Kudos
FelipeDicler
Beginner
693 Views

Hi,

Thank you for your support.

 

While writing a minimum example, it turned out that the problem is related to the type of int variables that my mkl function needs. I was using long int. It works for Visual C++ and Intel C++ Classic, but gives the above error with DPC++. Changing the types to int solves the problem. 

 

OS:  Windows 11, 22H2

Intel MKL 2023.2

Visual Studio 2022 17.1.0

 

 

Here is my code

 

#define ALLOC_FACTOR_DGEQRF 0.01
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <mkl.h>
 
 
int main(void)
{
 
int     m = 2000;
int     n = 100;
int     lda = m;
int     lwork = ((int)(ALLOC_FACTOR_DGEQRF * m * n) / 64 ) * 64;
 
//long int     info;  // -> arises conversion error
int     info;
 
double* tau = (double*)mkl_malloc(n * sizeof(double), 64);
double* work = (double*)mkl_malloc(lwork * sizeof(double), 64);
double* A = (double*)mkl_malloc(m * n * sizeof(double), 64);
 
double check = 0;
 
//  Filling matrix A with ones
for (int k = 0; k <= m * n; ++k) A[k] = 1;
 
 
clock_t start_time, end_time;
start_time = clock();
 
dgeqrf_(&m, &n, A, &lda, tau, work, &lwork, &info);
 
for (int k = 0; k <= m * n; ++k) check = check + A[k];
 
printf("Checksum  %20.20f\n", check);
 
 
end_time = clock();
 
// Calculate execution time in seconds
double execution_time = ((double)(end_time - start_time)) / CLOCKS_PER_SEC;
 
printf("\nDGEQRF Execution Time: %.6f seconds\n", execution_time);
 
double gflops = (2.0 / 3.0) * n * n * (3 * m - n) / (execution_time * 1e9); // (2/3)n2(3m-n) for m > n
 
// Print the performance results
 
printf("Matrix Size: %d x %d\n", m, n);
//printf("Execution Time: %.6f seconds\n", end_time - start_time);
printf("GFLOPS: %.2f\n", gflops);
 
mkl_free(tau);
mkl_free(work);
mkl_free(A);
 
 
    return 0;
}
 
 
 
 
 
 
0 Kudos
IntelSupport
Community Manager
586 Views

Hi,



Intel DPC++ compiler(dpcpp) is used to execute the C++ with SYCL code. Intel C++ compiler is only used to execute the C++ source code. Because of this, the sample code runs without any compilation issues on Intel C++ classic.

 

If long int is required rather than int, we can do explicit casting as seen below. This will solve the compilation error.

dgeqrf_(&m, &n, A, &lda, tau, work, &lwork, ((int*) & info));



Regards,

Jilani


0 Kudos
IntelSupport
Community Manager
479 Views

Hi,

 

A gentle reminder:

Have you found the information to be useful? Could you please provide us with an update on your issue?

 

 

Regards,

Jilani

 

0 Kudos
JilaniS_Intel
Moderator
404 Views

Hi,



We have not heard back from you. Could you please provide us with an update?



Regards,

Jilani


0 Kudos
Reply