Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28630 Discussions

how to invoke MKL in real*16 data type, and how to write my own dble function using fortran?

bsmile_2nd
Beginner
403 Views

Two questions,

(1) Can I invoke functions in MKL in real*16 data type? How to do that?

(2) If I want to write my own "dble" function using fortran, is it possible to do? The difficulty seems to me is that the sent over actual parameter can be arbitrary byte length, say, int, real, complex, etc, but I have to preset the formal parameter to be a specific type ...

Thanks a lot!

0 Kudos
4 Replies
TimP
Honored Contributor III
403 Views

1) MKL doesn't support real*16. If you search the MKL forum, you will find responses to this question. You could build such subroutines yourself, from public source, and get as much performance as could be achieved if MKL supported them.

2) You could replace the standard dble() intrinsic with a generic function of your own, but it might be better to use your own name for it. You would supply a function for each case of data types, with an INTERFACE block to define the generic name.

0 Kudos
Steven_L_Intel1
Employee
403 Views
You can extend a generic such as DBLE, but it is not clear to me what you have in mind. If you wanted to replace the intrinsic DBLE you can do so by defining a generic with specific procedures covering all of the possible argument types.

By the way, if anyone else has to maintain code where you did that, I hope you apply for the "witness protection program" as they will not be happy with you!
0 Kudos
bsmile_2nd
Beginner
403 Views

The question about writing one's own dble function is related with the scope what fortran can do. If you think it a bit carefully, you will see that you cannot write your own dble within Fortran 77, simply because of the reason I mentioned before. I don't know whether it could be written using the current Fortran standard.

0 Kudos
Steven_L_Intel1
Employee
403 Views
In Fortran 90 you can "write your own DBLE" as a generic with multiple specific procedures. Fortran 90 even allows you to "add" a case to DBLE that is not covered in the language, for example, DBLE(character-arg) without disturbing the standard meaning for other arguments.

What I read that you wanted was to change the meaning of DBLE so that it returns a type that is not "double precision". You CAN do that in Fortran 90, but I would strongly urge you not to do so for the sake of program clarity and maintainability.
0 Kudos
Reply