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

include 'mkl_rci.fi' in a F90 interface

miramin
Beginner
1,318 Views
HI there,

I am trying to use the INTEL iterative solver RCI FGMRES and I am trying to run the INTEL example as my first step. I can't get the correct answers.

I am copying the code from INTEL example which is for a f77 compiler. I am changing the code from f77 to f95 but I am keeping the header file which is 'mkl_rci.f' .

As far as I know this header file is for a F77 interface. IS it okay to use this header file while having the rest of the code in F90 ?

I mean instead of "double precision" declarationsm I am using REAL*8 and INTEGER*8.

My final answer are all either infinity or NaN as mentioned in my other thread


http://software.intel.com/en-us/forums/showthread.php?t=74658


Is it possible to use a F77 interface header file in a F90 code ?


Thanks a lot.
0 Kudos
1 Solution
mecej4
Honored Contributor III
1,318 Views
Assuming that you meant 'mkl_rci.fi' rather than 'mkl_rci.f' as the include file, I'd suggest running the fixed format INTEL example and getting it to work before changing the code to free format F95.

Fortran 77 has one format for source files: fixed format, with statements starting in column-7,etc. Fortran 9x allows fixed format as well, but introduced free format -- each source file has to adhere to one of the two formats. Almost all of Fortran 77 is a subset of Fortran 9x.

There are some parts of fixed format Fortran source (e.g., line continuations) that are not compatible with free format. As long as the preprocessor output does not run afoul of these incompatibilities, there should be no problem.

The consequence of all this is that you do not have to make any changes to F77 code in order to compile it with an F9x compiler. There may be other reasons to change the code, but mere compiling is not reason enough.

View solution in original post

0 Kudos
7 Replies
Vladimir_Koldakov__I
New Contributor III
1,318 Views

Hello,

Could you please provide the updated example code?

How did you build example (command line(s))?

-Vladimir

0 Kudos
mecej4
Honored Contributor III
1,319 Views
Assuming that you meant 'mkl_rci.fi' rather than 'mkl_rci.f' as the include file, I'd suggest running the fixed format INTEL example and getting it to work before changing the code to free format F95.

Fortran 77 has one format for source files: fixed format, with statements starting in column-7,etc. Fortran 9x allows fixed format as well, but introduced free format -- each source file has to adhere to one of the two formats. Almost all of Fortran 77 is a subset of Fortran 9x.

There are some parts of fixed format Fortran source (e.g., line continuations) that are not compatible with free format. As long as the preprocessor output does not run afoul of these incompatibilities, there should be no problem.

The consequence of all this is that you do not have to make any changes to F77 code in order to compile it with an F9x compiler. There may be other reasons to change the code, but mere compiling is not reason enough.
0 Kudos
miramin
Beginner
1,318 Views

Hello,

Could you please provide the updated example code?

How did you build example (command line(s))?

-Vladimir

Vladimir ,

My comiler version is INTEL 10.1 and MKL library is 10.1. My code is also attached to this message.

I am using the follwoing command to compile my code :

ifort RCIFGMRES_INTEL.f90 -g -o ISS.exe -I /usr/local/compilers/Intel/mkl-10.1/include -L$MKL_HOME/lib/em64t -lmkl -lmkl_lapack -lguide -Wl,--start-group $MKL_HOME/lib/em64/libmkl_solver_ilp64_sequential.a $MKL_HOME/lib/em64t/libmkl_intel_ilp64.a $MKL_HOME/lib/em64t/libmkl_solver_ilp64_sequential.a $MKL_HOME/lib/em64t/libmkl_core.a -lpthread -Wl,--end-group

I can compile it , there is no error here!

But when I run it I get NaN values and infinity as follows :

The system has been solved

The following solution has been obtained:
COMPUTED_SOLUTION(1)= NaN
COMPUTED_SOLUTION(2)= -Infinity
COMPUTED_SOLUTION(3)= NaN
COMPUTED_SOLUTION(4)= Infinity
COMPUTED_SOLUTION(5)= NaN

The expected solution is:
EXPECTED_SOLUTION(1)=-0.100E+01
EXPECTED_SOLUTION(2)= 0.100E+01
EXPECTED_SOLUTION(3)= 0.000E+00
EXPECTED_SOLUTION(4)= 0.100E+01
EXPECTED_SOLUTION(5)=-0.100E+01

Number of iterations: 1
This example may have FAILED as either the number of iterations differs from the expected number of iterations 5 or the computed solution differs much from the expected solution (Euclidean norm is 0.0000000000000000E+00), or both.
1
[smirsa1@philip1 ISS]$


0 Kudos
miramin
Beginner
1,318 Views
Quoting mecej4
Assuming that you meant 'mkl_rci.fi' rather than 'mkl_rci.f' as the include file, I'd suggest running the fixed format INTEL example and getting it to work before changing the code to free format F95.

Fortran 77 has one format for source files: fixed format, with statements starting in column-7,etc. Fortran 9x allows fixed format as well, but introduced free format -- each source file has to adhere to one of the two formats. Almost all of Fortran 77 is a subset of Fortran 9x.

There are some parts of fixed format Fortran source (e.g., line continuations) that are not compatible with free format. As long as the preprocessor output does not run afoul of these incompatibilities, there should be no problem.

The consequence of all this is that you do not have to make any changes to F77 code in order to compile it with an F9x compiler. There may be other reasons to change the code, but mere compiling is not reason enough.

Hi mecej4,

I could compile the F77 EXAMPE Of INTEL[ Intel MKL RCI (P)FGMRES ((Preconditioned) Flexible Generalize Minimal RESidual method) example] with no problem with the following command :

ifort exm.f -g -o I.exe -I /usr/local/compilers/Intel/mkl-10.1/include -L$MKL_HOME/lib/em64t -lmkl -lmkl_lapack -lguide -Wl,--start-group $MKL_HOME/lib/em64t/libmkl_solver_ilp64_sequential.a $MKL_HOME/lib/em64t/libmkl_intel_ilp64.a $MKL_HOME/lib/em64t/libmkl_core.a -lpthread -lmkl -lmkl_lapack -lguide -Wl,--end-group -lpthread

but when I run it , it is aborted :

[smirsa1@philip1 ISS]$ ./I.exe
--------------------------------------------------
The SIMPLEST example of usage of RCI FGMRES solver
to solve a non-symmetric indefinite non-degenerate
algebraic system of linear equations
--------------------------------------------------
Aborted

Is there a debugger on INTEL I could use ?

0 Kudos
Gennady_F_Intel
Moderator
1,318 Views
Can you upload the exm.f file you are using?
why you link threaded and sequentional libraries together?
See the link advisor at the top of the forum - it will give you the proper linking line
Can you upload the exm.f file you are using?why you link threaded and sequentional libraries together?See the link advisor at the top of the forum - it will give you the proper linking line
--Gennady
0 Kudos
Gennady_F_Intel
Moderator
1,318 Views
quote: "Is there a debugger on INTEL I could use ?"Yes, sure. The Intel Debugger (IDB) is a component of Intel C++ and Intel Fortran Compilers and If you have installed Intel compiler then you have intel debugger also.
0 Kudos
miramin
Beginner
1,318 Views
Dear Gennady,

Finally, I could run the example successfully. And my result was right. The adminitrator on the system I am using, installed the latest version of MKL library (10.2) and my problems were all solved. The latest version of INTEL compiler and MKL version 10.1 do not go together, at least thsi was the case for me.

Thank you so much fo ryour input and help.

Amin
0 Kudos
Reply