Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
7234 Discussions

BLAS LAPACK Intel Compilers in Visual Studio 2005 IDE

wolfee
Beginner
722 Views

Hello,

As a start, I'm just trying to run Example 7.2 from the Intel Math Kernal Library User Guide. It is an example of calling a complex BLAS Level 1 from C++. I am attempting to run the example in Visual Studio 2005. The example is listed at the very end of this entry for completeness.

Here is the problem - > For some reason I keep getting an error regarding duplication of the zdotc function. The exact error follows. Can anyone help?

------ Build started: Project: BLAS_EXAMPLE, Configuration: Debug Win32 ------
Compiling with Intel C++ 10.1.011 [IA-32]... (Intel C++ Environment)
BLAS_LEVEL_1.cpp
.\BLAS_LEVEL_1.cpp(3): error: more than one instance of overloaded function "zdotc" has "C" linkage
extern "C" void zdotc(complex16*, int *, complex16 *, int *, complex16*, int *);
^

compilation aborted for .\BLAS_LEVEL_1.cpp (code 2)
Build log was saved at "file://C:\CARL\DEVELOPMENT\RESEARCH\200811WORK\LEARN_INTEL_MTL\BLAS_EXAMPLE\BLAS_EXAMPLE\Debug\BuildLog.htm"
BLAS_EXAMPLE - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

code listing follows ------------------------------------

#include "mkl_blas.h"
typedef struct{ double re; double im; } complex16;
extern "C" void zdotc(complex16*, int *, complex16 *, int *, complex16*, int *);
#define N 5

int main()
{
int n, inca = 1, incb = 1, i;
complex16 a, b, c;
n = N;
for( i = 0; i < n; i++ ){
a.re = (double)i; a.im = (double)i * 2.0;
b.re = (double)(n - i); b.im = (double)i * 2.0;
}
zdotc(&c, &n, a, &inca, b, &incb );
//printf( "The complex dot product is: ( %6.2f, %6.2f)\n", c.re, c.im );
}

0 Kudos
2 Replies
Andrey_Bespalov
New Contributor I
722 Views

Your declaration of zdotc (void zdotc(complex16*, int *, complex16 *, int *, complex16*, int *);) conflicts with declaration in mkl_blas.h (void zdotc(MKL_Complex16 *pres, const MKL_INT *n, const MKL_Complex16 *x, const MKL_INT *incx, const MKL_Complex16 *y, const MKL_INT *incy);)

0 Kudos
Gennady_F_Intel
Moderator
722 Views

As an additional info, please pay attention the Note into mkl manual:

NOTE. Instead of calling BLAS directly from C programs, you might wish to use the

CBLAS interface; this is the supported way of calling BLAS from C. For more information

about CBLAS, see Appendix D , which presents CBLAS, the C interface to the Basic Linear

Algebra Subprograms (BLAS) implemented in Intel MKL.

And you can find the appropriate examples of using CBLAS Interface to the BLAS into

${MKLROOT}examplescblassource

--Gennady

0 Kudos
Reply