Fortran

Guide To Learn

The final stretch

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 […]

Receiving a message

In the previous section, you learned how to send a TCP message from the server to a remote client by calling the msend function in libdill. We tested that it worked by communicating to the server with command-line networking tools such as curl, nc, and telnet. What if you wanted to exchange data over the network between two Fortran programs? We […]

Connecting to a remote socket

Like we did on the server, first we need to initialize a data structure to hold the IP address and port number. In this case, they’ll be the IP address and port number of the remote host to which we’ll connect. Here’s the prototype of the ipaddr_remote function in libdill: ❶ This function returns an int. ❷ Pointer to […]

TCP client program: Connecting to a remote server

As I mentioned before, to implement the client, we’ll need Fortran interfaces to a few new libdill functions (figure 11.6): Figure 11.6 The Fortran TCP client program, illustrated Having gone through the server implementation, writing these interfaces for the client should be straightforward.

Scroll to top