Skip to content
Snippets Groups Projects
Commit bb8beeb5 authored by David Hrbáč's avatar David Hrbáč
Browse files

Refactor CoArr...

parent 4e5344d9
No related branches found
No related tags found
5 merge requests!368Update prace.md to document the change from qprace to qprod as the default...,!367Update prace.md to document the change from qprace to qprod as the default...,!366Update prace.md to document the change from qprace to qprod as the default...,!323extended-acls-storage-section,!148Hot fix
Checking pipeline status
...@@ -7,7 +7,7 @@ The advantage is that only small changes are required to convert existing Fortra ...@@ -7,7 +7,7 @@ The advantage is that only small changes are required to convert existing Fortra
A CAF program is interpreted as if it was replicated a number of times and all copies were executed asynchronously. A CAF program is interpreted as if it was replicated a number of times and all copies were executed asynchronously.
The number of copies is decided at execution time. Each copy (called *image*) has its own private variables. The number of copies is decided at execution time. Each copy (called *image*) has its own private variables.
The variable syntax of Fortran language is extended with indexes in square brackets (called *co-dimension*), which represents a reference to data distributed across images. The variable syntax of Fortran language is extended with indexes in square brackets (called *co-dimension*) representing a reference to data distributed across images.
By default, the CAF is using Message Passing Interface (MPI) for lower-level communication, so there are some similarities with MPI. By default, the CAF is using Message Passing Interface (MPI) for lower-level communication, so there are some similarities with MPI.
...@@ -15,7 +15,7 @@ Read more on <http://www.opencoarrays.org/> ...@@ -15,7 +15,7 @@ Read more on <http://www.opencoarrays.org/>
## Coarray Basics ## Coarray Basics
### Indexing of coarray images ### Indexing of Coarray Images
Indexing of individual images can be shown on the simple *Hello World* program: Indexing of individual images can be shown on the simple *Hello World* program:
...@@ -28,7 +28,7 @@ Indexing of individual images can be shown on the simple *Hello World* program: ...@@ -28,7 +28,7 @@ Indexing of individual images can be shown on the simple *Hello World* program:
* num_images() - returns the number of all images * num_images() - returns the number of all images
* this_image() - returns the image index - numbered from 1 to num_images() * this_image() - returns the image index - numbered from 1 to num_images()
### Co-dimension variables declaration ### Co-dimension Variables Declaration
Coarray variables can be declared with the **codimension[*]** attribute or by adding trailing index **[*]** after the variable name. Coarray variables can be declared with the **codimension[*]** attribute or by adding trailing index **[*]** after the variable name.
Notice, the ***** character always has to be in the square brackets. Notice, the ***** character always has to be in the square brackets.
...@@ -40,7 +40,7 @@ Notice, the ***** character always has to be in the square brackets. ...@@ -40,7 +40,7 @@ Notice, the ***** character always has to be in the square brackets.
real :: vector(64)[*] real :: vector(64)[*]
``` ```
### Images synchronization ### Images Synchronization
Because each image is running on its own, the image synchronization is needed to ensure, that all altered data are distributed to all images. Because each image is running on its own, the image synchronization is needed to ensure, that all altered data are distributed to all images.
Synchronization can be done across all images or only between selected images. Be aware, that selective synchronization can lead to the race condition problems like deadlock. Synchronization can be done across all images or only between selected images. Be aware, that selective synchronization can lead to the race condition problems like deadlock.
...@@ -76,7 +76,7 @@ Example program: ...@@ -76,7 +76,7 @@ Example program:
**number** is the local variable while **number[*index*]** accesses the variable in a specific image. **number** is the local variable while **number[*index*]** accesses the variable in a specific image.
**number[this_image()]** is the same as **number**. **number[this_image()]** is the same as **number**.
## Compile and run ## Compile and Run
Currently, version 1.8.10 compiled with OpenMPI 1.10.7 library is installed on Cluster. The OpenCoarrays module can be load as follows: Currently, version 1.8.10 compiled with OpenMPI 1.10.7 library is installed on Cluster. The OpenCoarrays module can be load as follows:
...@@ -84,7 +84,7 @@ Currently, version 1.8.10 compiled with OpenMPI 1.10.7 library is installed on C ...@@ -84,7 +84,7 @@ Currently, version 1.8.10 compiled with OpenMPI 1.10.7 library is installed on C
$ ml OpenCoarrays/1.8.10-GCC-6.3.0-2.27 $ ml OpenCoarrays/1.8.10-GCC-6.3.0-2.27
``` ```
### Compile CAF program ### Compile CAF Program
The preferred method for compiling a CAF program is by invoking the *caf* compiler wrapper. The preferred method for compiling a CAF program is by invoking the *caf* compiler wrapper.
The above mentioned *Hello World* program can be compiled as follows: The above mentioned *Hello World* program can be compiled as follows:
...@@ -94,7 +94,7 @@ $ caf hello_world.f90 -o hello_world.x ...@@ -94,7 +94,7 @@ $ caf hello_world.f90 -o hello_world.x
``` ```
!!! warning !!! warning
The input file extension has to be **.f90** or **.F90** to be interpreted as *Fortran 90*. The input file extension **.f90** or **.F90** are to be interpreted as *Fortran 90*.
If the input file extension is **.f** or **.F** the source code will be interpreted as *Fortran 77*. If the input file extension is **.f** or **.F** the source code will be interpreted as *Fortran 77*.
Another method for compiling is by invoking the *mpif90* compiler wrapper directly: Another method for compiling is by invoking the *mpif90* compiler wrapper directly:
...@@ -104,7 +104,7 @@ $ mpif90 hello_world.f90 -o hello_world.x -fcoarray=lib -lcaf_mpi ...@@ -104,7 +104,7 @@ $ mpif90 hello_world.f90 -o hello_world.x -fcoarray=lib -lcaf_mpi
``` ```
### Run CAF program ### Run CAF Program
A CAF program can be run by invoking the *cafrun* wrapper or directly by the *mpiexec*: A CAF program can be run by invoking the *cafrun* wrapper or directly by the *mpiexec*:
...@@ -122,6 +122,6 @@ $ mpiexec -np 4 ./synchronization_test.x ...@@ -122,6 +122,6 @@ $ mpiexec -np 4 ./synchronization_test.x
The random number is 242 The random number is 242
``` ```
where **-np 4** is number of images to run. The parameters of **cafrun** and **mpiexec** are the same. **-np 4** is number of images to run. The parameters of **cafrun** and **mpiexec** are the same.
For more information about running CAF program please follow [Running OpenMPI](../mpi/Running_OpenMPI.md) For more information about running CAF program please follow [Running OpenMPI](../mpi/Running_OpenMPI.md)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment