Parallelize a Fortran array model with coarrays

8 steps · about 2 h 50 min · Intermediate

  1. Orient yourself to coarray execution (guide, OpenCoarrays documentation, 30 min)

    Understand images, coarrays and the single-program multiple-data execution model before changing code.

  2. Configure a coarray build (guide, GNU Fortran documentation, 25 min)

    Choose a supported compiler mode and learn how the executable is launched across images.

  3. Declare and run distributed arrays (guide, GNU Fortran documentation, 25 min)

    Configure shared-memory coarrays and inspect local and remote portions without confusing array and image indices.

  4. Partition work by image (reference, GNU Fortran documentation, 15 min)

    Assign each image a deterministic slice of the model using its stable index.

  5. Adapt to the image count (reference, GNU Fortran documentation, 15 min)

    Make the partition work for one image and for several without hard-coded process counts.

  6. Map image coordinates deliberately (reference, GNU Fortran documentation, 20 min)

    Relate cosubscripts to image indices before placing synchronization around remote reads.

  7. Reduce partial results (reference, GNU Fortran documentation, 20 min)

    Combine per-image contributions with a standard collective and define which images need the result.

  8. Fail the parallel check clearly (reference, GNU Fortran documentation, 20 min)

    Understand collective error termination before using an intentional diagnostic on a baseline mismatch.