1

I'm learning Fortran and using the Intel compiler.

Here is some code that I wrote. I want to define the print_array interface in the arraytools module, and all the specific implementations (e.g. print_array_rp) should go into a seperate sub-module. The following works, but if I split the implementation into a submodule, I get a huge amount of compiler errors (I suppose it cant find the implementation anymore).

module arraytools
use precision

implicit none

    interface print_array
        module procedure print_array_rp
    end interface

contains

    subroutine print_array_rp(arr, fmt_in)
       ! ... Implementation not important
    end subroutine

end module

How do I split print_array_rp off into a sub-module? I don't want to use #include instead.

3
  • @HighPerformanceMark For starters, can't we just place the submodule and module in the same file? Doing that, I get a whole bunch of errors, but I guess the most important one is error #7950: Procedure name in MODULE PROCEDURE statement must be the name of accessible module procedure. [PRINT_ARRAY_RP] Commented May 14, 2015 at 12:54
  • 3
    I also can't answer the question, but as far as I can tell the Intel compiler doesn't support submodules. If you don't mean "submodule" in the strict sense, you may need to explain what you do mean (with code). Commented May 14, 2015 at 13:01
  • @francescalus You're right, I just found out it doesn't. Commented May 14, 2015 at 13:03

1 Answer 1

2

Submodules are not implemented in current Fortran compilers (unless you happen to be using the Cray compiler).

Only the Cray Fortran compiler implements the entire Fortran 2008 standard (thanks to VladimirF for pointing this out). Among the most poorly supported features among the other compilers are submodules.

The Fortran 2008 status wiki page (last modified Nov 2014 at the time of this post) lists Cray Fortran 8.1.1 as supporting submodules and Absoft 14, gfortran 4.8, HP, ifort 14.1, NAG 5.3.1, Oracle, Pathscale 4 and pgi 14.1 as not supporting submodules. As far as I am aware, none of these compilers has added support for submodules since then.

As noted in the comments below by Steve "Dr. Fortran" Lionel, Intel Fortran will gain submodule support in version 16 to be released later this year.

Sign up to request clarification or add additional context in comments.

3 Comments

AFAIK Cray claims to support the whole Fortran 2008. The only N in that table is strange. Cray does support DO CONCURRENT.
Thanks for the link to the table. As a newbie to Fortran its surprising to see so much red.
ifort will be adding submodules in the 16.0 release later this year. We have an open beta you can try - see software.intel.com/en-us/forums/topic/549311 As for the "Fortran Wiki", that chart is a copy of one updated three times a year and published in Fortran Forum, an ACM publication.dl.acm.org/citation.cfm?id=J286 You can read the current issue there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.