- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any problem calling BLAS functions zdotc, zdotu in recent version of MKL?
When calling these functions from a C-code using recent version of the MKL, the code crashes or returns fault values. It works properly when using soft-coded FORTRAN BLAS. I am using LINUX, I tried three different versions of the MKL (2018.5.274, 2019.1.144 und 2019.3.199).
Here is how I call the MKL
cc -O -fPIC -fopenmp -m64 -mcmodel=medium -I $MKLROOT/include test.c -L $MKLROOT/lib -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lm
Here is a sample C-code
#include <stdio.h>
#include <stdlib.h>
typedef struct { double r, i; } doublecomplex;
doublecomplex zdotc_(int *,doublecomplex *,int *, doublecomplex *,int *),
zdotu_(int *,doublecomplex *,int *, doublecomplex *,int *);
#define N 4
int main(int argc, char **argv)
{
doublecomplex *v, *w, val;
int i=N,j=1,k=2,l,m;
v=(doublecomplex *)malloc((size_t)N *sizeof(doublecomplex));
w=(doublecomplex *)malloc((size_t)2*N*sizeof(doublecomplex));
for (l=0; l<N; l++) {
v
w
w[N+l].r= 1.0; w[N+l].i= 0.0;
}
val=zdotc_(&i, v,&j, w,&k);
printf("val=(%8.1le,%8.1le)\n",val.r,val.i);
val=zdotu_(&i, v,&j, w,&k);
printf("val=(%8.1le,%8.1le)\n",val.r,val.i);
free(v);
free(w);
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The example has been build against mkl_threading, lp64 modes and then tested on AVX, AVX2 and AVX-512 based systems with MKL_VERBOSE mode enabled:
AVX - 512:
MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 2.20GHz lp64 intel_thread
MKL_VERBOSE ZDOTC(0x7ffef279cc00,4,0x24e80c0,1,0x24f92c0,2) 162.29ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:28
zdotc : val=( 1.0e+00,-2.0e+00)
MKL_VERBOSE ZDOTU(0x7ffef279cc00,4,0x24e80c0,1,0x24f92c0,2) 17.16us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:28
zdotu : val=(-1.0e+00, 6.0e+00)
AVX2:
./test_zdot.out
MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Lnx 2.20GHz lp64 intel_thread
MKL_VERBOSE ZDOTC(0x7ffd3aefbf80,4,0x1d560c0,1,0x1d672c0,2) 2.23ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:44
zdotc : val=( 1.0e+00,-2.0e+00)
MKL_VERBOSE ZDOTU(0x7ffd3aefbf80,4,0x1d560c0,1,0x1d672c0,2) 7.40us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:44
zdotu : val=(-1.0e+00, 6.0e+00)
AVX:
./test_zdot.out
MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions (Intel(R) AVX) enabled processors, Lnx 2.80GHz lp64 intel_thread
MKL_VERBOSE ZDOTC(0x7ffe7aec0e00,4,0xca40c0,1,0xcb52c0,2) 2.79ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:20
zdotc : val=( 1.0e+00,-2.0e+00)
MKL_VERBOSE ZDOTU(0x7ffe7aec0e00,4,0xca40c0,1,0xcb52c0,2) 13.45us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:20
zdotu : val=(-1.0e+00, 6.0e+00)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
forget to add: applying with compiler's options you use, didn't chanched changed nothing:
icc -O -fPIC -fopenmp -m64 -mcmodel=medium -mkl test_zdot.cpp -o test_zdot.out
./test_zdot.out
MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 2.20GHz lp64 intel_thread
MKL_VERBOSE ZDOTC(0x7ffe42d70b80,4,0x1b000c0,1,0x1b112c0,2) 2.87ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:28
zdotc : val=( 1.0e+00,-2.0e+00)
MKL_VERBOSE ZDOTU(0x7ffe42d70b80,4,0x1b000c0,1,0x1b112c0,2) 18.40us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:28
zdotu : val=(-1.0e+00, 6.0e+00)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page