mixing fortran77 and fortran95 interfaces

mixing fortran77 and fortran95 interfaces

Dear all,

I programmed my code with the fortran 77 interfaces. However I was wondering if that is possible to mix fortran77 and fortran95 routines. For instance, looking at the sparse blas level 2 routine, mkl_dcsrmv, it is not explicitly stated that it has a fortran77 and fortran95 interface. It is only mentioned that it has a Fortran interface.

If this is possible how can I do this? Which modules should be used without conflicting?

Best regards,

Umut

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

What you call "F77 interfaces" and "F95 interfaces" differ only in that the former use fixed source format. Both produce, after compilation, identical module files, which can be USEd in either free or fixed source code. It is even possible to switch between fixed and free format in a single source file using directives, but that is non-portable and is not recommended. 

Instead of using interface declarations by including *.fi files, it is better to use the compiler to build the *.mod files from these include files, and USE the modules in your source code. Doing so makes it unnecessary to recompile the voluminous source code in the *.fi files in every project where they are needed.

Quote:

mecej4 wrote:

Instead of using interface declarations by including *.fi files, it is better to use the compiler to build the *.mod files from these include files, and USE the modules in your source code. Doing so makes it unnecessary to recompile the voluminous source code in the *.fi files in every project where they are needed.

Ok, then if I am using the fortran95 inteface with USEs, for instance,

use mkl_service
use mkl95_precision
use mkl95_blas

Then what I understood from above there should be some equivalent 77 versions as well, am I correct?

if yes, where can I find them? To use the 77 versions, I was always including the 'mkl.fi' files, however, now I understood from the above explanation that compiling into mod files is also possible. I am learning fortran recently with a fast pace coming from a programming experience in C/C++.

 

Best Reply

Quote:

Then what I understood from above there should be some equivalent 77 versions as well, am I correct?

No. Consider, for example, the file mkl_lapack.fi. Inspection of the source file, which is in the mkl/include directory, shows that it is in fixed format. Therefore, one can create a fixed format source file, say, "lapacki.f", containing the following:

C source code for building module
      module lapack
      include 'mkl_lapack.fi'
      end module

After compiling this file, one can say "USE LAPACK" in free format source code as well as fixed format source code.

Leave a Comment

Please sign in to add a comment. Not a member? Join today