Hello everyone:
I wrote a sample program about matrices multiply. I used the zgemm function of cblas in mkl. I wanted to link it staticly. I tried many methods, but only dynamic link worked correctly. It seems that I can’t link the program staticly.
My IDE is Visual Studio 2022, my mkl is oneapi 2022.
The dynamic link steps is as follow:
(1) project>property>Intel libraries for oneAPI>use onemkl>sequential
The static link steps is as follow:
(1) project>property>Intel libraries for oneAPI>use onemkl>sequential
(2) project>property>link>input>Additional dependencies add mkl_intel_ilp64.lib mkl_sequential.lib mkl_core.lib
I desire to know how to static link the mkl. The dlls of mkl is to heavy.
My sample codes:
_____________________________________________________________
#include <iostream>
#include<complex>
#define MKL_Complex8 std::complex<float>
#define MKL_Complex16 std::complex<double>
#include <mkl.h>
int foo()
{
MKL_Complex16 _alpha[1] = { { 0.23, 3.11 } };
MKL_Complex16 _beta[1] = { { 1.2, -0.72 } };
MKL_Complex16 A[6] = { {1.56, 0.1}, {2.06, 0.38},{ 6.32, 0.43}, {-3.22, 0.4}, {-2.78, 1.15}, {3.01, 0.6} };
MKL_Complex16 B[12] = { {1.11, -1.0}, {2.45, 2.37}, {3.76, 0.0}, {6.32, 0.43}, {1.11, 1.0}, {2.45, 0.04}, {3.67, 0.8}, {6.32, 0.43}, {1.11, -1.0}, {2.45, 0.63}, {3.76, 0.0}, {6.32, 0.43} };
MKL_Complex16 C[8] = { {0.0, 0.0}, {0.0, 0.1}, {1.0, 0.1}, {1.0, 0.0}, {0.0, 0.0}, {0.0, 0.1}, {1.0, 0.1}, {1.0, 0.0} };
cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 2, 4, 3, _alpha, A, 3, B, 4, _beta, C, 4);
for (int i = 0; i < 8; ++i)
{
std::cout << C[i].real << “,” << C[i].imag << std::endl;
}
return 0;
}
int main()
{
foo();
}
______________________________________________________________________
Thanks for apply.