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

difficulties in a program in which some blas work but ddot.

Achille_B_
Beginner
1,868 Views

Hi guys

I found a problem and maybe some of you could help-me.

In order to solve problems with a blas function in a bigger program, I've tried to make a shorter program to test linking options. So I can easily compile and run this short program with blas calls:

"

...

real(8):: a(6000,6000), b(6000,4000), c(6000,4000), d(6000), e(6000), alpha, beta
integer(8)::m, n, lda, ldb, ldc, i, j

uplo = 'u'
side = 'l'
m = 6000
n = 4000
lda = m
ldb = m
ldc = m
alpha = 0.5
beta = 2.0

...

call dsymv('u', 3000, alpha, a, 6000, d, 1, beta, e, 1)

call dsymm (side, uplo, m, n, alpha,a, lda, b, ldb, beta, c, ldc)

..."

With this simple command: ifort teste_mkl.f90 -mkl
And no "use" statement in the source code. However, if i try uncomment:

"

...

i=1

alpha=ddot(m, d, i, e, i)

...."

or

"

....

alpha=ddot(6000, d, 1, e, 1)

..."

I get the message

"teste_mkl.f90(51): error #6404: This name does not have a type, and must have an explicit type.   [DDOT]
alpha= ddot(m, d, i, e, i)
-------^
compilation aborted for teste_mkl.f90 (code 1)"

When I replace ddot f77 call by dot(d,e) f95 call, add "use mkl_blas95" and "use mkl_lapack95" in the source code and compile with "ifort -mkl teste_mkl.f90 -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64" every thingworks fine.

But I don't want to use blas95 (portability issues). What I'm doing wrong with ddot f77 call? I can compile and use other blas routines through f77 call without problems in the same program.

Thanks for your attention.

0 Kudos
4 Replies
TimP
Honored Contributor III
1,868 Views

You must have included IMPLICIT NONE or equivalent (which is good practice).  Then you need a declaration of ddot, such as you might find by

include 'mkl_blas.fi'

If your program has portability problem with blas95, it might be good to correct it.

0 Kudos
Achille_B_
Beginner
1,868 Views

Hi TimP

I used "use mkl_blas" instead of using "include 'mkl_blas.fi'". I always include "implicit none below the last use statement".

I don't know the effective difference between use and include statements, I always write use statements in my source codes.

Including your suggestion and using " ifort -mkl teste_mkl.f90" to compile I got the following error message:

"

teste_mkl.f90(3): error #5102: Cannot open include file 'mlk_blas.fi'
include 'mlk_blas.fi'
--------^
teste_mkl.f90(51): error #6404: This name does not have a type, and must have an explicit type.   [DDOT]
alpha= ddot(m, d, i, e, i)
-------^
compilation aborted for teste_mkl.f90 (code 1)
"

with include statement and

"

teste_mkl.f90(4): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MKL_BLAS]
use mkl_blas
----^
teste_mkl.f90(5): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MKL_LAPACK]
use mkl_lapack
----^
teste_mkl.f90(52): error #6404: This name does not have a type, and must have an explicit type.   [DDOT]
alpha= ddot(m, d, i, e, i)
-------^
compilation aborted for teste_mkl.f90 (code 1)
"

with use statement.

   It's important to emphatize that when I remove the use or include statement and comment the line with ddot calling, I can compile ( ifort -mkl teste_mkl.f90) and execute (./a.out) dsymm and dsymv callings without problems or warnings.

    As the new versions of ifort/mkl don't complain about lack of "use mkl_blas" and "use mkl_lapack", I stopped putting them within my source codes, i just add -mkl option in the compile command, which is sufficient to build programs with shared parallel version of mkl. So I write use statements and compile with the full link advisor prescription just when something goes bad. Do you think I should change my behavior?

Thanks.

0 Kudos
Vamsi_S_Intel
Employee
1,868 Views

You have a typo in your include 'mkl_blas.fi'  statement,

teste_mkl.f90(3): error #5102: Cannot open include file 'mlk_blas.fi'
include 'mlk_blas.fi'

DDOT is a Fortran function that returns a double precision value, whereas DSYMM, DSYMV are Fortran Subroutines and so you need to include the appropriate interface file that contains the type information of the function.

Could you try it again after fixing the typo?

0 Kudos
Achille_B_
Beginner
1,868 Views

Thanks TimP and Vansi

Fixing the typo solved the problem.

But I still can't understand:

- why DSYMM and DSYMV that are blas levels 3 and 2 subroutines don't require include statement to work properly but DDOT (blas level 1) requires;

- And why include 'mkl_blas.fi' works and use mkl_blas doesn't. If I write the f95 interface dot(d,e), a use mkl59_blas before implict none works fine.

Best Regards

Arantes

0 Kudos
Reply