Skip to content

Commit 6463f17

Browse files
author
Damian Rouson
authored
Merge pull request #224 from sourceryinstitute/master
Fix for sync images issue and some cleanup (#222)
2 parents f6a091c + c122100 commit 6463f17

File tree

6 files changed

+1479
-80
lines changed

6 files changed

+1479
-80
lines changed

install.sh-usage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-b --install-branch [arg] Install the specified repository development branch.
1+
-b --install-branch [arg] Install the specified repository development branch.
22
-B --list-branches [arg] List the available branches in the specified package's repository.
33
-c --with-c [arg] Use specified C compiler.
44
-C --with-cxx [arg] Use specified C++ compiler.

prerequisites/acceptable_compiler.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
program main
3636
use iso_fortran_env, only : compiler_version
3737
implicit none
38-
print *,compiler_version() >= "GCC version 6.1.0 "
38+
print *,(compiler_version() >= "GCC version 6.1.0 ") .and. (compiler_version() < "GCC version 7.0.0 ")
3939
end program

prerequisites/install-functions/find_or_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ find_or_install()
163163

164164
else
165165

166-
echo -e "$this_script: Checking whether $executable in PATH wraps gfortran version $(./build.sh -V gcc) or later... "
166+
echo -e "$this_script: Checking whether $executable in PATH wraps gfortran version >= $(./build.sh -V gcc) and < 7.0.0 ... "
167167
$executable acceptable_compiler.f90 -o acceptable_compiler
168168
$executable print_true.f90 -o print_true
169169
acceptable=$(./acceptable_compiler)

src/libcaf.h

Lines changed: 108 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
4343
#define unlikely(x) __builtin_expect(!!(x), 0)
4444
#endif
4545

46+
#if __GNUC__ >= 7
47+
#define GCC_GE_7 1
48+
#endif
49+
4650
#ifdef PREFIX_NAME
4751
#define PREFIX3(X,Y) X ## Y
4852
#define PREFIX2(X,Y) PREFIX3(X,Y)
@@ -101,6 +105,87 @@ typedef struct caf_vector_t {
101105
caf_vector_t;
102106

103107

108+
#ifdef GCC_GE_7
109+
/* Keep in sync with gcc/libgfortran/caf/libcaf.h. */
110+
typedef enum caf_ref_type_t {
111+
/* Reference a component of a derived type, either regular one or an
112+
allocatable or pointer type. For regular ones idx in caf_reference_t is
113+
set to -1. */
114+
CAF_REF_COMPONENT,
115+
/* Reference an allocatable array. */
116+
CAF_REF_ARRAY,
117+
/* Reference a non-allocatable/non-pointer array. */
118+
CAF_REF_STATIC_ARRAY
119+
} caf_ref_type_t;
120+
121+
/* Keep in sync with gcc/libgfortran/caf/libcaf.h. */
122+
typedef enum caf_array_ref_t {
123+
/* No array ref. This terminates the array ref. */
124+
CAF_ARR_REF_NONE = 0,
125+
/* Reference array elements given by a vector. Only for this mode
126+
caf_reference_t.u.a.dim[i].v is valid. */
127+
CAF_ARR_REF_VECTOR,
128+
/* A full array ref (:). */
129+
CAF_ARR_REF_FULL,
130+
/* Reference a range on elements given by start, end and stride. */
131+
CAF_ARR_REF_RANGE,
132+
/* Only a single item is referenced given in the start member. */
133+
CAF_ARR_REF_SINGLE,
134+
/* An array ref of the kind (i:), where i is an arbitrary valid index in the
135+
array. The index i is given in the start member. */
136+
CAF_ARR_REF_OPEN_END,
137+
/* An array ref of the kind (:i), where the lower bound of the array ref
138+
is given by the remote side. The index i is given in the end member. */
139+
CAF_ARR_REF_OPEN_START
140+
} caf_array_ref_t;
141+
142+
/* References to remote components of a derived type.
143+
Keep in sync with gcc/libgfortran/caf/libcaf.h. */
144+
typedef struct caf_reference_t {
145+
/* A pointer to the next ref or NULL. */
146+
struct caf_reference_t *next;
147+
/* The type of the reference. */
148+
/* caf_ref_type_t, replaced by int to allow specification in fortran FE. */
149+
int type;
150+
/* The size of an item referenced in bytes. I.e. in an array ref this is
151+
the factor to advance the array pointer with to get to the next item.
152+
For component refs this gives just the size of the element referenced. */
153+
size_t item_size;
154+
union {
155+
struct {
156+
/* The offset (in bytes) of the component in the derived type. */
157+
ptrdiff_t offset;
158+
/* The offset (in bytes) to the caf_token associated with this
159+
component. NULL, when not allocatable/pointer ref. */
160+
ptrdiff_t caf_token_offset;
161+
} c;
162+
struct {
163+
/* The mode of the array ref. See CAF_ARR_REF_*. */
164+
/* caf_array_ref_t, replaced by unsigend char to allow specification in
165+
fortran FE. */
166+
unsigned char mode[GFC_MAX_DIMENSIONS];
167+
/* The type of a static array. Unset for array's with descriptors. */
168+
int static_array_type;
169+
/* Subscript refs (s) or vector refs (v). */
170+
union {
171+
struct {
172+
/* The start and end boundary of the ref and the stride. */
173+
ptrdiff_t start, end, stride;
174+
} s;
175+
struct {
176+
/* nvec entries of kind giving the elements to reference. */
177+
void *vector;
178+
/* The number of entries in vector. */
179+
size_t nvec;
180+
/* The integer kind used for the elements in vector. */
181+
int kind;
182+
} v;
183+
} dim[GFC_MAX_DIMENSIONS];
184+
} a;
185+
} u;
186+
} caf_reference_t;
187+
#endif
188+
104189

105190
/* Common auxiliary functions: caf_auxiliary.c. */
106191

@@ -115,19 +200,39 @@ void PREFIX (finalize) (void);
115200
int PREFIX (this_image) (int);
116201
int PREFIX (num_images) (int, int);
117202

118-
void *PREFIX (register) (size_t, caf_register_t, caf_token_t *, int *, char *,
119-
int);
203+
#ifdef GCC_GE_7
204+
void PREFIX (register) (size_t, caf_register_t, caf_token_t *,
205+
gfc_descriptor_t *, int *, char *, int);
206+
#else
207+
void * PREFIX (register) (size_t, caf_register_t, caf_token_t *,
208+
int *, char *, int);
209+
#endif
120210
void PREFIX (deregister) (caf_token_t *, int *, char *, int);
121211

122212
void PREFIX (caf_get) (caf_token_t, size_t, int, gfc_descriptor_t *,
123-
caf_vector_t *, gfc_descriptor_t *, int, int);
213+
caf_vector_t *, gfc_descriptor_t *, int, int, int);
124214
void PREFIX (caf_send) (caf_token_t, size_t, int, gfc_descriptor_t *,
125215
caf_vector_t *, gfc_descriptor_t *, int, int);
126216

127217
void PREFIX (caf_sendget) (caf_token_t, size_t, int, gfc_descriptor_t *,
128218
caf_vector_t *, caf_token_t, size_t, int,
129219
gfc_descriptor_t *, caf_vector_t *, int, int);
130220

221+
#ifdef GCC_GE_7
222+
void PREFIX(get_by_ref) (caf_token_t, int,
223+
gfc_descriptor_t *dst, caf_reference_t *refs,
224+
int dst_kind, int src_kind, bool may_require_tmp,
225+
bool dst_reallocatable, int *stat);
226+
void PREFIX(send_by_ref) (caf_token_t token, int image_index,
227+
gfc_descriptor_t *src, caf_reference_t *refs,
228+
int dst_kind, int src_kind, bool may_require_tmp,
229+
bool dst_reallocatable, int *stat);
230+
void PREFIX(sendget_by_ref) (caf_token_t dst_token, int dst_image_index,
231+
caf_reference_t *dst_refs, caf_token_t src_token, int src_image_index,
232+
caf_reference_t *src_refs, int dst_kind, int src_kind,
233+
bool may_require_tmp, int *dst_stat, int *src_stat);
234+
#endif
235+
131236
void PREFIX (co_max) (gfc_descriptor_t *, int, int *, char *, int, int);
132237
void PREFIX (co_min) (gfc_descriptor_t *, int, int *, char *, int, int);
133238
void PREFIX (co_sum) (gfc_descriptor_t *, int, int *, char *, int);

0 commit comments

Comments
 (0)