Skip to content

I/O issues #22

Description

@jabl

Hello,

I recently became aware of this project and took a look, and I have to say it's a really nice example of well written modern Fortran. One thing that raised my eyebrow was the handling of I/O, which seems a bit convoluted. Part of this might be due to the need to interface with matlab (a topic on which I'm not familiar with myself), but some issues are, I think, fixable.

  1. The use of a hard-coded unit number (OUTUNIT = 42). This can lead to issues if an application that uses PRIMA accidentally uses the same unit number for it's own use. Luckily modern Fortran has a solution for this, namely the newunit= specifier for the open statement. By using newunit= the Fortran runtime library assigns a unit number which is guaranteed to not be in use. Similar to fopen in MATLAB and C, or open in POSIX.
  2. Reopening and closing the file for every message. It would be more efficient to open the file once when writing the first message, and then only close it at the end of the optimization.
  3. For integrating into other applications or higher level environments like scipy, I wonder if it would be more flexible if the optimization routines would take an additional optional callback procedure argument for handling messages. Then the user could decide what to do with them, and e.g. printing them to the screen would be integrated with the I/O buffering of the calling application, or it could process the messages somehow and log them somewhere etc.

Metadata

Metadata

Assignees

Labels

fortranIssues related to the Fortran implementation

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions