Skip to content

Commit a32a3e8

Browse files
author
Damian Rouson
committed
Fixed install.sh and build script bugs that prevented building when the gfortran is not present or has a verison <5.1 but the user has flex installed (presumably because they have previously built gfortran from source, e.g., via package management software). Renamed CAF_API.txt -> CAF_ABI.txt and added GitHub-flavored Markdown to prepare for presenting to compiler groups.
Signed-off-by: Damian Rouson <[email protected]>
1 parent ad63dcd commit a32a3e8

File tree

3 files changed

+122
-108
lines changed

3 files changed

+122
-108
lines changed

CAF_API.txt renamed to CAF_ABI.txt

Lines changed: 76 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,74 @@
1-
DRAFT DOCUMENT FOR A COARRAY API DEFINTION
1+
[This document is formatted with GitHub-Flavored Markdown. ]:#
2+
[For better viewing, including hyperlinks, read it online at ]:#
3+
[https://github.com/sourceryinstitute/opencoarrays/blob/master/CAF_API.md]:#
24

3-
NOTE: The actual function names will have some PREFIX to avoid name clashes.
4-
This prefix can be vendor specific.
5+
# OpenCoarrays Application Binary Interface (ABI) #
56

7+
* [To Do]
8+
* [Implementation status]
9+
* [Definitions and types]
10+
* [Provided functions]
611

7-
Content
8-
0 TODO
9-
1 Implementation status
10-
2 Description of defines and types used in the API
11-
3 Description of the functions provided by the API
12+
This document describes the OpenCoarrays application binary interface (ABI) through
13+
which a compiler accesses coarray functionality. As such, the target audience for
14+
this document is compiler developers. Most application developers need only write
15+
standard-conforming Fortran 2008 or 2015 and compile their code with the OpenCoarrays
16+
'caf' compiler wrapper without knowledge of the ABI.
1217

18+
The actual function names in this document have a PREFIX in the source code to avoid
19+
name clashes. The prefix can be vendor-specific.
1320

14-
0 TODO
21+
## <a name="to-do">To Do</a> ##
1522

16-
- Discuss the current draft
17-
- Add missing functions of the current gfortran implementation
18-
- Address the TODO items
19-
- Extend the functions to match a sensible set
20-
- Update the implementation status, especially for the ARMCI library
23+
* Discuss the current draft
24+
* Add missing functions of the current gfortran implementation
25+
* Address the TODO items
26+
* Extend the functions to match a sensible set
27+
* Update the implementation status, especially for the ARMCI library
2128

29+
## <a name="implementation-status">Implementation status</a> ##
2230

23-
24-
1 Implementation status
25-
26-
The library implementation in this directory should be API compatible
31+
The library implementation in this directory should be ABI-compatible
2732
with the wording below, except for some "int errmsg_len" vs. size_t
28-
changes which have not yet been done.
29-
30-
gfortran development is done in GCC's fortran-caf branch and should
31-
also match - with the same exception - the API described here.
32-
33-
In both cases, the implementations might be stubs and not fully
34-
working or not fully adhering and should
35-
also match - with the same exception - the API described here.
36-
37-
In both cases, the implementations might be stubs and not fully
38-
working or not fully adhering to the specification. See also individual
39-
notes below.
33+
changes that have not yet been implemented.
4034

35+
## <a name="definitions-and-types">Definitions and types</a> ##
4136

42-
43-
2 Description of defines and types used in the API
44-
45-
46-
2.1 caf_token_t
37+
### 2.1 caf_token_t ###
4738

4839
Typedef of type "void *" on the compiler side. Can be any data
4940
type on the library side.
5041

51-
52-
2.2 caf_register_t
42+
### 2.2 caf_register_t ###
5343

5444
Type indicating which kind of coarray variable should be registered.
5545

56-
typedef enum caf_register_t {
57-
CAF_REGTYPE_COARRAY_STATIC,
58-
CAF_REGTYPE_COARRAY_ALLOC,
59-
CAF_REGTYPE_LOCK_STATIC,
60-
CAF_REGTYPE_LOCK_ALLOC
61-
CAF_REGTYPE_CRTITICAL
62-
}
63-
caf_register_t;
46+
typedef enum caf_register_t {
47+
CAF_REGTYPE_COARRAY_STATIC,
48+
CAF_REGTYPE_COARRAY_ALLOC,
49+
CAF_REGTYPE_LOCK_STATIC,
50+
CAF_REGTYPE_LOCK_ALLOC,
51+
CAF_REGTYPE_CRITICAL,
52+
CAF_REGTYPE_EVENT_STATIC,
53+
CAF_REGTYPE_EVENT_ALLOC
54+
}
55+
caf_register_t;
6456

6557
TODO:
6658
Check whether this set is complete and makes sense
6759

6860

69-
2.3 caf_token_t
61+
### 2.3 caf_token_t ###
7062

71-
In terms of the processor, some opaque pointer, which is used to identify a
72-
coarray. The exact content is implementation defined by the library.
63+
In terms of the processor, an opaque pointer, which is used to identify a
64+
coarray. The exact content is implementation-defined by the library.
7365

66+
### 2.4 Stat values ###
7467

75-
2.4 Stat values
76-
77-
#define STAT_UNLOCKED 0
78-
#define STAT_LOCKED 1
79-
#define STAT_LOCKED_OTHER_IMAGE 2
80-
#define STAT_STOPPED_IMAGE 6000
68+
#define STAT_UNLOCKED 0
69+
#define STAT_LOCKED 1
70+
#define STAT_LOCKED_OTHER_IMAGE 2
71+
#define STAT_STOPPED_IMAGE 6000
8172

8273
TODO:
8374
Define more, allow room for lib-specific values, update for TS18508.
@@ -86,28 +77,26 @@ TODO:
8677
values.
8778

8879

80+
## <a name="provided-functions">Provided functions</a> ##
8981

90-
3. Description of the API functions
91-
82+
### 3.1 Initialization function ###
9283

93-
3.1 Initialization function
94-
95-
void caf_init (int *argc, char ***argv)
84+
void caf_init (int *argc, char ***argv)
9685

9786
This function shall be called at startup of the program before the Fortran main
9887
program. It takes as arguments the command-line arguments of the program. It is
9988
permitted to pass to NULL pointers as argument; if non-NULL, the library is
10089
permitted to modify the arguments.
10190

10291
Arguments:
103-
argc intent(inout) An integer pointer with the number of arguments
104-
passed to the program or NULL.
105-
argv intent(inout) A pointer to an array of strings with the
106-
command-line arguments or NULL.
92+
argc intent(inout) An integer pointer with the number of arguments
93+
passed to the program or NULL.
94+
argv intent(inout) A pointer to an array of strings with the
95+
command-line arguments or NULL.
10796

10897
NOTE:
109-
The function is modelled after the initialization function of the MPI
110-
(Message Passing Interface) specification. Due to the way coarray
98+
The function is modelled after the initialization function of the
99+
Message Passing Interface (MPI) specification. Due to the way coarray
111100
registration (3.5) works, it might not be the first call to the libaray. If
112101
the main program is not written in Fortran and only a library uses coarrays,
113102
it can happen that this function is never called. Therefore, it is
@@ -121,7 +110,7 @@ GCC:
121110
when the command-line intrinsics are invoked.
122111

123112

124-
3.2 Finalization function
113+
### 3.2 Finalization function ###
125114

126115
void caf_finish (void)
127116

@@ -142,7 +131,7 @@ GCC:
142131
compiled with the -fcoarray=lib option.
143132

144133

145-
3.3 Querying the image number
134+
### 3.3 Querying the image number ###
146135

147136
int caf_this_image (int distance)
148137

@@ -161,7 +150,7 @@ GCC:
161150

162151

163152

164-
3.4 Querying the maximal number of images
153+
### 3.4 Querying the maximal number of images ###
165154

166155
int caf_num_images (int distance, int failed)
167156

@@ -184,7 +173,7 @@ GCC:
184173

185174

186175

187-
3.5 Registering coarrays
176+
### 3.5 Registering coarrays ###
188177

189178
void *caf_register (size_t size, caf_register_t type, caf_token_t *token,
190179
int *stat, char *errmsg, int errmsg_len)
@@ -249,7 +238,7 @@ TODO:
249238

250239

251240

252-
3.6 Deregistering coarrays
241+
### 3.6 Deregistering coarrays ###
253242

254243
void caf_deregister (const caf_token_t *token, int *stat, char *errmsg,
255244
size_t errmsg_len)
@@ -279,8 +268,7 @@ TODO:
279268
Change errmsg_len to size_t
280269

281270

282-
283-
3.7 Sending data from a local image to a remote image
271+
### 3.7 Sending data from a local image to a remote image ###
284272

285273
void caf_send (caf_token_t token, size_t offset, int image_index,
286274
gfc_descriptor_t *dest, caf_vector_t *dst_vector,
@@ -334,7 +322,7 @@ OTHER TODOs:
334322

335323

336324

337-
3.8 Getting data from a remote image
325+
### 3.8 Getting data from a remote image ###
338326

339327
void caf_get_desc (caf_token_t token, size_t offset,
340328
int image_index, gfc_descriptor_t *src,
@@ -374,7 +362,7 @@ GCC:
374362
real/complex kinds 10 and 16, which have the same byte size.
375363

376364

377-
3.9 Sending data between remote images
365+
### 3.9 Sending data between remote images ###
378366

379367
void caf_sendget (caf_token_t dst_token, size_t dst_offset,
380368
int dst_image_index, gfc_descriptor_t *dest,
@@ -426,9 +414,9 @@ GCC:
426414

427415

428416

429-
3.10 Barriers
417+
### 3.10 Barriers ###
430418

431-
3.10.1 All-Image Barrier
419+
### 3.10.1 All-Image Barrier ###
432420

433421
void caf_sync_all (int *stat, char *errmsg, size_t errmsg_len)
434422

@@ -452,7 +440,7 @@ GCC:
452440

453441

454442

455-
3.10.2 Barrier for Selected Images
443+
### 3.10.2 Barrier for Selected Images ###
456444

457445
void sync_images (int count, int images[], int *stat,
458446
char *errmsg, size_t errmsg_len)
@@ -479,9 +467,7 @@ GCC:
479467
Implemented in GCC 4.x using an int argument for the error-string length.
480468
Currently, size_t is not implemented.
481469

482-
483-
484-
3.11 Error abort
470+
### 3.11 Error abort ###
485471

486472
void error_stop_str (const char *string, int32_t str_len)
487473
void error_stop (int32_t exit_error_code)
@@ -495,9 +481,9 @@ TODO
495481
for ERROR STOP does not.
496482

497483

498-
3.11 Locking and unlocking
484+
### 3.11 Locking and unlocking ###
499485

500-
3.11.1 Locking a lock variable
486+
#### 3.11.1 Locking a lock variable ####
501487

502488
void caf_lock (caf_token_t token, size_t index, int image_index,
503489
int *aquired_lock, int *stat, char *errmsg,
@@ -536,7 +522,7 @@ TODO:
536522
Change errmsg_len to size_t
537523

538524

539-
3.11.2 Unlocking a lock variable
525+
#### 3.11.2 Unlocking a lock variable ####
540526

541527
void caf_unlock (caf_token_t token, size_t index, int image_index,
542528
int *stat, char *errmsg, int errmsg_len)
@@ -567,3 +553,10 @@ GCC:
567553

568554
TODO:
569555
Change errmsg_len to size_t
556+
557+
[Hyperlinks]:#
558+
559+
[To Do]: #to-do
560+
[Implementation status]: #implementation-status
561+
[Definitions and types]: #definitions-and-types
562+
[Provided functions]: #provided-functions

install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ find_or_install()
206206

207207
fi # Ending 'if [[ $package == "gcc" ]];'
208208

209-
FC=gfortran CC=gcc CXX=g++ ./build $package --default $num_threads
209+
# FC=gfortran CC=gcc CXX=g++ ./build $package --default $num_threads
210+
FC=gfortran CC=gcc CXX=g++ ./build $package
210211
package_install_path=`./build $package --default --query`
211212

212213
if [[ -f $package_install_path/bin/$executable ]]; then

0 commit comments

Comments
 (0)