Fortran

Guide To Learn

A push notification example

In this section, we’ll build from our tsunami teams example and use events to post updates from the simulation team to the logging team about data being written to disk. While this is technically doable with coarrays alone, you’ll see that events are a perfect candidate for such parallel patterns. Before we jump back into […]

Posting and waiting for events

In the previous section, we used teams to distribute work among groups of images. Teams allow us to express some parallel patterns and synchronization more elegantly than we otherwise could by controlling individual images directly. Fortran 2018 introduces another new parallel concept called events, provided through the built-in derived type called event_type. In a nutshell, you can post […]

Synchronizing teams and exchanging data

We’ve learned so far, both from coarrays in chapter 7 and from developing the parallel tsunami simulator, that synchronizing images is crucial for writing correct parallel programs. Recall that when we have data dependency between parallel images, one image must wait for data from another image before proceeding with its own calculation. This subsection explains […]

Teams in the tsunami simulator

In this section, we’ll use teams to augment our tsunami simulator and assign different roles to parallel images working concurrently. For brevity and to not get bogged down in the details of what the specific roles could be in real-world simulation software, we’ll create only two teams: the compute team and the logging team. While […]

Grouping images into teams with common tasks

Fortran 2018 introduced teams to allow the programmer to assign different tasks to groups of images. For example, if you’re computing a weather simulation on 16 images, you could assign them different roles (figure 12.1). Figure 12.1 A weather model workflow, with parallel images distributed in different teams and each box with a number in […]

From coarrays to teams, events, and collectives

Chapter 7 introduced the parallel programming concepts in Fortran, including images, synchronization, and data exchange using coarrays. I strongly recommend that you read that chapter before starting this one. Nevertheless, let’s refresh our memory on these concepts before we build further on them. Fortran refers to any parallel process as an image. Under the hood, an […]

Some interesting mixed Fortran-C projects

I’ll provide a list here of some of what I think are interesting and useful mixed Fortran-C projects. I encourage you to play with them, explore the source code, and see other possible ways to interface with C code from Fortran: Now that you’ve gotten this far, what are you going to make?

The complete client program

The following listing provides the complete program for the Fortran TCP client. Listing 11.9 Fortran TCP client–the complete program If you now recompile the client program and run it again (making sure the server is still running in the other terminal), you’ll see a familiar greeting message: The first item in the output (the numeral […]

Scroll to top