Non Blocking Channel Operations in Co-array Fortran
Our program demonstrates non-blocking operations using Co-array Fortran. Here’s the full source code:
To run the program, save the code in a file named non_blocking_operations.f90
and compile it using a Co-array Fortran-compatible compiler:
This will run the program with 4 images (similar to processes or threads in other languages).
The program demonstrates non-blocking operations in Co-array Fortran:
It first attempts a non-blocking receive. Each image (except the first) checks if there’s a message from the previous image without waiting.
Then, it performs a non-blocking send. Each image (except the last) attempts to send a message to the next image.
Finally, it demonstrates a multi-way non-blocking operation, where each image checks for either a message or a signal from the previous image.
In Co-array Fortran, these operations are naturally non-blocking due to the PGAS (Partitioned Global Address Space) model. The sync all
statement is used to ensure all images have completed their operations before the final check.
This example showcases how Co-array Fortran can handle non-blocking operations in a parallel computing environment, which is conceptually similar to channel operations in other languages, but implemented using the co-array feature of Fortran.