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

/iface option cause mkl_dcsrmm error

Jing_Q_
Beginner
904 Views

I tried test the MKL subroutine mkl_dcsrmm on my 64-bit windows 7 with visual studio 2010 and Intel Fortran composer 2013. If I set the /iface as default, the subroutine mkl_dcsrmm worked fine. But once I changed /iface option as /iface:mixed_str_len_arg, the mkl_dscrmm reported error. Here is my code

          program test
          implicit none
          integer  m,  nnz, mnew, nnz1
          parameter( m = 5,  nnz=13, mnew=3, nnz1=9)
          real*8  values(nnz), values1(nnz1)
          integer columns(nnz), rowIndex(m+1), columns1(nnz1), rowIndex1(m+1)
          integer pointerB(m) , pointerE(m)

!    Sparse representation of the matrix A
          data values/1.d0, -1.d0, -3.d0, -2.d0, 5.d0,4.d0, 6.d0, 4.d0, -4.d0, 2.d0, 7.d0, 8.d0, -5.d0/
          data rowIndex/1, 4,  6,  9,  12, 14/
          data columns/1, 2, 4, 1, 2, 3, 4, 5, 1, 3, 4, 2, 5/

!    Declaration of local variables :
          integer n
          parameter (n=2)
          real*8 rhs(m, n), sol(m, n), temp(m, n)
          data sol/1.D0, 1.D0, 1.D0, 1.D0, 1.D0,5.D0, 4.D0, 3.D0, 2.D0, 1.D0/
          real*8 alpha, beta
          data alpha/1.d0/, beta/0.d0/
          integer i, j, is           
          
          call mkl_dcsrmm('t', m, n, m, alpha, 'tln', &
                values, columns, rowIndex, rowindex(2), sol, m,  beta, rhs,  m)
          end  program test

How can I fix it?  Thanks in advance.

Jing

0 Kudos
7 Replies
mecej4
Honored Contributor III
904 Views

As far as I know, there is no version of the routine mkl_dscrmm in MKL that is compatible with /iface:mixed_str_len_arg. If you do not need that convention for other routines called from your program, the solution is: simply do not use /iface:iface:mixed_str_len_arg.

If you need to call non-MKL routines with mixed string length arguments, provide that information by adding !dec$attributes directives in subprograms that call those routines.

0 Kudos
Ying_H_Intel
Employee
904 Views

Hi Jing, 

Mecej4 is right. it is better don't use the /iface:mixed_str_len_arg. 

If you still perfer to such rule,  MKl have supported Compaq visual Fortran*(CVF) (only 32bit), under this calling conversion, the mixed_str_len_arg is allowed.  For example, iface:cvf + mixed_str_len_arg (default) + mkl_intel_s.lib may work.

Best Regards,

Ying

here is some discription on MKL userguide

Although Compaq no longer supports the Compaq Visual Fortran* (CVF) compiler, Intel
MKL still preserves the CVF interface in IA-32 architecture implementations. This interface
can be used with the Intel® Fortran Compiler by employing the /Gm compiler option. In the
following discussion, stdcall is actually the CVF compiler default compilation, which
differs from stdcall in the way strings are passed to the routine.
There are both cdecl (default interface of the Microsoft Visual C* application) and stdcall
(default CVF interface) versions of the library. The cdecl version is called mkl_c.lib and
the stdcall version is called mkl_s.lib. Their counterparts for dynamic libraries are
mkl_c_dll.lib and mkl_s_dll.lib. Whether you choose to link with cdecl or stdcall,
depends on factors that only you can determine

Using the CVF compiler
Similarly, the CVF compiler will link with mkl_s[_dll].lib if routines are compiled
with the default interface. However, if you compile with the option
/iface=(cref,nomixed_str_len_arg), the compiler will link with
mkl_c[_dll].lib .
• Using the Intel® Fortran compiler
The Intel Fortran compiler will link with mkl_c[_dll].lib by default. If the /Gm
option is used, call mkl_s[_dll].lib (/Gm enables CVF and Powerstation calling
convention compatibility, so does /iface:cvf).

0 Kudos
Jing_Q_
Beginner
904 Views

Mecej4 and Ying:

Thanks a lot for your response and explanation. The option of  /iface:mixed_str_len_arg is required by my customer. I guess I have to develop the code instead of using MKL library to perform the multiplication between sparse and dense matrix.

Jing

0 Kudos
Jing_Q_
Beginner
904 Views

Hello, Mecej4 and Ying:

I composed as code similar to mkl_dcsrmm and test three subroutines: mkl_dcsrmm, dcsrmm in NIST sparse BLAS library and my code. It turns out that mkl_dcsrmm runs much faster than dcsrmm. Just wondering whether the algorithms used in mkl_dcsrmm is different with dcsrmm in sparse BLAS. If so, are the algorithms available to public.   

0 Kudos
Ying_H_Intel
Employee
904 Views

Hi Jing,

From the math perspective, the algorithm itself should same, to computes matrix - matrix product of a sparse matrix stored in the CSR format. But they may use different optimizate method to accelerate the functions. Regarding optimize methods, it may depend on many factors, for example, http://en.wikipedia.org/wiki/Program_optimization and  Intel® 64 and IA-32 Architectures Optimization Reference Manual.  That is  kernel value of MKL provide to developers.

Best Regards,

Ying

0 Kudos
Ying_H_Intel
Employee
904 Views

Hi Jing,

One more question, are you building 64bit or 32bit application?  or if use other third-party library?

As i mentioned, if you only build 32bit application and no other library,  you can use cvf call conversion and iface:mixed  with mkl_intel_s.lib.

Best Regards,

Ying

0 Kudos
Jing_Q_
Beginner
904 Views

Hi, Ying:

I am building 64-bit application with Intel Visual Fortran now. That's why I can't use mkl_intel_s.lib. :(  Since the computational efficiency is really critial in my currrent project, I have to look for the most efficient way.  Unfortunately, I don't know much about the code and compiler optimizaion.Whatever, thank you very much again!

Jing

0 Kudos
Reply