1
- [ This document is formatted with GitHub-Flavored Markdown. ] :#
2
- [ For better viewing, including hyperlinks, read it online at ] :#
1
+ [ This document is formatted with GitHub-Flavored Markdown. ] :#
2
+ [ For better viewing, including hyperlinks, read it online at ] :#
3
3
[ https://github.com/sourceryinstitute/opencoarrays/blob/master/GETTING_STARTED.md ] :#
4
4
5
5
# [ Getting Started] ( #getting-started ) #
10
10
11
11
<a name =" the-caf-compiler-wrapper " >
12
12
## The caf compiler wrapper ##
13
- </a >
13
+ </a >
14
14
15
- The preferred method for compiling a CAF program is by invoking the "caf" bash script
15
+ The preferred method for compiling a CAF program is by invoking the "caf" bash script
16
16
that the OpenCoarrays CMake scripts install in the "bin" subdirectory of the installation
17
- path. This is an experimental script with limited but useful capabilities that will
17
+ path. This is an experimental script with limited but useful capabilities that will
18
18
grow over time. Please submit bug reports and feature requests via our [ Issues] page.
19
19
20
20
The "caf" script liberates the source code and workflow from explicit dependence on the
21
- underlying compiler and communication library in the following ways:
21
+ underlying compiler and communication library in the following ways:
22
22
23
23
1 . With an OpenCoarrays-aware (OCA) CAF compiler, the "caf" script passes the unmodified
24
- source code to the underlying compiler with the necessary arguments for building a
25
- CAF program, embedding the paths to OpenCoarrays libraries (e.g., libcaf_mpi.a) installed
26
- in the "lib" subdirectory of the OpenCoarrays installation path. The "caf" script also
24
+ source code to the underlying compiler with the necessary arguments for building a
25
+ CAF program, embedding the paths to OpenCoarrays libraries (e.g., libcaf_mpi.a) installed
26
+ in the "lib" subdirectory of the OpenCoarrays installation path. The "caf" script also
27
27
embeds the path to the relevant module file in the "mod" subdirectory of the installation
28
28
path (e.g., opencoarrays.mod). This supports use association with module entities via
29
29
`` use opencoarrays `` .
30
- 2 . With a non-CAF compiler (including gfortran 4.9), "caf" supports a subset of CAF by
30
+ 2 . With a non-CAF compiler (including gfortran 4.9), "caf" supports a subset of CAF by
31
31
replacing CAF statements with calls to procedures in the [ opencoarrays module] before
32
- passing the source code to the compiler.
32
+ passing the source code to the compiler.
33
33
34
34
When using GCC 4.9, we recommend using the ` use ` statement's "only" clause to
35
- avoid inadvertent procedure name clashes between OpenCoarrays procedures and their
35
+ avoid inadvertent procedure name clashes between OpenCoarrays procedures and their
36
36
GCC counerparts. For example, use "use opencoarrays, only : co_reduce".
37
37
38
38
With a non-OCA and OCA CAF compilers, the extensions that "caf" imports include the collective
39
39
subroutines proposed for Fortran 2015 in the draft Technical Specification [ TS 18508]
40
40
_ Additional Parallel Features in Fortran_ .
41
41
42
- The latter use case provides an opportunity to mix a compiler's CAF support with that of OpenCoarrays.
43
- For example, a non-OCA CAF compiler, such as the Cray or Intel compilers, might support all of a
44
- program's coarray square-bracket syntax, while OpenCoarrays supports the same program's calls to
42
+ The latter use case provides an opportunity to mix a compiler's CAF support with that of OpenCoarrays.
43
+ For example, a non-OCA CAF compiler, such as the Cray or Intel compilers, might support all of a
44
+ program's coarray square-bracket syntax, while OpenCoarrays supports the same program's calls to
45
45
collective subroutine such as ` co_sum ` and ` co_reduce ` .
46
46
47
47
<a name =" a-sample-basic-workflow " >
48
48
## A sample basic workflow ##
49
49
</a >
50
50
51
- The following program listing, compilation, and execution workflow exemplify
52
- the use of an OCA compiler (e.g., gfortran 5.1.0 or later) in a Linux bash shell
53
- with the "bin" directory of the chosen installation path in the user's PATH
51
+ The following program listing, compilation, and execution workflow exemplify
52
+ the use of an OCA compiler (e.g., gfortran 5.1.0 or later) in a Linux bash shell
53
+ with the "bin" directory of the chosen installation path in the user's PATH
54
54
environment variable:
55
55
56
- $ cat tally.f90
56
+ $ cat tally.f90
57
57
program main
58
58
use iso_c_binding, only : c_int
59
59
use iso_fortran_env, only : error_unit
60
60
implicit none
61
61
integer(c_int) :: tally
62
- tally = this_image() ! this image's contribution
62
+ tally = this_image() ! this image's contribution
63
63
call co_sum(tally)
64
64
verify: block
65
65
integer(c_int) :: image
@@ -69,7 +69,7 @@ environment variable:
69
69
end if
70
70
end block verify
71
71
! Wait for all images to pass the test
72
- sync all
72
+ sync all
73
73
if (this_image()==1) print *,"Test passed"
74
74
end program
75
75
$ caf tally.f90 -o tally
@@ -82,7 +82,7 @@ where "4" is the number of images to be launched at program start-up.
82
82
## An advanced workflow </a > ##
83
83
84
84
To extend the capabilities of a non-OCA CAF compiler (e.g., the Intel or Cray compilers),
85
- access the types and procedures of the [ opencoarrays module] by use assocication. We
85
+ access the types and procedures of the [ opencoarrays module] by use assocication. We
86
86
recommend using a ` use ` statement with an ` only ` clause to reduce the likelihood of a
87
87
name clash with the compiler's native CAf support. For eample, innsert the following
88
88
at line 2 of ` tally.f90 ` above:
0 commit comments