Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface to POSIX I/O API #22

Open
marshallward opened this issue Dec 19, 2019 · 2 comments
Open

Interface to POSIX I/O API #22

marshallward opened this issue Dec 19, 2019 · 2 comments
Labels
topic: interface Interfacing with other libraries or languages

Comments

@marshallward
Copy link

stdlib may include a module which provides an interface to the POSIX I/O calls in the C standard library. Such a module would support higher level functionality proposed in #14 on Unix-like platforms.

This module, or specific components, could be conditionally integrated into stdlib by the build system (CMake, autotools, etc) depending on whether they are available.

Such a module could also be extended to include more POSIX calls, e.g. thread support, memory allocation, lower-level system calls. For now, I'd say to keep the scope more narrow in order to keep it achievable.

@jvdp1 jvdp1 added the topic: utilities containers, strings, files, OS/environment integration, unit testing, assertions, logging, ... label Jan 18, 2020
@ivan-pi
Copy link
Member

ivan-pi commented Nov 24, 2020

I discovered today that the major compiler vendors all provide(d) POSIX interfaces:

Additionally, there are several disjoint community efforts:

The amount of reinvention in the Fortran community is distressing.

Edit: a F77 interface was proposed by IEEE (see IEEE Standard for Information Technology - POSIX(R) FORTRAN 77 Language Interfaces), but from what I can gather it never gained widespread adoption and was later withdrawn.

@w6ws
Copy link

w6ws commented May 8, 2021

I discovered today that the major compiler vendors all provide(d) POSIX interfaces:...
The amount of reinvention in the Fortran community is distressing.

Edit: a F77 interface was proposed by IEEE (see IEEE Standard for Information Technology - POSIX(R) FORTRAN 77 Language Interfaces), but from what I can gather it never gained widespread adoption and was later withdrawn.

New here. The idea of Fortran - POSIX API was an interest of mine for a long time in the 1990s-early 2000s. I knew one of the people who was on the POSIX committee that was developing it. She had high hopes for it. The POSIX Fortran 77 "PXF" spec was finally approved and published around 1990 or 1991. I have a copy of it.

Some of the ugliness in PXF was that it was designed right at the transition between Fortran 77 and Fortran 90. So there were almost no Fortran 90 compilers, and therefore a desire that it would work with existing Fortran 77 compilers. This meant no derived types. Instead, one created structures and associated them with integer handles via calls to PXFSTRUCTCREATE. There was a corresponding PXFSTRUCTFREE. There were also procedures for accessing system constants and filling the structures with desired values. Nothing about a F90 module or interface specs/checking either.

Cray Research had an implementation which was fairly complete. When Cray merged with SGI in 1996, and the Cray cft90 compiler was ported to the MIPS-based machines, the PXF portion of the library came along for the ride. Then when SGI started using Intel-based microprocessors, and we then needed to use the Intel compilers, Intel got serious about supporting it as well. The Intel implementation is actually pretty good.

Sun (now Oracle) supported PXF in their Fortran 77 compiler. But when they moved to Fortran 90, their pxf library got deprecated. The strange thing is that Sun based their initial Fortran 90 compiler on the Cray f90 front end - but they didn't bring PXF along. Same story with Absoft.

The Fortran Committee never really warmed up to PXF. Some members felt that C Interop, which eventually came out in F2003, was a better answer. It really wasn't. C Interop only works for relatively simple calls. For anything involving structs, it fails miserably - and one still has to use a PXF-like approach. Nonetheless, when it came time to update or reapprove the POSIX Standard, no one did. So it fell off the POSIX radar. And now we have nothing.

About 20 years ago, I wrote my own PXF library and test base for personal use. It covered almost all the PXF routines. Though a couple of procedures weren't implemented as they require some specific integration with the specific Fortran run-time library in use. As an end user, I didn't have this access. (Though it would be possible these days with gfortran.) My test base found a number of issues with the Intel implementation. I submitted the problems to Intel and they fixed them fairly quickly. So I am pretty confident that the Intel implementation is as close to a reference implementation as exists.

@awvwgk awvwgk added topic: interface Interfacing with other libraries or languages and removed topic: utilities containers, strings, files, OS/environment integration, unit testing, assertions, logging, ... labels Sep 18, 2021
jvdp1 pushed a commit to jvdp1/stdlib that referenced this issue Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: interface Interfacing with other libraries or languages
Projects
None yet
Development

No branches or pull requests

5 participants