Join 2 FORTRAN Codes: Problem Solved w/ Intel Compiler & Linux

  • Context: Fortran 
  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    Fortran Subroutine
Click For Summary

Discussion Overview

The discussion revolves around the challenge of integrating two FORTRAN codes, where one serves as the main program and the other performs calculations related to geophysics. Participants explore potential methods for combining these codes, particularly in the context of using the Intel Fortran compiler on a Linux system.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses uncertainty about whether the second code can be represented as a subroutine due to its size and complexity, suggesting the possibility of one executable calling the other.
  • Another participant identifies issues with using the second program as a module, citing specific error messages related to the placement of OPEN statements within the module's specification part.
  • A later reply points out that the OPEN statements in the second program are incorrectly placed and suggests that variable declarations should be moved above any executable statements to resolve the errors.
  • Another suggestion is made to either merge the second program into the first to create a single source file or to adapt the routines of the second program for compilation into a callable code library.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to integrate the two codes, as multiple strategies are proposed and debated.

Contextual Notes

Limitations include the specific errors encountered with the module implementation and the potential complexity of merging large codebases. The discussion does not resolve the best method for integration.

Who May Find This Useful

Readers interested in FORTRAN programming, code integration, and those facing similar challenges in combining large codebases may find this discussion relevant.

Milentije
Messages
47
Reaction score
0
I have a problem,actually I want to join two FORTRAN codes.One of them is main and the other calculates some issues(geophysics stuff).I am not sure that the second code can be represented as subroutine because it has 2000+ lines,with 10 subroutines inside itself.How to solve this?Is it possible that one executable calls the other?I am working on Linux,with Intel Fortran compiler.
 
Technology news on Phys.org
I need interface between two programs.I can not put second program as module cause I get errors like this:
mt2ddib1.for(23): error #6274: This statement must not appear in the specification part of a module
open(2,file='test_p7.dat',status='old')
--------^
mt2ddib1.for(29): error #6274: This statement must not appear in the specification part of a module
open(3,file='test_sh7.dat',status='old')
--------^
mt2ddib1.for(30): error #6274: This statement must not appear in the specification part of a module
open(4,file='test_res.dat',status='old')
--------^
mt2ddib1.for(35): error #6274: This statement must not appear in the specification part of a module
open(50,file='e.dat',status='unknown')
 
The four OPEN statements are in the wrong places. Apparently mt2ddib1.for has some variable declarations somewhere after line 35. The declarations need to be moved so that they are above any executable statements (such as your OPEN statements).
 
If you have the source code for the second program, you can either merge it into the first program and make one composite source file, or you can adapt the routines of the second program so that they can be compiled and collected into a code library which is callable by the first program.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
12K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K