- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have need for multiple programs to share the same data. How can I
share memory among different programs using Fortran 10.0 under Linux?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran doesn't directly support shm/shared memory.
You may wish to consider a mixed-language model where C manages the shm memory segments. Are you thinking of using BSD style mmap or Sys V IPC?
I, personally, have never done this. I have seen folks use a shared disk file in Fortran to share data, assuming the updates are not frequent, this could be a relatively easy mechanism. This works well for a program chain, that is, a series of programs that run one after another, each taking the output of the prior program as input. Are your programs serialized?
Another thought, again having not tried this, is to use C to dispatch a POSIX thread, or threads. Convert the separate programs into Fortran subroutines compiled into the main Fortran program. Have the master program call a C function to spawn a thread. This child thread then calls the Fortran subroutine. This child subroutine could then share all the static data structures as the main program.
There are many ways to code these things. The design really depends on your intended workflow, need for real time sharing vs infrequent global data, etc.
ron
You may wish to consider a mixed-language model where C manages the shm memory segments. Are you thinking of using BSD style mmap or Sys V IPC?
I, personally, have never done this. I have seen folks use a shared disk file in Fortran to share data, assuming the updates are not frequent, this could be a relatively easy mechanism. This works well for a program chain, that is, a series of programs that run one after another, each taking the output of the prior program as input. Are your programs serialized?
Another thought, again having not tried this, is to use C to dispatch a POSIX thread, or threads. Convert the separate programs into Fortran subroutines compiled into the main Fortran program. Have the master program call a C function to spawn a thread. This child thread then calls the Fortran subroutine. This child subroutine could then share all the static data structures as the main program.
There are many ways to code these things. The design really depends on your intended workflow, need for real time sharing vs infrequent global data, etc.
ron

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page