diff options
author | Nicolas KÃnig <koenigni@student.ethz.ch> | 2020-10-18 13:37:30 +0200 |
---|---|---|
committer | Nicolas KÃnig <koenigni@student.ethz.ch> | 2020-10-18 13:44:33 +0200 |
commit | 7488585fc18a9466253617e251c0e0bdc168a3b1 (patch) | |
tree | 7d0d2faf6c03746ccdd2cf409022ae0d20866751 /libgfortran | |
parent | b96fdc7b84eb288dea0c3e99a212e6483007a35a (diff) |
Implement comments from review.
This implements the comments from the review - the general prefix is now
cas (for coarray shared), and native has been renamed to shared generally.
Plus, there is a lot of cleanup such as removing dead code and
debug statements.
gcc/ChangeLog:
PR fortran/88076
* flag-types.h (enum gfc_fcoarray): Change GFC_FCOARRAY_NATIVE to
GFC_FCOARRAY_SHARED.
gcc/fortran/ChangeLog:
PR fortran/88076
* dump-parse-tree.c (show_symbol): Remove dumping of backend_decl.
* frontend-passes.c (gfc_run_passes): Generally rename "native" to
"shared" and "cas" instead of "nca".
(co_reduce_code): Initialize num. Generally rename "native" to
"shared" and "cas" instead of "nca".
* gfortran.h: Generally rename "native" to "shared".
* iresolve.c (gfc_resolve_co_collective): Use specific function
for library coarrays. Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_resolve_co_reduce): Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_resolve_co_broadcast): Generally rename "native" to "shared"
and "cas" instead of "nca".
* lang.opt: Generally rename "native" to "shared" and "cas"
instead of "nca".
* resolve.c (fixup_coarray_args): Rename to
(fixup_shared_coarray_args): Generally rename "native" to
"shared" and "cas" instead of "nca". Get rid of a variable.
(resolve_unknown_s): Fix whitespace.
(resolve_call): Generally rename "native" to "shared" and "cas"
instead of "nca".
(resolve_critical): Revert spurious change. Generally rename
"native" to "shared" and "cas" instead of "nca".
* trans-array.c (gfc_add_strides): Fix comment format.
(gfc_native_coarray_add_this_image_offset): Generally rename
"native" to "shared" and "cas" instead of "nca". Formatting
fixes.
(gfc_conv_ss_descriptor): Generally rename "native" to "shared"
and "cas" instead of "nca".
(build_array_ref): Remove empty line.
(gfc_conv_array_ref): Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_array_init_size): Special-case GFC_COARRAY_SHARED. Generally
rename "native" to "shared" and "cas" instead of "nca". Fix
formatting.
(gfc_allocate_native_coarray): Generally rename "native" to
"shared" and "cas" instead of "nca".
(gfc_array_allocate): Generally rename "native" to "shared" and
"cas" instead of "nca". Fix comment syntax.
(gfc_trans_dummy_array_bias): Generally rename "native" to
"shared" and "cas" instead of "nca".
(gfc_get_dataptr_offset): Generally rename "native" to "shared"
and "cas" instead of "nca". Fix comment style.
(gfc_conv_expr_descriptor): Remove code blocks guarded by #if 0 or #if 1.
(gfc_conv_array_parameter): Likewise.
(gfc_walk_array_ref): Likewise.
* trans-array.h (enum gfc_coarray_allocation_type): Change offset from 3 to 1.
* trans-decl.c: Generally rename "native" to "shared" and "cas"
instead of "nca" for tree declarations.
(gfc_build_qualified_array): Generally rename "native" to "shared"
and "cas" instead of "nca".
(gfc_build_dummy_array_decl): Generally rename "native" to "shared"
and "cas" instead of "nca".
(gfc_get_symbol_decl): Revert spurious change. Generally rename
"native" to "shared" and "cas" instead of "nca".
(gfc_build_builtin_function_decls): Generally rename "native" to
"shared" and "cas" instead of "nca".
(gfc_trans_native_coarray): Clarify comment. Generally rename
"native" to "shared" and "cas" instead of "nca".
(gfc_trans_deferred_vars): Generally rename "native" to "shared"
and "cas" instead of "nca".
(gfc_create_module_variable): Generally rename "native" to
"shared" and "cas" instead of "nca".
(generate_coarray_constructor_function): Generally rename "native"
to "shared" and "cas" instead of "nca".
(create_main_function): Generally rename "native" to "shared"
and "cas" instead of "nca".
* trans-expr.c (gfc_maybe_dereference_var): Remove branch where
condition is always false. Generally rename "native" to "shared"
and "cas" instead of "nca".
(gfc_conv_procedure_call): Remove code blocks guarded by #if 0.
Whitespace fix.
* trans-intrinsic.c (trans_this_image): Generally rename "native"
to "shared" and "cas" instead of "nca".
(trans_image_index): Remove unneeded TODO. Generally rename
"native" to "shared" and "cas" instead of "nca".
(trans_num_images): Generally rename "native" to "shared" and
"cas" instead of "nca".
(conv_intrinsic_cobound): Generally rename "native" to "shared"
and "cas" instead of "nca".
(trans_argument): Clarify comment explaining what the function does.
(conv_nca_reduce): Rename to...
(conv_cas_reduce): this. Add comment.
(conv_nca_broadcast): Rename to...
(conv_cas_broadcast): this.
(conv_nca_collective): Rename to...
(conv_cas_collective): this.
(conv_co_collective): Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_conv_intrinsic_subroutine): Generally rename "native" to
"shared" and "cas" instead of "nca".
* trans-stmt.c (gfc_trans_lock_unlock): Generally rename "native"
to "shared" and "cas" instead of "nca".
(gfc_trans_sync): Generally rename "native" to "shared" and "cas"
instead of "nca".
(gfc_trans_critical): Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_trans_deallocate): Generally rename "native" to "shared" and
"cas" instead of "nca".
* trans-types.c (gfc_is_nodesc_array): Generally rename "native"
to "shared" and "cas" instead of "nca".
(gfc_build_array_type): Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_get_nodesc_array_type): Generally rename "native" to "shared"
and "cas" instead of "nca".
(gfc_get_array_type_bounds): Generally rename "native" to "shared"
and "cas" instead of "nca".
* trans.c (gfc_trans_memory_barrier): Use sizeof instead of strlen,
replace comma by semicolon.
(gfc_build_array_ref): Generally rename "native" to "shared" and
"cas" instead of "nca".
(gfc_deallocate_with_status): Fix indentation. Generally rename
"native" to "shared" and "cas" instead of "nca".
* trans.h: Generally rename "native" to "shared" and "cas" instead
of "nca".
libgfortran/ChangeLog:
PR fortran/88076
* m4/nca-minmax-s.m4: Change "nca" prefix to "cas". Add comments.
* m4/nca_minmax.m4: Likewise.
* nca/README.native_coarrays: Update.
* nca/alloc.c (free_memory_with_id): Add FIXME.
* nca/coarraynative.c (nca_master): Rename to
(cas_master): Change logic for exiting images.
* nca/collective_subroutine.c (get_collsub_buf): Add comment.
(collsub_sync): Remove dead debug output.
(collsub_reduce_array): Silence -Wsign-compare warning.
(collsub_iface_init): Remove unused variable.
(collsub_broadcast_scalar): Remove debug code.
(collsub_broadcast_array): Remove unused variable.
(nca_co_broadcast): Remove commented-out function, plus its
(export_proto): prototype declaration.
* nca/collective_subroutine.h (finish_collective_subroutine): Add.
* nca/hashmap.c (num_entries): Silcence -Wsign-compare warning.
(hash): Formatting change (add empty lines).
(gen_mask): Likewise.
(hmiadd): Likewise.
(get_expected_offset): Likewise.
(hashmap_init): Likewise.
(scan_empty): Likewise. Remove unused argument.
(hashmap_get): Formatting change (add empty lines).
(hm_search_result_ptr): Likewise.
(hm_search_result_contains): Likewise.
(enlarge_hashmap_mem): Likewise.
(resize_hm): Likewise. Remove argument in call to scan_empty.
(hashmap_set): Remove dead debugging code. Silence -Wsign-compare
warning.
(hashmap_change_refcnt): Silence -Wsign-compare warning.
(hashmap_inc): Formatting change.
* nca/hashmap.h (Library): Add copyright notice.
* nca/libcoarraynative.h (DEBUG_NATIVE_COARRAY): #define as 0
(NUM_ADDR_BITS): Remove dead code.
(nca_master): Rename to
(cas_master): this.
* nca/shared_memory.c (shared_memory_get_mem_with_alignment):
Remove debug code.
* nca/shared_memory.h (SHARED_MEMORY_H): Move definition to start
of file.
* nca/sync.c (get_locked_table): Remove commented-out code.
(sync_iface_init): Remove debug code.
(sync_all): Remove debug code.
* nca/sync.h: Add space after #include.
* nca/util.c: Include assert.h. Add comment.
(next_power_of_two): Remove comment.
(pack_array_finish): Replace 0 by '\0' in memset.
(unpack_array_finish): Zero variable count.
* nca/wrapper.c (enum gfc_coarray_allocation_type): Enum starts at
one. Add comment about need to keep in sync with trans-array.h.
(nca_coarray_alloc): Rename to
(cas_coarray_alloc): this.
(nca_coarray_free): Rename to
(cas_coarray_free): this.
(nca_coarray_this_image): Rename to
(cas_coarray_this_image): this.
(nca_coarray_num_images): Rename to
(cas_coarray_num_images): this.
(nca_coarray_sync_all): Rename to
(cas_coarray_sync_all): this.
(nca_sync_images): Rename to
(cas_sync_images): this.
(nca_lock): Rename to
(cas_lock): this.
(nca_unlock): Rename to
(cas_unlock): this.
(nca_collsub_reduce_array): Rename to
(cas_collsub_reduce_array): this.
(nca_collsub_reduce_scalar): Rename to
(cas_collsub_reduce_scalar): this.
(nca_collsub_broadcast_array): Rename to
(cas_collsub_broadcast_array): this.
(nca_collsub_broadcast_scalar): Rename to
(cas_collsub_broadcast_scalar): this.
* nca/.tags: Delete.
* nca/collective_inline.h: Delete.
* generated/nca_minmax_i1.c: Regenerated.
* generated/nca_minmax_i16.c: Regenerated.
* generated/nca_minmax_i2.c: Regenerated.
* generated/nca_minmax_i4.c: Regenerated.
* generated/nca_minmax_i8.c: Regenerated.
* generated/nca_minmax_r10.c: Regenerated.
* generated/nca_minmax_r16.c: Regenerated.
* generated/nca_minmax_r4.c: Regenerated.
* generated/nca_minmax_r8.c: Regenerated.
* generated/nca_minmax_s1.c: Regenerated.
* generated/nca_minmax_s4.c: Regenerated.
Diffstat (limited to 'libgfortran')
29 files changed, 429 insertions, 938 deletions
diff --git a/libgfortran/generated/nca_minmax_i1.c b/libgfortran/generated/nca_minmax_i1.c index 3bc9a2b75ec..30a8587ea55 100644 --- a/libgfortran/generated/nca_minmax_i1.c +++ b/libgfortran/generated/nca_minmax_i1.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, +void cas_collsub_max_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_i1); +export_proto(cas_collsub_max_scalar_i1); void -nca_collsub_max_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, +cas_collsub_max_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, } -void nca_collsub_min_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, +void cas_collsub_min_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_i1); +export_proto(cas_collsub_min_scalar_i1); void -nca_collsub_min_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, +cas_collsub_min_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, } -void nca_collsub_sum_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, +void cas_collsub_sum_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_i1); +export_proto(cas_collsub_sum_scalar_i1); void -nca_collsub_sum_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, +cas_collsub_sum_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_i1 (GFC_INTEGER_1 *obj, int *result_image, } -void nca_collsub_max_array_i1 (gfc_array_i1 * restrict array, int *result_image, +void cas_collsub_max_array_i1 (gfc_array_i1 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_i1); +export_proto (cas_collsub_max_array_i1); void -nca_collsub_max_array_i1 (gfc_array_i1 * restrict array, int *result_image, +cas_collsub_max_array_i1 (gfc_array_i1 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_i1 (gfc_array_i1 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_i1 (gfc_array_i1 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_i1 (gfc_array_i1 * restrict array, int *result_image, +void cas_collsub_min_array_i1 (gfc_array_i1 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_i1); +export_proto (cas_collsub_min_array_i1); void -nca_collsub_min_array_i1 (gfc_array_i1 * restrict array, int *result_image, +cas_collsub_min_array_i1 (gfc_array_i1 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_i1 (gfc_array_i1 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_i1 (gfc_array_i1 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_i1 (gfc_array_i1 * restrict array, int *result_image, +void cas_collsub_sum_array_i1 (gfc_array_i1 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_i1); +export_proto (cas_collsub_sum_array_i1); void -nca_collsub_sum_array_i1 (gfc_array_i1 * restrict array, int *result_image, +cas_collsub_sum_array_i1 (gfc_array_i1 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_i1 (gfc_array_i1 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_i16.c b/libgfortran/generated/nca_minmax_i16.c index 8fbb9481271..f2e458182a5 100644 --- a/libgfortran/generated/nca_minmax_i16.c +++ b/libgfortran/generated/nca_minmax_i16.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, +void cas_collsub_max_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_i16); +export_proto(cas_collsub_max_scalar_i16); void -nca_collsub_max_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, +cas_collsub_max_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, } -void nca_collsub_min_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, +void cas_collsub_min_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_i16); +export_proto(cas_collsub_min_scalar_i16); void -nca_collsub_min_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, +cas_collsub_min_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, } -void nca_collsub_sum_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, +void cas_collsub_sum_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_i16); +export_proto(cas_collsub_sum_scalar_i16); void -nca_collsub_sum_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, +cas_collsub_sum_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_i16 (GFC_INTEGER_16 *obj, int *result_image, } -void nca_collsub_max_array_i16 (gfc_array_i16 * restrict array, int *result_image, +void cas_collsub_max_array_i16 (gfc_array_i16 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_i16); +export_proto (cas_collsub_max_array_i16); void -nca_collsub_max_array_i16 (gfc_array_i16 * restrict array, int *result_image, +cas_collsub_max_array_i16 (gfc_array_i16 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_i16 (gfc_array_i16 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_i16 (gfc_array_i16 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_i16 (gfc_array_i16 * restrict array, int *result_image, +void cas_collsub_min_array_i16 (gfc_array_i16 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_i16); +export_proto (cas_collsub_min_array_i16); void -nca_collsub_min_array_i16 (gfc_array_i16 * restrict array, int *result_image, +cas_collsub_min_array_i16 (gfc_array_i16 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_i16 (gfc_array_i16 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_i16 (gfc_array_i16 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_i16 (gfc_array_i16 * restrict array, int *result_image, +void cas_collsub_sum_array_i16 (gfc_array_i16 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_i16); +export_proto (cas_collsub_sum_array_i16); void -nca_collsub_sum_array_i16 (gfc_array_i16 * restrict array, int *result_image, +cas_collsub_sum_array_i16 (gfc_array_i16 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_i16 (gfc_array_i16 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_i2.c b/libgfortran/generated/nca_minmax_i2.c index 61908d6bf13..fd8d718fbe1 100644 --- a/libgfortran/generated/nca_minmax_i2.c +++ b/libgfortran/generated/nca_minmax_i2.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, +void cas_collsub_max_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_i2); +export_proto(cas_collsub_max_scalar_i2); void -nca_collsub_max_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, +cas_collsub_max_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, } -void nca_collsub_min_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, +void cas_collsub_min_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_i2); +export_proto(cas_collsub_min_scalar_i2); void -nca_collsub_min_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, +cas_collsub_min_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, } -void nca_collsub_sum_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, +void cas_collsub_sum_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_i2); +export_proto(cas_collsub_sum_scalar_i2); void -nca_collsub_sum_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, +cas_collsub_sum_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_i2 (GFC_INTEGER_2 *obj, int *result_image, } -void nca_collsub_max_array_i2 (gfc_array_i2 * restrict array, int *result_image, +void cas_collsub_max_array_i2 (gfc_array_i2 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_i2); +export_proto (cas_collsub_max_array_i2); void -nca_collsub_max_array_i2 (gfc_array_i2 * restrict array, int *result_image, +cas_collsub_max_array_i2 (gfc_array_i2 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_i2 (gfc_array_i2 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_i2 (gfc_array_i2 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_i2 (gfc_array_i2 * restrict array, int *result_image, +void cas_collsub_min_array_i2 (gfc_array_i2 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_i2); +export_proto (cas_collsub_min_array_i2); void -nca_collsub_min_array_i2 (gfc_array_i2 * restrict array, int *result_image, +cas_collsub_min_array_i2 (gfc_array_i2 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_i2 (gfc_array_i2 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_i2 (gfc_array_i2 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_i2 (gfc_array_i2 * restrict array, int *result_image, +void cas_collsub_sum_array_i2 (gfc_array_i2 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_i2); +export_proto (cas_collsub_sum_array_i2); void -nca_collsub_sum_array_i2 (gfc_array_i2 * restrict array, int *result_image, +cas_collsub_sum_array_i2 (gfc_array_i2 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_i2 (gfc_array_i2 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_i4.c b/libgfortran/generated/nca_minmax_i4.c index 5e37586478d..04972e767f7 100644 --- a/libgfortran/generated/nca_minmax_i4.c +++ b/libgfortran/generated/nca_minmax_i4.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, +void cas_collsub_max_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_i4); +export_proto(cas_collsub_max_scalar_i4); void -nca_collsub_max_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, +cas_collsub_max_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, } -void nca_collsub_min_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, +void cas_collsub_min_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_i4); +export_proto(cas_collsub_min_scalar_i4); void -nca_collsub_min_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, +cas_collsub_min_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, } -void nca_collsub_sum_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, +void cas_collsub_sum_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_i4); +export_proto(cas_collsub_sum_scalar_i4); void -nca_collsub_sum_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, +cas_collsub_sum_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_i4 (GFC_INTEGER_4 *obj, int *result_image, } -void nca_collsub_max_array_i4 (gfc_array_i4 * restrict array, int *result_image, +void cas_collsub_max_array_i4 (gfc_array_i4 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_i4); +export_proto (cas_collsub_max_array_i4); void -nca_collsub_max_array_i4 (gfc_array_i4 * restrict array, int *result_image, +cas_collsub_max_array_i4 (gfc_array_i4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_i4 (gfc_array_i4 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_i4 (gfc_array_i4 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_i4 (gfc_array_i4 * restrict array, int *result_image, +void cas_collsub_min_array_i4 (gfc_array_i4 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_i4); +export_proto (cas_collsub_min_array_i4); void -nca_collsub_min_array_i4 (gfc_array_i4 * restrict array, int *result_image, +cas_collsub_min_array_i4 (gfc_array_i4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_i4 (gfc_array_i4 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_i4 (gfc_array_i4 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_i4 (gfc_array_i4 * restrict array, int *result_image, +void cas_collsub_sum_array_i4 (gfc_array_i4 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_i4); +export_proto (cas_collsub_sum_array_i4); void -nca_collsub_sum_array_i4 (gfc_array_i4 * restrict array, int *result_image, +cas_collsub_sum_array_i4 (gfc_array_i4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_i4 (gfc_array_i4 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_i8.c b/libgfortran/generated/nca_minmax_i8.c index b3dc8611981..b4b0864896f 100644 --- a/libgfortran/generated/nca_minmax_i8.c +++ b/libgfortran/generated/nca_minmax_i8.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, +void cas_collsub_max_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_i8); +export_proto(cas_collsub_max_scalar_i8); void -nca_collsub_max_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, +cas_collsub_max_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, } -void nca_collsub_min_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, +void cas_collsub_min_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_i8); +export_proto(cas_collsub_min_scalar_i8); void -nca_collsub_min_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, +cas_collsub_min_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, } -void nca_collsub_sum_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, +void cas_collsub_sum_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_i8); +export_proto(cas_collsub_sum_scalar_i8); void -nca_collsub_sum_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, +cas_collsub_sum_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_i8 (GFC_INTEGER_8 *obj, int *result_image, } -void nca_collsub_max_array_i8 (gfc_array_i8 * restrict array, int *result_image, +void cas_collsub_max_array_i8 (gfc_array_i8 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_i8); +export_proto (cas_collsub_max_array_i8); void -nca_collsub_max_array_i8 (gfc_array_i8 * restrict array, int *result_image, +cas_collsub_max_array_i8 (gfc_array_i8 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_i8 (gfc_array_i8 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_i8 (gfc_array_i8 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_i8 (gfc_array_i8 * restrict array, int *result_image, +void cas_collsub_min_array_i8 (gfc_array_i8 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_i8); +export_proto (cas_collsub_min_array_i8); void -nca_collsub_min_array_i8 (gfc_array_i8 * restrict array, int *result_image, +cas_collsub_min_array_i8 (gfc_array_i8 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_i8 (gfc_array_i8 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_i8 (gfc_array_i8 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_i8 (gfc_array_i8 * restrict array, int *result_image, +void cas_collsub_sum_array_i8 (gfc_array_i8 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_i8); +export_proto (cas_collsub_sum_array_i8); void -nca_collsub_sum_array_i8 (gfc_array_i8 * restrict array, int *result_image, +cas_collsub_sum_array_i8 (gfc_array_i8 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_i8 (gfc_array_i8 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_r10.c b/libgfortran/generated/nca_minmax_r10.c index 10f7324fc92..67111579f0d 100644 --- a/libgfortran/generated/nca_minmax_r10.c +++ b/libgfortran/generated/nca_minmax_r10.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_r10 (GFC_REAL_10 *obj, int *result_image, +void cas_collsub_max_scalar_r10 (GFC_REAL_10 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_r10); +export_proto(cas_collsub_max_scalar_r10); void -nca_collsub_max_scalar_r10 (GFC_REAL_10 *obj, int *result_image, +cas_collsub_max_scalar_r10 (GFC_REAL_10 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_r10 (GFC_REAL_10 *obj, int *result_image, } -void nca_collsub_min_scalar_r10 (GFC_REAL_10 *obj, int *result_image, +void cas_collsub_min_scalar_r10 (GFC_REAL_10 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_r10); +export_proto(cas_collsub_min_scalar_r10); void -nca_collsub_min_scalar_r10 (GFC_REAL_10 *obj, int *result_image, +cas_collsub_min_scalar_r10 (GFC_REAL_10 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_r10 (GFC_REAL_10 *obj, int *result_image, } -void nca_collsub_sum_scalar_r10 (GFC_REAL_10 *obj, int *result_image, +void cas_collsub_sum_scalar_r10 (GFC_REAL_10 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_r10); +export_proto(cas_collsub_sum_scalar_r10); void -nca_collsub_sum_scalar_r10 (GFC_REAL_10 *obj, int *result_image, +cas_collsub_sum_scalar_r10 (GFC_REAL_10 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_r10 (GFC_REAL_10 *obj, int *result_image, } -void nca_collsub_max_array_r10 (gfc_array_r10 * restrict array, int *result_image, +void cas_collsub_max_array_r10 (gfc_array_r10 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_r10); +export_proto (cas_collsub_max_array_r10); void -nca_collsub_max_array_r10 (gfc_array_r10 * restrict array, int *result_image, +cas_collsub_max_array_r10 (gfc_array_r10 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_r10 (gfc_array_r10 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_r10 (gfc_array_r10 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_r10 (gfc_array_r10 * restrict array, int *result_image, +void cas_collsub_min_array_r10 (gfc_array_r10 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_r10); +export_proto (cas_collsub_min_array_r10); void -nca_collsub_min_array_r10 (gfc_array_r10 * restrict array, int *result_image, +cas_collsub_min_array_r10 (gfc_array_r10 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_r10 (gfc_array_r10 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_r10 (gfc_array_r10 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_r10 (gfc_array_r10 * restrict array, int *result_image, +void cas_collsub_sum_array_r10 (gfc_array_r10 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_r10); +export_proto (cas_collsub_sum_array_r10); void -nca_collsub_sum_array_r10 (gfc_array_r10 * restrict array, int *result_image, +cas_collsub_sum_array_r10 (gfc_array_r10 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_r10 (gfc_array_r10 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_r16.c b/libgfortran/generated/nca_minmax_r16.c index a0a0a5164c0..959aec7fde3 100644 --- a/libgfortran/generated/nca_minmax_r16.c +++ b/libgfortran/generated/nca_minmax_r16.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_r16 (GFC_REAL_16 *obj, int *result_image, +void cas_collsub_max_scalar_r16 (GFC_REAL_16 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_r16); +export_proto(cas_collsub_max_scalar_r16); void -nca_collsub_max_scalar_r16 (GFC_REAL_16 *obj, int *result_image, +cas_collsub_max_scalar_r16 (GFC_REAL_16 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_r16 (GFC_REAL_16 *obj, int *result_image, } -void nca_collsub_min_scalar_r16 (GFC_REAL_16 *obj, int *result_image, +void cas_collsub_min_scalar_r16 (GFC_REAL_16 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_r16); +export_proto(cas_collsub_min_scalar_r16); void -nca_collsub_min_scalar_r16 (GFC_REAL_16 *obj, int *result_image, +cas_collsub_min_scalar_r16 (GFC_REAL_16 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_r16 (GFC_REAL_16 *obj, int *result_image, } -void nca_collsub_sum_scalar_r16 (GFC_REAL_16 *obj, int *result_image, +void cas_collsub_sum_scalar_r16 (GFC_REAL_16 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_r16); +export_proto(cas_collsub_sum_scalar_r16); void -nca_collsub_sum_scalar_r16 (GFC_REAL_16 *obj, int *result_image, +cas_collsub_sum_scalar_r16 (GFC_REAL_16 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_r16 (GFC_REAL_16 *obj, int *result_image, } -void nca_collsub_max_array_r16 (gfc_array_r16 * restrict array, int *result_image, +void cas_collsub_max_array_r16 (gfc_array_r16 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_r16); +export_proto (cas_collsub_max_array_r16); void -nca_collsub_max_array_r16 (gfc_array_r16 * restrict array, int *result_image, +cas_collsub_max_array_r16 (gfc_array_r16 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_r16 (gfc_array_r16 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_r16 (gfc_array_r16 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_r16 (gfc_array_r16 * restrict array, int *result_image, +void cas_collsub_min_array_r16 (gfc_array_r16 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_r16); +export_proto (cas_collsub_min_array_r16); void -nca_collsub_min_array_r16 (gfc_array_r16 * restrict array, int *result_image, +cas_collsub_min_array_r16 (gfc_array_r16 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_r16 (gfc_array_r16 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_r16 (gfc_array_r16 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_r16 (gfc_array_r16 * restrict array, int *result_image, +void cas_collsub_sum_array_r16 (gfc_array_r16 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_r16); +export_proto (cas_collsub_sum_array_r16); void -nca_collsub_sum_array_r16 (gfc_array_r16 * restrict array, int *result_image, +cas_collsub_sum_array_r16 (gfc_array_r16 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_r16 (gfc_array_r16 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_r4.c b/libgfortran/generated/nca_minmax_r4.c index 0eb3f1b6340..02dd3b67e51 100644 --- a/libgfortran/generated/nca_minmax_r4.c +++ b/libgfortran/generated/nca_minmax_r4.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_r4 (GFC_REAL_4 *obj, int *result_image, +void cas_collsub_max_scalar_r4 (GFC_REAL_4 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_r4); +export_proto(cas_collsub_max_scalar_r4); void -nca_collsub_max_scalar_r4 (GFC_REAL_4 *obj, int *result_image, +cas_collsub_max_scalar_r4 (GFC_REAL_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_r4 (GFC_REAL_4 *obj, int *result_image, } -void nca_collsub_min_scalar_r4 (GFC_REAL_4 *obj, int *result_image, +void cas_collsub_min_scalar_r4 (GFC_REAL_4 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_r4); +export_proto(cas_collsub_min_scalar_r4); void -nca_collsub_min_scalar_r4 (GFC_REAL_4 *obj, int *result_image, +cas_collsub_min_scalar_r4 (GFC_REAL_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_r4 (GFC_REAL_4 *obj, int *result_image, } -void nca_collsub_sum_scalar_r4 (GFC_REAL_4 *obj, int *result_image, +void cas_collsub_sum_scalar_r4 (GFC_REAL_4 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_r4); +export_proto(cas_collsub_sum_scalar_r4); void -nca_collsub_sum_scalar_r4 (GFC_REAL_4 *obj, int *result_image, +cas_collsub_sum_scalar_r4 (GFC_REAL_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_r4 (GFC_REAL_4 *obj, int *result_image, } -void nca_collsub_max_array_r4 (gfc_array_r4 * restrict array, int *result_image, +void cas_collsub_max_array_r4 (gfc_array_r4 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_r4); +export_proto (cas_collsub_max_array_r4); void -nca_collsub_max_array_r4 (gfc_array_r4 * restrict array, int *result_image, +cas_collsub_max_array_r4 (gfc_array_r4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_r4 (gfc_array_r4 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_r4 (gfc_array_r4 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_r4 (gfc_array_r4 * restrict array, int *result_image, +void cas_collsub_min_array_r4 (gfc_array_r4 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_r4); +export_proto (cas_collsub_min_array_r4); void -nca_collsub_min_array_r4 (gfc_array_r4 * restrict array, int *result_image, +cas_collsub_min_array_r4 (gfc_array_r4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_r4 (gfc_array_r4 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_r4 (gfc_array_r4 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_r4 (gfc_array_r4 * restrict array, int *result_image, +void cas_collsub_sum_array_r4 (gfc_array_r4 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_r4); +export_proto (cas_collsub_sum_array_r4); void -nca_collsub_sum_array_r4 (gfc_array_r4 * restrict array, int *result_image, +cas_collsub_sum_array_r4 (gfc_array_r4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_r4 (gfc_array_r4 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_r8.c b/libgfortran/generated/nca_minmax_r8.c index 3b3e9623150..6af88cb6cc2 100644 --- a/libgfortran/generated/nca_minmax_r8.c +++ b/libgfortran/generated/nca_minmax_r8.c @@ -30,14 +30,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" -void nca_collsub_max_scalar_r8 (GFC_REAL_8 *obj, int *result_image, +void cas_collsub_max_scalar_r8 (GFC_REAL_8 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_r8); +export_proto(cas_collsub_max_scalar_r8); void -nca_collsub_max_scalar_r8 (GFC_REAL_8 *obj, int *result_image, +cas_collsub_max_scalar_r8 (GFC_REAL_8 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -77,12 +76,12 @@ nca_collsub_max_scalar_r8 (GFC_REAL_8 *obj, int *result_image, } -void nca_collsub_min_scalar_r8 (GFC_REAL_8 *obj, int *result_image, +void cas_collsub_min_scalar_r8 (GFC_REAL_8 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_r8); +export_proto(cas_collsub_min_scalar_r8); void -nca_collsub_min_scalar_r8 (GFC_REAL_8 *obj, int *result_image, +cas_collsub_min_scalar_r8 (GFC_REAL_8 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -122,12 +121,12 @@ nca_collsub_min_scalar_r8 (GFC_REAL_8 *obj, int *result_image, } -void nca_collsub_sum_scalar_r8 (GFC_REAL_8 *obj, int *result_image, +void cas_collsub_sum_scalar_r8 (GFC_REAL_8 *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_sum_scalar_r8); +export_proto(cas_collsub_sum_scalar_r8); void -nca_collsub_sum_scalar_r8 (GFC_REAL_8 *obj, int *result_image, +cas_collsub_sum_scalar_r8 (GFC_REAL_8 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -166,12 +165,12 @@ nca_collsub_sum_scalar_r8 (GFC_REAL_8 *obj, int *result_image, } -void nca_collsub_max_array_r8 (gfc_array_r8 * restrict array, int *result_image, +void cas_collsub_max_array_r8 (gfc_array_r8 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_max_array_r8); +export_proto (cas_collsub_max_array_r8); void -nca_collsub_max_array_r8 (gfc_array_r8 * restrict array, int *result_image, +cas_collsub_max_array_r8 (gfc_array_r8 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -296,8 +295,7 @@ nca_collsub_max_array_r8 (gfc_array_r8 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -327,12 +325,12 @@ nca_collsub_max_array_r8 (gfc_array_r8 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_r8 (gfc_array_r8 * restrict array, int *result_image, +void cas_collsub_min_array_r8 (gfc_array_r8 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_min_array_r8); +export_proto (cas_collsub_min_array_r8); void -nca_collsub_min_array_r8 (gfc_array_r8 * restrict array, int *result_image, +cas_collsub_min_array_r8 (gfc_array_r8 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -457,8 +455,7 @@ nca_collsub_min_array_r8 (gfc_array_r8 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -488,12 +485,12 @@ nca_collsub_min_array_r8 (gfc_array_r8 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_sum_array_r8 (gfc_array_r8 * restrict array, int *result_image, +void cas_collsub_sum_array_r8 (gfc_array_r8 * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_sum_array_r8); +export_proto (cas_collsub_sum_array_r8); void -nca_collsub_sum_array_r8 (gfc_array_r8 * restrict array, int *result_image, +cas_collsub_sum_array_r8 (gfc_array_r8 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -617,8 +614,7 @@ nca_collsub_sum_array_r8 (gfc_array_r8 * restrict array, int *result_image, char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_s1.c b/libgfortran/generated/nca_minmax_s1.c index b081452948d..493de0bf463 100644 --- a/libgfortran/generated/nca_minmax_s1.c +++ b/libgfortran/generated/nca_minmax_s1.c @@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" #if 1 == 4 @@ -53,12 +52,12 @@ memcmp4 (const void *a, const void *b, size_t len) } #endif -void nca_collsub_max_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, +void cas_collsub_max_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_s1); +export_proto(cas_collsub_max_scalar_s1); void -nca_collsub_max_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, +cas_collsub_max_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, @@ -92,22 +91,28 @@ nca_collsub_max_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, } collsub_sync (ci); } + /* All images have to execute the same number of collsub_sync, otherwise + some images will hang. Here, we execute the missing ones for images + that are not needed anymore in the main loop. */ for ( ; (local->num_images >> cbit) != 0; cbit++) collsub_sync (ci); if (!result_image || (*result_image - 1) == this_image.image_num) memcpy (obj, buffer, type_size); + /* We need one barrier (it could be either before or after the collsub) that + prevents one image from starting a new collsub before the old one has + finished. */ finish_collective_subroutine (ci); } -void nca_collsub_min_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, +void cas_collsub_min_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_s1); +export_proto(cas_collsub_min_scalar_s1); void -nca_collsub_min_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, +cas_collsub_min_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, @@ -141,30 +146,36 @@ nca_collsub_min_scalar_s1 (GFC_UINTEGER_1 *obj, int *result_image, } collsub_sync (ci); } + /* All images have to execute the same number of collsub_sync, otherwise + some images will hang. Here, we execute the missing ones for images + that are not needed anymore in the main loop. */ for ( ; (local->num_images >> cbit) != 0; cbit++) collsub_sync (ci); if (!result_image || (*result_image - 1) == this_image.image_num) memcpy (obj, buffer, type_size); + /* We need one barrier (it could be either before or after the collsub) that + prevents one image from starting a new collsub before the old one has + finished. */ finish_collective_subroutine (ci); } -void nca_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, +void cas_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto (nca_collsub_max_array_s1); +export_proto (cas_collsub_max_array_s1); void -nca_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, +cas_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, index_type errmsg_len __attribute__ ((unused))) { index_type count[GFC_MAX_DIMENSIONS]; - index_type stride[GFC_MAX_DIMENSIONS]; /* stride is byte-based here. */ + index_type stride[GFC_MAX_DIMENSIONS]; /* Store byte-based strides here. */ index_type extent[GFC_MAX_DIMENSIONS]; char *this_shared_ptr; /* Points to the shared memory allocated to this image. */ char *buffer; @@ -182,7 +193,6 @@ nca_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, type_size = char_len * sizeof (GFC_UINTEGER_1); dim = GFC_DESCRIPTOR_RANK (array); num_elems = 1; - ssize = type_size; packed = true; span = array->span != 0 ? array->span : type_size; for (index_type n = 0; n < dim; n++) @@ -288,8 +298,7 @@ nca_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, char *restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof (index_type) * dim); while (dest) { @@ -320,20 +329,20 @@ nca_collsub_max_array_s1 (gfc_array_s1 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_s1 (gfc_array_s1 * restrict array, int *result_image, +void cas_collsub_min_array_s1 (gfc_array_s1 * restrict array, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto (nca_collsub_min_array_s1); +export_proto (cas_collsub_min_array_s1); void -nca_collsub_min_array_s1 (gfc_array_s1 * restrict array, int *result_image, +cas_collsub_min_array_s1 (gfc_array_s1 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, index_type errmsg_len __attribute__ ((unused))) { index_type count[GFC_MAX_DIMENSIONS]; - index_type stride[GFC_MAX_DIMENSIONS]; /* stride is byte-based here. */ + index_type stride[GFC_MAX_DIMENSIONS]; /* Store byte-based strides here. */ index_type extent[GFC_MAX_DIMENSIONS]; char *this_shared_ptr; /* Points to the shared memory allocated to this image. */ char *buffer; @@ -351,7 +360,6 @@ nca_collsub_min_array_s1 (gfc_array_s1 * restrict array, int *result_image, type_size = char_len * sizeof (GFC_UINTEGER_1); dim = GFC_DESCRIPTOR_RANK (array); num_elems = 1; - ssize = type_size; packed = true; span = array->span != 0 ? array->span : type_size; for (index_type n = 0; n < dim; n++) @@ -457,8 +465,7 @@ nca_collsub_min_array_s1 (gfc_array_s1 * restrict array, int *result_image, char *restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof (index_type) * dim); while (dest) { diff --git a/libgfortran/generated/nca_minmax_s4.c b/libgfortran/generated/nca_minmax_s4.c index b202fda0cc4..9f74da23a84 100644 --- a/libgfortran/generated/nca_minmax_s4.c +++ b/libgfortran/generated/nca_minmax_s4.c @@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" #if 4 == 4 @@ -53,12 +52,12 @@ memcmp4 (const void *a, const void *b, size_t len) } #endif -void nca_collsub_max_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, +void cas_collsub_max_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto(nca_collsub_max_scalar_s4); +export_proto(cas_collsub_max_scalar_s4); void -nca_collsub_max_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, +cas_collsub_max_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, @@ -92,22 +91,28 @@ nca_collsub_max_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, } collsub_sync (ci); } + /* All images have to execute the same number of collsub_sync, otherwise + some images will hang. Here, we execute the missing ones for images + that are not needed anymore in the main loop. */ for ( ; (local->num_images >> cbit) != 0; cbit++) collsub_sync (ci); if (!result_image || (*result_image - 1) == this_image.image_num) memcpy (obj, buffer, type_size); + /* We need one barrier (it could be either before or after the collsub) that + prevents one image from starting a new collsub before the old one has + finished. */ finish_collective_subroutine (ci); } -void nca_collsub_min_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, +void cas_collsub_min_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto(nca_collsub_min_scalar_s4); +export_proto(cas_collsub_min_scalar_s4); void -nca_collsub_min_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, +cas_collsub_min_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, @@ -141,30 +146,36 @@ nca_collsub_min_scalar_s4 (GFC_UINTEGER_4 *obj, int *result_image, } collsub_sync (ci); } + /* All images have to execute the same number of collsub_sync, otherwise + some images will hang. Here, we execute the missing ones for images + that are not needed anymore in the main loop. */ for ( ; (local->num_images >> cbit) != 0; cbit++) collsub_sync (ci); if (!result_image || (*result_image - 1) == this_image.image_num) memcpy (obj, buffer, type_size); + /* We need one barrier (it could be either before or after the collsub) that + prevents one image from starting a new collsub before the old one has + finished. */ finish_collective_subroutine (ci); } -void nca_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, +void cas_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto (nca_collsub_max_array_s4); +export_proto (cas_collsub_max_array_s4); void -nca_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, +cas_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, index_type errmsg_len __attribute__ ((unused))) { index_type count[GFC_MAX_DIMENSIONS]; - index_type stride[GFC_MAX_DIMENSIONS]; /* stride is byte-based here. */ + index_type stride[GFC_MAX_DIMENSIONS]; /* Store byte-based strides here. */ index_type extent[GFC_MAX_DIMENSIONS]; char *this_shared_ptr; /* Points to the shared memory allocated to this image. */ char *buffer; @@ -182,7 +193,6 @@ nca_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, type_size = char_len * sizeof (GFC_UINTEGER_4); dim = GFC_DESCRIPTOR_RANK (array); num_elems = 1; - ssize = type_size; packed = true; span = array->span != 0 ? array->span : type_size; for (index_type n = 0; n < dim; n++) @@ -288,8 +298,7 @@ nca_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, char *restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof (index_type) * dim); while (dest) { @@ -320,20 +329,20 @@ nca_collsub_max_array_s4 (gfc_array_s4 * restrict array, int *result_image, } finish_collective_subroutine (ci); } -void nca_collsub_min_array_s4 (gfc_array_s4 * restrict array, int *result_image, +void cas_collsub_min_array_s4 (gfc_array_s4 * restrict array, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto (nca_collsub_min_array_s4); +export_proto (cas_collsub_min_array_s4); void -nca_collsub_min_array_s4 (gfc_array_s4 * restrict array, int *result_image, +cas_collsub_min_array_s4 (gfc_array_s4 * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, index_type errmsg_len __attribute__ ((unused))) { index_type count[GFC_MAX_DIMENSIONS]; - index_type stride[GFC_MAX_DIMENSIONS]; /* stride is byte-based here. */ + index_type stride[GFC_MAX_DIMENSIONS]; /* Store byte-based strides here. */ index_type extent[GFC_MAX_DIMENSIONS]; char *this_shared_ptr; /* Points to the shared memory allocated to this image. */ char *buffer; @@ -351,7 +360,6 @@ nca_collsub_min_array_s4 (gfc_array_s4 * restrict array, int *result_image, type_size = char_len * sizeof (GFC_UINTEGER_4); dim = GFC_DESCRIPTOR_RANK (array); num_elems = 1; - ssize = type_size; packed = true; span = array->span != 0 ? array->span : type_size; for (index_type n = 0; n < dim; n++) @@ -457,8 +465,7 @@ nca_collsub_min_array_s4 (gfc_array_s4 * restrict array, int *result_image, char *restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof (index_type) * dim); while (dest) { diff --git a/libgfortran/m4/nca-minmax-s.m4 b/libgfortran/m4/nca-minmax-s.m4 index 2d8891fe673..af5dd5d3136 100644 --- a/libgfortran/m4/nca-minmax-s.m4 +++ b/libgfortran/m4/nca-minmax-s.m4 @@ -30,12 +30,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see include(iparm.m4)dnl define(`compare_fcn',`ifelse(rtype_kind,1,memcmp,memcmp4)')dnl -define(SCALAR_FUNCTION,`void nca_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, +define(SCALAR_FUNCTION,`void cas_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto(nca_collsub_'$1`_scalar_'rtype_code`); +export_proto(cas_collsub_'$1`_scalar_'rtype_code`); void -nca_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, +cas_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, @@ -69,32 +69,38 @@ nca_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, } collsub_sync (ci); } + /* All images have to execute the same number of collsub_sync, otherwise + some images will hang. Here, we execute the missing ones for images + that are not needed anymore in the main loop. */ for ( ; (local->num_images >> cbit) != 0; cbit++) collsub_sync (ci); if (!result_image || (*result_image - 1) == this_image.image_num) memcpy (obj, buffer, type_size); + /* We need one barrier (it could be either before or after the collsub) that + prevents one image from starting a new collsub before the old one has + finished. */ finish_collective_subroutine (ci); } ')dnl define(ARRAY_FUNCTION,dnl -`void nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, +`void cas_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, int *stat, char *errmsg, index_type char_len, index_type errmsg_len); -export_proto (nca_collsub_'$1`_array_'rtype_code`); +export_proto (cas_collsub_'$1`_array_'rtype_code`); void -nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, +cas_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type char_len, index_type errmsg_len __attribute__ ((unused))) { index_type count[GFC_MAX_DIMENSIONS]; - index_type stride[GFC_MAX_DIMENSIONS]; /* stride is byte-based here. */ + index_type stride[GFC_MAX_DIMENSIONS]; /* Store byte-based strides here. */ index_type extent[GFC_MAX_DIMENSIONS]; char *this_shared_ptr; /* Points to the shared memory allocated to this image. */ char *buffer; @@ -112,7 +118,6 @@ nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image type_size = char_len * sizeof ('rtype_name`); dim = GFC_DESCRIPTOR_RANK (array); num_elems = 1; - ssize = type_size; packed = true; span = array->span != 0 ? array->span : type_size; for (index_type n = 0; n < dim; n++) @@ -218,8 +223,7 @@ nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image char *restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof (index_type) * dim); while (dest) { @@ -258,7 +262,6 @@ nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" #if 'rtype_kind` == 4 diff --git a/libgfortran/m4/nca_minmax.m4 b/libgfortran/m4/nca_minmax.m4 index 76070c102c0..9e107fc24b8 100644 --- a/libgfortran/m4/nca_minmax.m4 +++ b/libgfortran/m4/nca_minmax.m4 @@ -29,12 +29,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */' include(iparm.m4)dnl -define(SCALAR_FUNCTION,`void nca_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, +define(SCALAR_FUNCTION,`void cas_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto(nca_collsub_'$1`_scalar_'rtype_code`); +export_proto(cas_collsub_'$1`_scalar_'rtype_code`); void -nca_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, +cas_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -75,12 +75,12 @@ nca_collsub_'$1`_scalar_'rtype_code` ('rtype_name` *obj, int *result_image, ')dnl define(ARRAY_FUNCTION,dnl -`void nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, +`void cas_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, int *stat, char *errmsg, index_type errmsg_len); -export_proto (nca_collsub_'$1`_array_'rtype_code`); +export_proto (cas_collsub_'$1`_array_'rtype_code`); void -nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, +cas_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image, int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), index_type errmsg_len __attribute__ ((unused))) @@ -204,8 +204,7 @@ nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image char * restrict dest = (char *) array->base_addr; index_type stride0 = stride[0]; - for (index_type n = 0; n < dim; n++) - count[n] = 0; + memset (count, 0, sizeof(index_type) * dim); while (dest) { @@ -242,7 +241,6 @@ nca_collsub_'$1`_array_'rtype_code` ('rtype` * restrict array, int *result_image #include <string.h> #include "../nca/libcoarraynative.h" #include "../nca/collective_subroutine.h" -#include "../nca/collective_inline.h" SCALAR_FUNCTION(`max',`if (*b > *a) *a = *b;')dnl diff --git a/libgfortran/nca/.tags b/libgfortran/nca/.tags deleted file mode 100644 index 07d260ddb9d..00000000000 --- a/libgfortran/nca/.tags +++ /dev/null @@ -1,275 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ -!_TAG_PROGRAM_NAME Exuberant Ctags // -!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ -!_TAG_PROGRAM_VERSION 5.9~svn20110310 // -ALIGN_TO serialize.c 47;" d file: -ALLOC_H alloc.h 26;" d -COARRAY_LOCK_HDR lock.h 27;" d -COARRAY_NATIVE_HDR libcoarraynative.h 30;" d -COLLECTIVE_SUBROUTINE_HDR collective_subroutine.h 3;" d -CRITICAL_LOOKAHEAD hashmap.c 30;" d file: -DEBUG_PRINTF libcoarraynative.h 45;" d -DEBUG_PRINTF libcoarraynative.h 47;" d -FILL_VALUE serialize.c 57;" d file: -GFC_NCA_EVENT_COARRAY wrapper.c /^ GFC_NCA_EVENT_COARRAY,$/;" e enum:gfc_coarray_allocation_type file: -GFC_NCA_LOCK_COARRAY wrapper.c /^ GFC_NCA_LOCK_COARRAY,$/;" e enum:gfc_coarray_allocation_type file: -GFC_NCA_NORMAL_COARRAY wrapper.c /^ GFC_NCA_NORMAL_COARRAY = 3,$/;" e enum:gfc_coarray_allocation_type file: -GFORTRAN_ENV_NUM_IMAGES coarraynative.c 37;" d file: -HASHMAP_H hashmap.h 69;" d -IMAGE_FAILED libcoarraynative.h /^ IMAGE_FAILED$/;" e enum:__anon7 -IMAGE_FAILED master.c /^ IMAGE_FAILED$/;" e enum:__anon5 file: -IMAGE_OK libcoarraynative.h /^ IMAGE_OK,$/;" e enum:__anon7 -IMAGE_OK master.c /^ IMAGE_OK,$/;" e enum:__anon5 file: -IMAGE_UNKNOWN libcoarraynative.h /^ IMAGE_UNKNOWN = 0,$/;" e enum:__anon7 -IMAGE_UNKNOWN master.c /^ IMAGE_UNKNOWN = 0,$/;" e enum:__anon5 file: -INDENT hashmap.c 403;" d file: -INDENT hashmap.c 414;" d file: -INDENT hashmap.c 415;" d file: -INDENT hashmap.c 429;" d file: -INDENT hashmap.c 430;" d file: -INITIAL_BITNUM hashmap.c 28;" d file: -INITIAL_SIZE hashmap.c 29;" d file: -IPSYNC_HDR sync.h 26;" d -ITER malloc_test.c 13;" d file: -MAX_ALIGN allocator.c 50;" d file: -MAX_NUM malloc_test.c 10;" d file: -MEMOBJ_NAME util.c 11;" d file: -MIN_NUM malloc_test.c 11;" d file: -NUM_BITS malloc_test.c 8;" d file: -NUM_SIZES malloc_test.c 9;" d file: -PE hashmap.c 402;" d file: -PTR_BITS util.h 32;" d -SHARED_ALLOCATOR_HDR allocator.h 2;" d -SHARED_MEMORY_H shared_memory.h 77;" d -SHARED_MEMORY_RAW_ALLOC shared_memory.h 50;" d -SHARED_MEMORY_RAW_ALLOC_PTR shared_memory.h 53;" d -SHMPTR_AS shared_memory.h 46;" d -SHMPTR_DEREF shared_memory.h 44;" d -SHMPTR_EQUALS shared_memory.h 48;" d -SHMPTR_IS_NULL shared_memory.h 42;" d -SHMPTR_NULL shared_memory.h 41;" d -SHMPTR_SET shared_memory.h 47;" d -SZ malloc_test.c 12;" d file: -UTIL_HDR util.h 26;" d -a hashmap.h /^ allocator *a;$/;" m struct:hashmap -a sync.h /^ allocator *a;$/;" m struct:__anon3 -ai libcoarraynative.h /^ alloc_iface ai;$/;" m struct:__anon11 -alignto util.c /^alignto(size_t size, size_t align) {$/;" f -alloc alloc.h /^ allocator alloc;$/;" m struct:alloc_iface -alloc_iface alloc.h /^typedef struct alloc_iface$/;" s -alloc_iface alloc.h /^} alloc_iface;$/;" t typeref:struct:alloc_iface -alloc_iface_init alloc.c /^alloc_iface_init (alloc_iface *iface, shared_memory *mem)$/;" f -alloc_iface_init alloc.h /^internal_proto (alloc_iface_init);$/;" v -alloc_iface_shared alloc.h /^typedef struct alloc_iface_shared$/;" s -alloc_iface_shared alloc.h /^} alloc_iface_shared;$/;" t typeref:struct:alloc_iface_shared -allocator allocator.h /^} allocator;$/;" t typeref:struct:__anon17 -allocator_init allocator.c /^allocator_init (allocator *a, allocator_shared *s, shared_memory *sm)$/;" f -allocator_s alloc.h /^ allocator_shared allocator_s;$/;" m struct:alloc_iface_shared -allocator_shared allocator.h /^} allocator_shared;$/;" t typeref:struct:__anon16 -allocs shared_memory.c /^ } allocs[];$/;" m struct:shared_memory_act typeref:struct:shared_memory_act::local_alloc file: -arr lock.h /^ pthread_mutex_t arr[];$/;" m struct:__anon12 -as alloc.h /^ alloc_iface_shared *as;$/;" m struct:alloc_iface -barrier collective_subroutine.h /^ pthread_barrier_t barrier;$/;" m struct:collsub_iface_shared -barrier libcoarraynative.h /^ pthread_barrier_t barrier;$/;" m struct:__anon6 -base shared_memory.c /^ void *base;$/;" m struct:shared_memory_act::local_alloc file: -bitnum hashmap.h /^ int bitnum;$/;" m struct:__anon14 -bucket allocator.c /^} bucket;$/;" t typeref:struct:__anon1 file: -ci libcoarraynative.h /^ collsub_iface ci;$/;" m struct:__anon11 -cis sync.h /^ sync_iface_shared *cis;$/;" m struct:__anon3 -collsub_broadcast collective_subroutine.h /^internal_proto (collsub_broadcast);$/;" v -collsub_buf collective_subroutine.c /^void *collsub_buf = NULL;$/;" v -collsub_buf collective_subroutine.h /^ shared_mem_ptr collsub_buf;$/;" m struct:collsub_iface_shared -collsub_buf collective_subroutine.h /^ void *collsub_buf; \/* Cached pointer to shared collsub_buf. *\/$/;" m struct:collsub_iface -collsub_buf collective_subroutine.h /^internal_proto (collsub_buf);$/;" v -collsub_iface collective_subroutine.h /^typedef struct collsub_iface$/;" s -collsub_iface collective_subroutine.h /^} collsub_iface;$/;" t typeref:struct:collsub_iface -collsub_iface_shared collective_subroutine.h /^typedef struct collsub_iface_shared $/;" s -collsub_iface_shared collective_subroutine.h /^} collsub_iface_shared;$/;" t typeref:struct:collsub_iface_shared -collsub_reduce collective_subroutine.c /^collsub_reduce (void *obj, size_t nobjs, int *result_image, size_t size, $/;" f -collsub_reduce collective_subroutine.h /^internal_proto (collsub_reduce);$/;" v -collsub_sync collective_subroutine.c /^collsub_sync (void) {$/;" f -collsub_sync collective_subroutine.h /^internal_proto (collsub_sync);$/;" v -copy_from collective_inline.h /^copy_from (int image) $/;" f -copy_in collective_inline.h /^copy_in (void *obj) {$/;" f -copy_out collective_inline.h /^copy_out (void *obj, int image)$/;" f -copy_to collective_inline.h /^copy_to (void *obj, int image)$/;" f -curr_size collective_subroutine.c /^size_t curr_size = 0;$/;" v -curr_size collective_subroutine.h /^ size_t curr_size;$/;" m struct:collsub_iface_shared -curr_size collective_subroutine.h /^internal_proto (curr_size);$/;" v -data hashmap.h /^ shared_mem_ptr data;$/;" m struct:__anon14 -deserialize_memory serialize.c /^export_proto (deserialize_memory);$/;" v -div_ru wrapper.c /^div_ru (int divident, int divisor)$/;" f file: -dump_hm hashmap.c /^dump_hm(hashmap *hm) {$/;" f -enlarge_hashmap_mem hashmap.c /^enlarge_hashmap_mem (hashmap *hm, hashmap_entry **data, bool f)$/;" f file: -ensure_initialization coarraynative.c /^ensure_initialization(void) {$/;" f -fd shared_memory.c /^ int fd;$/;" m struct:__anon18 file: -finish_collective_subroutine collective_inline.h /^finish_collective_subroutine (void) $/;" f -free_bucket_head allocator.h /^ shared_mem_ptr free_bucket_head[PTR_BITS];$/;" m struct:__anon16 -free_memory_with_id alloc.c /^free_memory_with_id (alloc_iface* iface, memid id)$/;" f -free_memory_with_id alloc.h /^internal_proto (free_memory_with_id);$/;" v -gen_mask hashmap.c /^gen_mask (hashmap *hm)$/;" f file: -get_allocator alloc.c /^get_allocator (alloc_iface * iface)$/;" f -get_allocator alloc.h /^internal_proto (get_allocator);$/;" v -get_data hashmap.c /^get_data(hashmap *hm)$/;" f file: -get_environ_image_num coarraynative.c /^get_environ_image_num (void)$/;" f file: -get_expected_offset hashmap.c /^get_expected_offset (hashmap *hm, memid id)$/;" f file: -get_locked_table sync.c /^get_locked_table(sync_iface *si) { \/\/ The initialization of the table has to $/;" f file: -get_master coarraynative.c /^get_master (void) {$/;" f file: -get_memory_by_id alloc.c /^get_memory_by_id (alloc_iface *iface, size_t size, memid id)$/;" f -get_memory_by_id alloc.h /^internal_proto (get_memory_by_id);$/;" v -get_obj_ptr collective_inline.h /^get_obj_ptr (int image) $/;" f -get_shared_memory_act_size shared_memory.c /^get_shared_memory_act_size (int nallocs)$/;" f file: -get_shmem_fd util.c /^get_shmem_fd (void)$/;" f -gfc_coarray_allocation_type wrapper.c /^enum gfc_coarray_allocation_type {$/;" g file: -global_shared_memory_meta shared_memory.c /^} global_shared_memory_meta;$/;" t typeref:struct:__anon18 file: -has_failed_image libcoarraynative.h /^ int has_failed_image;$/;" m struct:__anon9 -has_failed_image master.c /^ int has_failed_image = 0;$/;" m struct:__anon4 file: -hash hashmap.c /^hash (uint64_t key)$/;" f file: -hashmap hashmap.h /^typedef struct hashmap$/;" s -hashmap hashmap.h /^} hashmap;$/;" t typeref:struct:hashmap -hashmap_change_refcnt hashmap.c /^hashmap_change_refcnt (hashmap *hm, memid id, hashmap_search_result *res,$/;" f file: -hashmap_dec hashmap.c /^hashmap_dec (hashmap *hm, memid id, hashmap_search_result * res)$/;" f -hashmap_entry hashmap.c /^} hashmap_entry;$/;" t typeref:struct:__anon13 file: -hashmap_get hashmap.c /^hashmap_get (hashmap *hm, memid id)$/;" f -hashmap_inc hashmap.c /^hashmap_inc (hashmap *hm, memid id, hashmap_search_result * res)$/;" f -hashmap_init hashmap.c /^hashmap_init (hashmap *hm, hashmap_shared *hs, allocator *a,$/;" f -hashmap_search_result hashmap.h /^} hashmap_search_result;$/;" t typeref:struct:__anon15 -hashmap_set hashmap.c /^hashmap_set (hashmap *hm, memid id, hashmap_search_result *hsr,$/;" f -hashmap_shared hashmap.h /^} hashmap_shared;$/;" t typeref:struct:__anon14 -header shared_memory.c /^ void *header;$/;" m struct:shared_memory_act file: -hm alloc.h /^ hashmap hm;$/;" m struct:alloc_iface -hm_search_result_contains hashmap.c /^hm_search_result_contains (hashmap_search_result *res)$/;" f -hm_search_result_ptr hashmap.c /^hm_search_result_ptr (hashmap_search_result *res)$/;" f -hm_search_result_size hashmap.c /^hm_search_result_size (hashmap_search_result *res)$/;" f -hmiadd hashmap.c /^hmiadd (hashmap *hm, size_t s, ssize_t o) {$/;" f file: -hms alloc.h /^ hashmap_shared hms;$/;" m struct:alloc_iface_shared -id hashmap.c /^ memid id;$/;" m struct:__anon13 file: -image libcoarraynative.h /^} image;$/;" t typeref:struct:__anon10 -image_main_wrapper master.c /^image_main_wrapper (void (*image_main) (void), int this_image_num)$/;" f file: -image_num libcoarraynative.h /^ int image_num;$/;" m struct:__anon10 -image_status libcoarraynative.h /^} image_status;$/;" t typeref:enum:__anon7 -image_tracker libcoarraynative.h /^} image_tracker;$/;" t typeref:struct:__anon8 -images libcoarraynative.h /^ image_tracker images[];$/;" m struct:__anon9 -images master.c /^ struct image_status * images;$/;" m struct:__anon4 typeref:struct:__anon4::image_status file: -init_collsub collective_subroutine.c /^init_collsub (void) {$/;" f -init_collsub collective_subroutine.h /^internal_proto (init_collsub);$/;" v -initialize_shared_mutex util.c /^initialize_shared_mutex (pthread_mutex_t *mutex)$/;" f -initialized lock.h /^ int initialized;$/;" m struct:__anon12 -ipcollsub libcoarraynative.h /^} ipcollsub;$/;" t typeref:struct:__anon6 -last_base shared_memory.c /^last_base (shared_memory_act *mem)$/;" f file: -last_seen_size shared_memory.c /^ size_t last_seen_size;$/;" m struct:shared_memory_act file: -local coarraynative.c /^nca_local_data *local = NULL;$/;" v -local_alloc shared_memory.c /^ struct local_alloc {$/;" s struct:shared_memory_act file: -lock alloc.h /^ pthread_mutex_t lock;$/;" m struct:alloc_iface_shared -lock_array lock.h /^} lock_array;$/;" t typeref:struct:__anon12 -lock_table sync.c /^lock_table (sync_iface *si)$/;" f file: -m libcoarraynative.h /^ master *m;$/;" m struct:__anon10 -main malloc_test.c /^int main()$/;" f -map_memory shared_memory.c /^map_memory (int fd, size_t size, off_t offset)$/;" f file: -master libcoarraynative.h /^} master;$/;" t typeref:struct:__anon9 -master master.c /^} master;$/;" t typeref:struct:__anon4 file: -max_lookahead hashmap.c /^ int max_lookahead; $/;" m struct:__anon13 file: -maximg libcoarraynative.h /^ int maximg;$/;" m struct:__anon6 -mem alloc.h /^ shared_memory *mem;$/;" m struct:alloc_iface -memid hashmap.h /^typedef intptr_t memid;$/;" t -meta shared_memory.c /^ global_shared_memory_meta *meta;$/;" m struct:shared_memory_act file: -n_ent hashmap.c /^static ssize_t n_ent;$/;" v file: -nca_co_broadcast collective_subroutine.c /^export_proto (nca_co_broadcast);$/;" v -nca_co_broadcast collective_subroutine.c /^nca_co_broadcast (gfc_array_char * restrict a, int source_image,$/;" f -nca_coarray_alloc wrapper.c /^export_proto (nca_coarray_alloc);$/;" v -nca_coarray_alloc wrapper.c /^nca_coarray_alloc (gfc_array_void *desc, int elem_size, int corank,$/;" f -nca_coarray_free wrapper.c /^export_proto (nca_coarray_free);$/;" v -nca_coarray_free wrapper.c /^nca_coarray_free (gfc_array_void *desc, int alloc_type)$/;" f -nca_coarray_num_images wrapper.c /^export_proto (nca_coarray_num_images);$/;" v -nca_coarray_num_images wrapper.c /^nca_coarray_num_images (int distance __attribute__((unused)))$/;" f -nca_coarray_sync_all wrapper.c /^export_proto (nca_coarray_sync_all);$/;" v -nca_coarray_sync_all wrapper.c /^nca_coarray_sync_all (int *stat __attribute__((unused)))$/;" f -nca_coarray_this_image wrapper.c /^export_proto (nca_coarray_this_image);$/;" v -nca_coarray_this_image wrapper.c /^nca_coarray_this_image (int distance __attribute__((unused)))$/;" f -nca_collsub_reduce_array wrapper.c /^export_proto (nca_collsub_reduce_array);$/;" v -nca_collsub_reduce_array wrapper.c /^nca_collsub_reduce_array (gfc_array_void *desc, void (*assign_function) (void *, void *),$/;" f -nca_collsub_reduce_scalar wrapper.c /^export_proto (nca_collsub_reduce_scalar);$/;" v -nca_collsub_reduce_scalar wrapper.c /^nca_collsub_reduce_scalar (void *obj, index_type elem_size,$/;" f -nca_local_data libcoarraynative.h /^} nca_local_data;$/;" t typeref:struct:__anon11 -nca_lock wrapper.c /^export_proto (nca_lock);$/;" v -nca_lock wrapper.c /^nca_lock (void *lock)$/;" f -nca_master coarraynative.c /^nca_master (void (*image_main) (void)) {$/;" f -nca_master master.c /^nca_master (void (*image_main) (void)) {$/;" f -nca_master master.c /^nca_master (void (*image_main) (void))$/;" f -nca_sync_images wrapper.c /^export_proto (nca_sync_images);$/;" v -nca_sync_images wrapper.c /^nca_sync_images (size_t s, int *images,$/;" f -nca_unlock wrapper.c /^export_proto (nca_unlock);$/;" v -nca_unlock wrapper.c /^nca_unlock (void *lock)$/;" f -new_base_mapping shared_memory.c /^new_base_mapping (shared_memory_act *mem)$/;" f file: -next allocator.c /^ shared_mem_ptr next;$/;" m struct:__anon1 file: -next_power_of_two util.c /^next_power_of_two(size_t size) {$/;" f -num_entries hashmap.c /^num_entries (hashmap_entry *data, size_t size)$/;" f file: -num_images libcoarraynative.h /^ int num_images;$/;" m struct:__anon11 -num_local_allocs shared_memory.c /^ size_t num_local_allocs;$/;" m struct:shared_memory_act file: -offset shared_memory.h /^ ssize_t offset;$/;" m struct:shared_mem_ptr -owner lock.h /^ int owner;$/;" m struct:__anon12 -p hashmap.c /^ shared_mem_ptr p; \/* If p == SHMPTR_NULL, the entry is empty. *\/$/;" m struct:__anon13 file: -p hashmap.h /^ shared_mem_ptr p;$/;" m struct:__anon15 -pagesize util.c /^size_t pagesize = 1<<17;$/;" v -pid libcoarraynative.h /^ pid_t pid;$/;" m struct:__anon8 -prepare_collective_subroutine collective_subroutine.c /^prepare_collective_subroutine (size_t size)$/;" f -prepare_collective_subroutine collective_subroutine.h /^internal_proto (prepare_collective_subroutine);$/;" v -refcnt hashmap.c /^ int refcnt;$/;" m struct:__anon13 file: -res_offset hashmap.h /^ ssize_t res_offset;$/;" m struct:__anon15 -resize_hm hashmap.c /^resize_hm (hashmap *hm, hashmap_entry **data)$/;" f file: -round_to_pagesize util.c /^round_to_pagesize(size_t s) {$/;" f -s allocator.h /^ allocator_shared *s;$/;" m struct:__anon17 -s collective_subroutine.h /^ collsub_iface_shared *s;$/;" m struct:collsub_iface -s hashmap.c /^ size_t s;$/;" m struct:__anon13 file: -s hashmap.h /^ hashmap_shared *s;$/;" m struct:hashmap -scan_empty hashmap.c /^scan_empty (hashmap *hm, ssize_t expected_off, memid id)$/;" f file: -scan_inside_lookahead hashmap.c /^scan_inside_lookahead (hashmap *hm, ssize_t expected_off, memid id)$/;" f file: -serialize_memory serialize.c /^export_proto (serialize_memory);$/;" v -serialize_memory serialize.c /^serialize_memory (gfc_array_char * const restrict source, char *d)$/;" f -shared_free allocator.c /^shared_free (allocator *a, shared_mem_ptr p, size_t size) {$/;" f -shared_malloc allocator.c /^shared_malloc (allocator *a, size_t size)$/;" f -shared_mem_ptr shared_memory.h /^typedef struct shared_mem_ptr$/;" s -shared_mem_ptr shared_memory.h /^} shared_mem_ptr;$/;" t typeref:struct:shared_mem_ptr -shared_mem_ptr_to_void_ptr shared_memory.c /^shared_mem_ptr_to_void_ptr(shared_memory_act **pmem, shared_mem_ptr smp)$/;" f -shared_mem_ptr_to_void_ptr shared_memory.h /^internal_proto (shared_mem_ptr_to_void_ptr);$/;" v -shared_memory shared_memory.h /^typedef struct shared_memory_act * shared_memory;$/;" t typeref:struct:shared_memory_act -shared_memory_act shared_memory.c /^typedef struct shared_memory_act$/;" s file: -shared_memory_act shared_memory.c /^} shared_memory_act;$/;" t typeref:struct:shared_memory_act file: -shared_memory_get_mem_with_alignment shared_memory.c /^shared_memory_get_mem_with_alignment (shared_memory_act **pmem, size_t size,$/;" f -shared_memory_get_mem_with_alignment shared_memory.h /^internal_proto (shared_memory_get_mem_with_alignment);$/;" v -shared_memory_init shared_memory.c /^shared_memory_init (shared_memory_act **pmem)$/;" f -shared_memory_init shared_memory.h /^internal_proto (shared_memory_init);$/;" v -shared_memory_prepare shared_memory.c /^shared_memory_prepare (shared_memory_act **pmem)$/;" f -shared_memory_prepare shared_memory.h /^internal_proto (shared_memory_prepare);$/;" v -shm allocator.h /^ shared_memory *shm;$/;" m struct:__anon17 -si libcoarraynative.h /^ sync_iface si;$/;" m struct:__anon11 -size hashmap.h /^ size_t size;$/;" m struct:__anon14 -size hashmap.h /^ size_t size;$/;" m struct:__anon15 -size shared_memory.c /^ size_t size;$/;" m struct:shared_memory_act::local_alloc file: -size shared_memory.c /^ size_t size;$/;" m struct:__anon18 file: -sm collective_subroutine.h /^ shared_memory *sm;$/;" m struct:collsub_iface -sm hashmap.h /^ shared_memory *sm;$/;" m struct:hashmap -sm libcoarraynative.h /^ shared_memory sm;$/;" m struct:__anon11 -sm sync.h /^ shared_memory *sm;$/;" m struct:__anon3 -status libcoarraynative.h /^ image_status status;$/;" m struct:__anon8 -sync_all sync.c /^sync_all (sync_iface *si)$/;" f -sync_all sync.h /^ pthread_barrier_t sync_all;$/;" m struct:__anon2 -sync_all sync.h /^internal_proto (sync_all);$/;" v -sync_all_init sync.c /^sync_all_init (pthread_barrier_t *b)$/;" f file: -sync_iface sync.h /^} sync_iface;$/;" t typeref:struct:__anon3 -sync_iface_init sync.c /^sync_iface_init (sync_iface *si, alloc_iface *ai, shared_memory *sm)$/;" f -sync_iface_init sync.h /^internal_proto (sync_iface_init);$/;" v -sync_iface_shared sync.h /^} sync_iface_shared;$/;" t typeref:struct:__anon2 -sync_table sync.c /^sync_table (sync_iface *si, int *images, size_t size)$/;" f -sync_table sync.h /^internal_proto (sync_table);$/;" v -table sync.h /^ int *table; \/\/ we can cache the table and the trigger pointers here$/;" m struct:__anon3 -table sync.h /^ shared_mem_ptr table;$/;" m struct:__anon2 -table_lock sync.h /^ pthread_mutex_t table_lock;$/;" m struct:__anon2 -this_image coarraynative.c /^image this_image;$/;" v -triggers sync.h /^ pthread_cond_t *triggers;$/;" m struct:__anon3 -triggers sync.h /^ shared_mem_ptr triggers;$/;" m struct:__anon2 -unlock_table sync.c /^unlock_table (sync_iface *si)$/;" f file: -used shared_memory.c /^ size_t used;$/;" m struct:__anon18 file: -wait_table_cond sync.c /^wait_table_cond (sync_iface *si, pthread_cond_t *cond)$/;" f file: diff --git a/libgfortran/nca/README.native_coarrays b/libgfortran/nca/README.native_coarrays index 6eea35e9044..02fc0135712 100644 --- a/libgfortran/nca/README.native_coarrays +++ b/libgfortran/nca/README.native_coarrays @@ -1,35 +1,29 @@ -Each image is its own process, that is forked from the master process -at the start of the program. The number of images is determined by the -environment variable GFORTRAN_NUM_IMAGES or, alternatively, the number -of processors. +Each image is its own process, that is forked from the master process at the +start of the program. The number of images is determined by the environment +variable GFORTRAN_NUM_IMAGES or, alternatively, the number of processors. -Each coarray is identified by its address. Since coarrays always -behave as if they had the SAVE attribute, this works even for -allocatable coarrays. ASLR is not an issue, since the addresses are -assigned at startup and remain valid over forks. If, on two different -images, the allocation function is called with the same descriptor -address, the same piece of memory is allocated. +Each coarray is identified by its address. Since coarrays always behave as if +they had the SAVE attribute, this works even for allocatable coarrays. ASLR is +not an issue, since the addresses are assigned at startup and remain valid over +forks. If, on two different images, the allocation function is called with the +same descriptor address, the same piece of memory is allocated. -Internally, the allocator (alloc.c) uses a shared hashmap (hashmap.c) -to remember with which ids pieces of memory allocated. If a new piece -of memory is needed, a simple relatively allocator (allocator.c) is -used. If the allocator doesn't hold any previously free()d memory, it -requests it from the shared memory object (shared_memory.c), which -also handles the translation of shared_mem_ptr's to pointers in the -address space of the image. At the moment shared_memory relies on -double-mapping pages for this (which might restrict the architectures -on which this will work, I have tested this on x86 and POWER), but -since any piece of memory should only be written to through one -address within one alloc/free pair, it shouldn't matter that much -performance-wise. +Internally, the allocator (alloc.c) uses a shared hashmap (hashmap.c) to +remember with which ids pieces of memory allocated. If a new piece of memory is +needed, a simple relatively allocator (allocator.c) is used. If the allocator +doesn't hold any previously free()d memory, it requests it from the shared +memory object (shared_memory.c), which also handles the translation of +shared_mem_ptr's to pointers in the address space of the image. At the moment +shared_memory relies on double-mapping pages for this (which might restrict the +architectures on which this will work, I have tested this on x86 and POWER), +but since any piece of memory should only be written to through one address +within one alloc/free pair, it shouldn't matter that much performance-wise. -The entry points in the library with the exception of master are -defined in wrapper.c, master(), the function handling launching the -images, is defined in coarraynative.c, and the other files shouldn't -require much explanation. +The entry points in the library with the exception of master are defined in +wrapper.c, master(), the function handling launching the images, is defined in +coarraynative.c, and the other files shouldn't require much explanation. - -To compile a program to run with native coarrays, compile with --fcoarray=shared -lcaf_shared -lrt (I've not yet figured out how to -automagically link against the library). +To compile a program to run with native coarrays, compile with -fcoarray=shared +-lcaf_shared -lrt (I've not yet figured out how to automagically link against +the library if -fcoarray=shared is specified). diff --git a/libgfortran/nca/alloc.c b/libgfortran/nca/alloc.c index 174fe330c32..b6246d9ed08 100644 --- a/libgfortran/nca/alloc.c +++ b/libgfortran/nca/alloc.c @@ -113,8 +113,9 @@ free_memory_with_id (alloc_iface* iface, memid id) char buffer[100]; snprintf (buffer, sizeof(buffer), "Error in free_memory_with_id: " "%p not found", (void *) id); + /* FIXME: For some reason, internal_error (NULL, buffer) fails to link, + * so we use dprintf at the moment. */ dprintf (2, buffer); - // internal_error (NULL, buffer); exit (1); } diff --git a/libgfortran/nca/coarraynative.c b/libgfortran/nca/coarraynative.c index c9d13ee92ac..109bf88b30f 100644 --- a/libgfortran/nca/coarraynative.c +++ b/libgfortran/nca/coarraynative.c @@ -101,7 +101,7 @@ get_master (void) { argument. It forks the images and waits for their completion. */ void -nca_master (void (*image_main) (void)) { +cas_master (void (*image_main) (void)) { master *m; int i, j; pid_t new; @@ -131,12 +131,19 @@ nca_master (void (*image_main) (void)) { for (i = 0; i < local->num_images; i++) { new = wait (&chstatus); - if (!WIFEXITED (chstatus) || WEXITSTATUS (chstatus)) + if (WIFEXITED (chstatus) && !WEXITSTATUS (chstatus)) + { + j = 0; + for (; j < local->num_images && m->images[j].pid != new; j++); + m->images[j].status = IMAGE_SUCCESS; + m->finished_images++; /* FIXME: Needs to be atomic, probably. */ + } + else if (!WIFEXITED (chstatus) || WEXITSTATUS (chstatus)) { j = 0; for (; j < local->num_images && m->images[j].pid != new; j++); m->images[j].status = IMAGE_FAILED; - m->has_failed_image++; //FIXME: Needs to be atomic, probably + m->has_failed_image++; /* FIXME: Needs to be atomic, probably. */ dprintf (2, "ERROR: Image %d(%#x) failed\n", j, new); exit_code = 1; } diff --git a/libgfortran/nca/collective_inline.h b/libgfortran/nca/collective_inline.h deleted file mode 100644 index 4e7107b359d..00000000000 --- a/libgfortran/nca/collective_inline.h +++ /dev/null @@ -1,42 +0,0 @@ -#include "collective_subroutine.h" - -static inline void -finish_collective_subroutine (collsub_iface *ci) -{ - collsub_sync (ci); -} - -#if 0 -static inline void * -get_obj_ptr (void *buffer, int image) -{ - return (char *) + curr_size * image; -} - -/* If obj is NULL, copy the object from the entry in this image. */ -static inline void -copy_to (void *buffer, void *obj, int image) -{ - if (obj == 0) - obj = get_obj_ptr (this_image.image_num); - memcpy (get_obj_ptr (image), obj, curr_size); -} - -static inline void -copy_out (void *buffer, void *obj, int image) -{ - memcpy (obj, get_obj_ptr (image), curr_size); -} - -static inline void -copy_from (void *buffer, int image) -{ - copy_out (get_obj_ptr (this_image.image_num), image); -} - -static inline void -copy_in (void *buffer, void *obj) -{ - copy_to (obj, this_image.image_num); -} -#endif diff --git a/libgfortran/nca/collective_subroutine.c b/libgfortran/nca/collective_subroutine.c index 8a8a7d659f0..cc7cbb7fbaf 100644 --- a/libgfortran/nca/collective_subroutine.c +++ b/libgfortran/nca/collective_subroutine.c @@ -26,7 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include "libcoarraynative.h" #include "collective_subroutine.h" -#include "collective_inline.h" #include "allocator.h" void * @@ -35,6 +34,8 @@ get_collsub_buf (collsub_iface *ci, size_t size) void *ret; pthread_mutex_lock (&ci->s->mutex); + /* curr_size is always at least sizeof(double), so we don't need to worry + about size == 0. */ if (size > ci->s->curr_size) { shared_free (ci->a, ci->s->collsub_buf, ci->s->curr_size); @@ -47,18 +48,17 @@ get_collsub_buf (collsub_iface *ci, size_t size) return ret; } -/* It appears as if glibc's barrier implementation does not spin (at - least that is what I got from a quick glance at the source code), - so performance would be improved quite a bit if we spun a few times - here so we don't run into the futex syscall. */ + +/* This function syncs all images with one another. It will only return once + all images have called it. */ void collsub_sync (collsub_iface *ci) { - //dprintf (2, "Calling collsub_sync %d times\n", ++called); pthread_barrier_wait (&ci->s->barrier); } + /* assign_function is needed since we only know how to assign the type inside the compiler. It should be implemented as follows: @@ -103,7 +103,7 @@ collsub_reduce_array (collsub_iface *ci, gfc_array_char *desc, int *result_image imoffset = 1 << cbit; if (this_image.image_num + imoffset < local->num_images) /* Reduce arrays elementwise. */ - for (size_t i = 0; i < pi.num_elem; i++) + for (ssize_t i = 0; i < pi.num_elem; i++) assign_function (this_image_buf + elem_size * i, this_image_buf + this_image_size_bytes * imoffset + elem_size * i); @@ -165,7 +165,6 @@ void collsub_iface_init (collsub_iface *ci, alloc_iface *ai, shared_memory *sm) { pthread_barrierattr_t attr; - shared_mem_ptr p; ci->s = SHARED_MEMORY_RAW_ALLOC_PTR(sm, collsub_iface_shared); ci->s->collsub_buf = shared_malloc(get_allocator(ai), sizeof(double)*local->num_images); @@ -189,8 +188,6 @@ collsub_broadcast_scalar (collsub_iface *ci, void *obj, index_type elem_size, buffer = get_collsub_buf (ci, elem_size); - dprintf(2, "Source image: %d\n", source_image); - if (source_image == this_image.image_num) { memcpy (buffer, obj, elem_size); @@ -214,7 +211,6 @@ collsub_broadcast_array (collsub_iface *ci, gfc_array_char *desc, bool packed; index_type elem_size; index_type size_bytes; - char *this_image_buf; packed = pack_array_prepare (&pi, desc); if (pi.num_elem == 0) @@ -244,173 +240,3 @@ collsub_broadcast_array (collsub_iface *ci, gfc_array_char *desc, finish_collective_subroutine (ci); } - -#if 0 - -void nca_co_broadcast (gfc_array_char *, int, int*, char *, size_t); -export_proto (nca_co_broadcast); - -void -nca_co_broadcast (gfc_array_char * restrict a, int source_image, - int *stat, char *errmsg __attribute__ ((unused)), - size_t errmsg_len __attribute__ ((unused))) -{ - index_type count[GFC_MAX_DIMENSIONS]; - index_type stride[GFC_MAX_DIMENSIONS]; - index_type extent[GFC_MAX_DIMENSIONS]; - index_type type_size; - index_type dim; - index_type span; - bool packed, empty; - index_type num_elems; - index_type ssize, ssize_bytes; - char *this_shared_ptr, *other_shared_ptr; - - if (stat) - *stat = 0; - - dim = GFC_DESCRIPTOR_RANK (a); - type_size = GFC_DESCRIPTOR_SIZE (a); - - /* Source image, gather. */ - if (source_image - 1 == image_num) - { - num_elems = 1; - if (dim > 0) - { - span = a->span != 0 ? a->span : type_size; - packed = true; - empty = false; - for (index_type n = 0; n < dim; n++) - { - count[n] = 0; - stride[n] = GFC_DESCRIPTOR_STRIDE (a, n) * span; - extent[n] = GFC_DESCRIPTOR_EXTENT (a, n); - - empty = empty || extent[n] <= 0; - - if (num_elems != GFC_DESCRIPTOR_STRIDE (a, n)) - packed = false; - - num_elems *= extent[n]; - } - ssize_bytes = num_elems * type_size; - } - else - { - ssize_bytes = type_size; - packed = true; - empty = false; - } - - prepare_collective_subroutine (ssize_bytes); // broadcast barrier 1 - this_shared_ptr = get_obj_ptr (image_num); - if (packed) - memcpy (this_shared_ptr, a->base_addr, ssize_bytes); - else - { - char *src = (char *) a->base_addr; - char * restrict dest = this_shared_ptr; - index_type stride0 = stride[0]; - - while (src) - { - /* Copy the data. */ - - memcpy (dest, src, type_size); - dest += type_size; - src += stride0; - count[0] ++; - /* Advance to the next source element. */ - for (index_type n = 0; count[n] == extent[n] ; ) - { - /* When we get to the end of a dimension, reset it - and increment the next dimension. */ - count[n] = 0; - src -= stride[n] * extent[n]; - n++; - if (n == dim) - { - src = NULL; - break; - } - else - { - count[n]++; - src += stride[n]; - } - } - } - } - collsub_sync (ci); /* Broadcast barrier 2. */ - } - else /* Target image, scatter. */ - { - collsub_sync (ci); /* Broadcast barrier 1. */ - packed = 1; - num_elems = 1; - span = a->span != 0 ? a->span : type_size; - - for (index_type n = 0; n < dim; n++) - { - index_type stride_n; - count[n] = 0; - stride_n = GFC_DESCRIPTOR_STRIDE (a, n); - stride[n] = stride_n * type_size; - extent[n] = GFC_DESCRIPTOR_EXTENT (a, n); - if (extent[n] <= 0) - { - packed = true; - num_elems = 0; - break; - } - if (num_elems != stride_n) - packed = false; - - num_elems *= extent[n]; - } - ssize = num_elems * type_size; - prepare_collective_subroutine (ssize); /* Broadcaset barrier 2. */ - other_shared_ptr = get_obj_ptr (source_image - 1); - if (packed) - memcpy (a->base_addr, other_shared_ptr, ssize); - else - { - char *src = other_shared_ptr; - char * restrict dest = (char *) a->base_addr; - index_type stride0 = stride[0]; - - for (index_type n = 0; n < dim; n++) - count[n] = 0; - - while (dest) - { - memcpy (dest, src, type_size); - src += span; - dest += stride0; - count[0] ++; - for (index_type n = 0; count[n] == extent[n] ;) - { - /* When we get to the end of a dimension, reset it and increment - the next dimension. */ - count[n] = 0; - dest -= stride[n] * extent[n]; - n++; - if (n == dim) - { - dest = NULL; - break; - } - else - { - count[n]++; - dest += stride[n]; - } - } - } - } - } - finish_collective_subroutine (ci); /* Broadcast barrier 3. */ -} - -#endif diff --git a/libgfortran/nca/collective_subroutine.h b/libgfortran/nca/collective_subroutine.h index 6147dd6d793..27931166ecf 100644 --- a/libgfortran/nca/collective_subroutine.h +++ b/libgfortran/nca/collective_subroutine.h @@ -41,4 +41,15 @@ internal_proto (collsub_iface_init); void * get_collsub_buf (collsub_iface *ci, size_t size); internal_proto (get_collsub_buf); + + +/* Needed to prevent one image starting the next collective subroutine before + * everyone has finished the current one. At the moment, this is just an alias + * for collsub_sync, but there might be more work to do later. */ + +static inline void +finish_collective_subroutine(collsub_iface *ci) { + collsub_sync(ci); +} + #endif diff --git a/libgfortran/nca/hashmap.c b/libgfortran/nca/hashmap.c index 61f5487e63e..865ec6a1488 100644 --- a/libgfortran/nca/hashmap.c +++ b/libgfortran/nca/hashmap.c @@ -43,7 +43,7 @@ typedef struct { static ssize_t num_entries (hashmap_entry *data, size_t size) { - ssize_t i; + size_t i; ssize_t ret = 0; for (i = 0; i < size; i++) { @@ -88,13 +88,16 @@ hash (uint64_t key) return key; } + /* Gets a pointer to the current data in the hashmap. */ + static inline hashmap_entry * get_data(hashmap *hm) { return SHMPTR_AS (hashmap_entry *, hm->s->data, hm->sm); } + /* Generate mask from current number of bits. */ static inline intptr_t @@ -103,6 +106,7 @@ gen_mask (hashmap *hm) return (1 << hm->s->bitnum) - 1; } + /* Add with wrap-around at hashmap size. */ static inline size_t @@ -110,6 +114,7 @@ hmiadd (hashmap *hm, size_t s, ssize_t o) { return (s + o) & gen_mask (hm); } + /* Get the expected offset for entry id. */ static inline ssize_t @@ -118,6 +123,7 @@ get_expected_offset (hashmap *hm, memid id) return hash(id) >> (PTR_BITS - hm->s->bitnum); } + /* Initialize the hashmap. */ void @@ -139,6 +145,7 @@ hashmap_init (hashmap *hm, hashmap_shared *hs, allocator *a, hm->a = a; } + /* This checks if the entry id exists in that range the range between the expected position and the maximum lookahead. */ @@ -160,11 +167,12 @@ scan_inside_lookahead (hashmap *hm, ssize_t expected_off, memid id) return -1; } + /* Scan for the next empty slot we can use. Returns offset relative to the expected position. */ static ssize_t -scan_empty (hashmap *hm, ssize_t expected_off, memid id) +scan_empty (hashmap *hm, ssize_t expected_off) { hashmap_entry *data; @@ -176,6 +184,7 @@ scan_empty (hashmap *hm, ssize_t expected_off, memid id) return -1; } + /* Search the hashmap for id. */ hashmap_search_result @@ -199,13 +208,16 @@ hashmap_get (hashmap *hm, memid id) return ret; } + /* Return size of a hashmap search result. */ + size_t hm_search_result_size (hashmap_search_result *res) { return res->size; } + /* Return pointer of a hashmap search result. */ shared_mem_ptr @@ -214,6 +226,7 @@ hm_search_result_ptr (hashmap_search_result *res) return res->p; } + /* Return pointer of a hashmap search result. */ bool @@ -222,6 +235,7 @@ hm_search_result_contains (hashmap_search_result *res) return !SHMPTR_IS_NULL(res->p); } + /* Enlarge hashmap memory. */ static void @@ -234,7 +248,6 @@ enlarge_hashmap_mem (hashmap *hm, hashmap_entry **data, bool f) old_size = hm->s->size; hm->s->data = shared_malloc (hm->a, (hm->s->size *= 2)*sizeof(hashmap_entry)); - fprintf (stderr,"enlarge_hashmap_mem: %ld\n", hm->s->data.offset); hm->s->bitnum++; *data = get_data(hm); @@ -246,6 +259,7 @@ enlarge_hashmap_mem (hashmap *hm, hashmap_entry **data, bool f) shared_free(hm->a, old_data_p, old_size); } + /* Resize hashmap. */ static void @@ -257,7 +271,6 @@ resize_hm (hashmap *hm, hashmap_entry **data) ssize_t new_offset, inital_index, new_index; memid id; ssize_t max_lookahead; - ssize_t old_count, new_count; /* old_data points to the old block containing the hashmap. We redistribute the data from there into the new block. */ @@ -265,14 +278,8 @@ resize_hm (hashmap *hm, hashmap_entry **data) old_data_p = hm->s->data; old_data = *data; old_size = hm->s->size; - old_count = num_entries (old_data, old_size); - fprintf(stderr, "Occupancy at resize: %f\n", ((double) old_count)/old_size); - - //fprintf (stderr,"\n====== Resizing hashmap =========\n\nOld map:\n\n"); - //dump_hm (hm); enlarge_hashmap_mem (hm, &new_data, false); - //fprintf (stderr,"old_data: %p new_data: %p\n", old_data, new_data); retry_resize: for (size_t i = 0; i < old_size; i++) { @@ -281,15 +288,13 @@ resize_hm (hashmap *hm, hashmap_entry **data) id = old_data[i].id; inital_index = get_expected_offset (hm, id); - new_offset = scan_empty (hm, inital_index, id); + new_offset = scan_empty (hm, inital_index); /* If we didn't find a free slot, just resize the hashmap again. */ if (new_offset == -1) { enlarge_hashmap_mem (hm, &new_data, true); - //fprintf (stderr,"\n====== AGAIN Resizing hashmap =========\n\n"); - //fprintf (stderr,"old_data: %p new_data %p\n", old_data, new_data); goto retry_resize; /* Sue me. */ } @@ -304,15 +309,11 @@ resize_hm (hashmap *hm, hashmap_entry **data) .max_lookahead = new_data[new_index].max_lookahead, .refcnt = old_data[i].refcnt}); } - new_count = num_entries (new_data, hm->s->size); - //fprintf (stderr,"Number of elements: %ld to %ld\n", old_count, new_count); - //fprintf (stderr,"============ After resizing: =======\n\n"); - //dump_hm (hm); - shared_free (hm->a, old_data_p, old_size); *data = new_data; } + /* Set an entry in the hashmap. */ void @@ -324,7 +325,6 @@ hashmap_set (hashmap *hm, memid id, hashmap_search_result *hsr, ssize_t empty_offset; ssize_t delta; - // //fprintf (stderr,"hashmap_set: id = %-16p\n", (void *) id); data = get_data(hm); if (hsr) { @@ -334,7 +334,7 @@ hashmap_set (hashmap *hm, memid id, hashmap_search_result *hsr, } expected_offset = get_expected_offset (hm, id); - while ((delta = scan_empty (hm, expected_offset, id)) == -1) + while ((delta = scan_empty (hm, expected_offset)) == -1) { resize_hm (hm, &data); expected_offset = get_expected_offset (hm, id); @@ -348,10 +348,6 @@ hashmap_set (hashmap *hm, memid id, hashmap_search_result *hsr, .refcnt = 1}); n_ent ++; - fprintf (stderr,"hashmap_set: Setting %p at %p, n_ent = %ld\n", (void *) id, data + empty_offset, - n_ent); - // dump_hm (hm); - // fprintf(stderr, "--------------------------------------------------\n"); /* TODO: Shouldn't reset refcnt, but this doesn't matter at the moment because of the way the function is used. */ } @@ -382,9 +378,7 @@ hashmap_change_refcnt (hashmap *hm, memid id, hashmap_search_result *res, ret = (entry->refcnt += delta); if (ret == 0) { - n_ent --; - //fprintf (stderr, "hashmap_change_refcnt: removing %p at %p, n_ent = %ld\n", - // (void *) id, entry, n_ent); + n_ent--; entry->id = 0; entry->p = SHMPTR_NULL; entry->s = 0; @@ -393,6 +387,7 @@ hashmap_change_refcnt (hashmap *hm, memid id, hashmap_search_result *res, return ret; } + /* Increase hashmap entry refcount. */ void @@ -403,6 +398,7 @@ hashmap_inc (hashmap *hm, memid id, hashmap_search_result * res) ASSERT_HM (hm, ret > 0); } + /* Decrease hashmap entry refcount. */ int diff --git a/libgfortran/nca/hashmap.h b/libgfortran/nca/hashmap.h index 4d999e3e3d3..29490951575 100644 --- a/libgfortran/nca/hashmap.h +++ b/libgfortran/nca/hashmap.h @@ -1,3 +1,27 @@ +/* Copyright (C) 2020 Free Software Foundation, Inc. + Contributed by Nicolas Koenig + +This file is part of the GNU Fortran Native Coarray Library (libnca). + +Libnca is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +Libnca is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + #ifndef HASHMAP_H #include "shared_memory.h" diff --git a/libgfortran/nca/libcoarraynative.h b/libgfortran/nca/libcoarraynative.h index 507de0cde8e..85746f3189c 100644 --- a/libgfortran/nca/libcoarraynative.h +++ b/libgfortran/nca/libcoarraynative.h @@ -22,10 +22,6 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef LIBGFOR_H -#error "Include libgfortran.h before libcoarraynative.h" -#endif - #ifndef COARRAY_NATIVE_HDR #define COARRAY_NATIVE_HDR @@ -35,16 +31,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <stdint.h> #include <stdio.h> +#define DEBUG_NATIVE_COARRAY 0 -/* This is to create a _nca_gfortrani_ prefix for all variables and - function used only by nca. */ -#if 0 -#define NUM_ADDR_BITS (8 * sizeof (int *)) -#endif - -#define DEBUG_NATIVE_COARRAY 1 - -#ifdef DEBUG_NATIVE_COARRAY +#if defined(DEBUG_NATIVE_COARRAY) && DEBUG_NATIVE_COARRAY #define DEBUG_PRINTF(...) dprintf (2,__VA_ARGS__) #else #define DEBUG_PRINTF(...) do {} while(0) @@ -64,7 +53,8 @@ typedef struct { typedef enum { IMAGE_UNKNOWN = 0, IMAGE_OK, - IMAGE_FAILED + IMAGE_FAILED, + IMAGE_SUCCESS } image_status; typedef struct { @@ -74,6 +64,7 @@ typedef struct { typedef struct { int has_failed_image; + int finished_images; image_tracker images[]; } master; @@ -97,7 +88,7 @@ internal_proto (local); void ensure_initialization(void); internal_proto(ensure_initialization); -void nca_master(void (*)(void)); -export_proto (nca_master); +void cas_master(void (*)(void)); +export_proto (cas_master); #endif diff --git a/libgfortran/nca/shared_memory.c b/libgfortran/nca/shared_memory.c index bc3093d0ef2..7d68126f40f 100644 --- a/libgfortran/nca/shared_memory.c +++ b/libgfortran/nca/shared_memory.c @@ -141,7 +141,6 @@ shared_memory_get_mem_with_alignment (shared_memory_act **pmem, size_t size, memset(last_base(mem) + used_wa, 0x42, size); mem->meta->used = used_wa + size; - DEBUG_PRINTF ("Shared Memory: New memory of size %#lx requested, returned %#lx\n", size, used_wa); return (shared_mem_ptr) {.offset = used_wa}; } @@ -165,7 +164,6 @@ shared_memory_get_mem_with_alignment (shared_memory_act **pmem, size_t size, *pmem = mem; assert(used_wa != 0); - dprintf(2, "Shared Memory: New memory of size %#lx requested, returned %#lx\n", size, used_wa); memset(last_base(mem) + orig_used, 0xCA, used_wa - orig_used); memset(last_base(mem) + used_wa, 0x42, size); diff --git a/libgfortran/nca/shared_memory.h b/libgfortran/nca/shared_memory.h index 4adc104801d..59123688de5 100644 --- a/libgfortran/nca/shared_memory.h +++ b/libgfortran/nca/shared_memory.h @@ -23,6 +23,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SHARED_MEMORY_H +#define SHARED_MEMORY_H + #include <stdbool.h> #include <stdint.h> #include <stddef.h> @@ -74,5 +76,4 @@ internal_proto (shared_memory_get_mem_with_alignment); void *shared_mem_ptr_to_void_ptr (shared_memory *, shared_mem_ptr); internal_proto (shared_mem_ptr_to_void_ptr); -#define SHARED_MEMORY_H #endif diff --git a/libgfortran/nca/sync.c b/libgfortran/nca/sync.c index 6d7f7caee47..cd30f2f863b 100644 --- a/libgfortran/nca/sync.c +++ b/libgfortran/nca/sync.c @@ -59,35 +59,9 @@ wait_table_cond (sync_iface *si, pthread_cond_t *cond) } static int * -get_locked_table(sync_iface *si) { // The initialization of the table has to - // be delayed, since we might not know the - // number of images when the library is - // initialized +get_locked_table(sync_iface *si) { lock_table(si); return si->table; - /* - if (si->table) - return si->table; - else if (!SHMPTR_IS_NULL(si->cis->table)) - { - si->table = SHMPTR_AS(int *, si->cis->table, si->sm); - si->triggers = SHMPTR_AS(pthread_cond_t *, si->cis->triggers, si->sm); - return si->table; - } - - si->cis->table = - shared_malloc(si->a, sizeof(int)*local->num_images * local->num_images); - si->cis->triggers = - shared_malloc(si->a, sizeof(int)*local->num_images); - - si->table = SHMPTR_AS(int *, si->cis->table, si->sm); - si->triggers = SHMPTR_AS(pthread_cond_t *, si->cis->triggers, si->sm); - - for (int i = 0; i < local->num_images; i++) - initialize_shared_condition (&si->triggers[i]); - - return si->table; - */ } void @@ -97,7 +71,6 @@ sync_iface_init (sync_iface *si, alloc_iface *ai, shared_memory *sm) shared_malloc (get_allocator(ai), sizeof(collsub_iface_shared)), sm); - DEBUG_PRINTF ("%s: num_images is %d\n", __PRETTY_FUNCTION__, local->num_images); sync_all_init (&si->cis->sync_all); initialize_shared_mutex (&si->cis->table_lock); @@ -119,9 +92,9 @@ sync_iface_init (sync_iface *si, alloc_iface *ai, shared_memory *sm) void sync_table (sync_iface *si, int *images, size_t size) { -#ifdef DEBUG_NATIVE_COARRAY +#if defined(DEBUG_NATIVE_COARRAY) && DEBUG_NATIVE_COARRAY dprintf (2, "Image %d waiting for these %ld images: ", this_image.image_num + 1, size); - for (int d_i = 0; d_i < size; d_i++) + for (int d_i = 0; (size_t) d_i < size; d_i++) dprintf (2, "%d ", images[d_i]); dprintf (2, "\n"); #endif @@ -150,7 +123,5 @@ void sync_all (sync_iface *si) { - DEBUG_PRINTF("Syncing all\n"); - pthread_barrier_wait (&si->cis->sync_all); } diff --git a/libgfortran/nca/sync.h b/libgfortran/nca/sync.h index 4b494416d6a..6eec14e3864 100644 --- a/libgfortran/nca/sync.h +++ b/libgfortran/nca/sync.h @@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "shared_memory.h" #include "alloc.h" -#include<pthread.h> +#include <pthread.h> typedef struct { pthread_barrier_t sync_all; diff --git a/libgfortran/nca/util.c b/libgfortran/nca/util.c index 5805218f18c..758e87f7313 100644 --- a/libgfortran/nca/util.c +++ b/libgfortran/nca/util.c @@ -9,7 +9,11 @@ #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> +#include <assert.h> +/* Shared Memory objects live in their own namspace (usually found under + * /dev/shm/), so the "/" is needed. It is for some reason impossible to create + * a shared memory object without name. */ #define MEMOBJ_NAME "/gfortran_coarray_memfd" size_t @@ -26,7 +30,8 @@ round_to_pagesize(size_t s) { size_t next_power_of_two(size_t size) { - return 1 << (PTR_BITS - __builtin_clzl(size-1)); //FIXME: There's an off-by-one error, I can feel it + assert(size); + return 1 << (PTR_BITS - __builtin_clzl(size-1)); } void @@ -120,7 +125,7 @@ pack_array_finish (pack_info * const restrict pi, const gfc_array_char * const r stride0 = pi->stride[0]; size = GFC_DESCRIPTOR_SIZE (source); - memset (count, 0, sizeof(count)); + memset (count, '\0', sizeof (count) * dim); while (src) { /* Copy the data. */ @@ -170,6 +175,8 @@ unpack_array_finish (pack_info * const restrict pi, dest = d->base_addr; dim = GFC_DESCRIPTOR_RANK (d); + + memset(count, '\0', sizeof(count) * dim); while (dest) { memcpy (dest, src, size); diff --git a/libgfortran/nca/wrapper.c b/libgfortran/nca/wrapper.c index eeb64d3aac9..b31e750ead3 100644 --- a/libgfortran/nca/wrapper.c +++ b/libgfortran/nca/wrapper.c @@ -36,55 +36,58 @@ div_ru (int divident, int divisor) return (divident + divisor - 1)/divisor; } +/* Need to keep this in sync with + trans-array.h:gfc_coarray_allocation_type. */ + enum gfc_coarray_allocation_type { - GFC_NCA_NORMAL_COARRAY = 3, + GFC_NCA_NORMAL_COARRAY = 1, GFC_NCA_LOCK_COARRAY, GFC_NCA_EVENT_COARRAY, }; -void nca_coarray_alloc (gfc_array_void *, int, int, int); -export_proto (nca_coarray_alloc); +void cas_coarray_alloc (gfc_array_void *, int, int, int); +export_proto (cas_coarray_alloc); void -nca_coarray_free (gfc_array_void *, int); -export_proto (nca_coarray_free); +cas_coarray_free (gfc_array_void *, int); +export_proto (cas_coarray_free); -int nca_coarray_this_image (int); -export_proto (nca_coarray_this_image); +int cas_coarray_this_image (int); +export_proto (cas_coarray_this_image); -int nca_coarray_num_images (int); -export_proto (nca_coarray_num_images); +int cas_coarray_num_images (int); +export_proto (cas_coarray_num_images); -void nca_coarray_sync_all (int *); -export_proto (nca_coarray_sync_all); +void cas_coarray_sync_all (int *); +export_proto (cas_coarray_sync_all); -void nca_sync_images (size_t, int *, int*, char *, size_t); -export_proto (nca_sync_images); +void cas_sync_images (size_t, int *, int*, char *, size_t); +export_proto (cas_sync_images); -void nca_lock (void *); -export_proto (nca_lock); +void cas_lock (void *); +export_proto (cas_lock); -void nca_unlock (void *); -export_proto (nca_unlock); +void cas_unlock (void *); +export_proto (cas_unlock); -void nca_collsub_reduce_array (gfc_array_char *, void (*) (void *, void *), +void cas_collsub_reduce_array (gfc_array_char *, void (*) (void *, void *), int *); -export_proto (nca_collsub_reduce_array); +export_proto (cas_collsub_reduce_array); -void nca_collsub_reduce_scalar (void *, index_type, void (*) (void *, void *), +void cas_collsub_reduce_scalar (void *, index_type, void (*) (void *, void *), int *); -export_proto (nca_collsub_reduce_scalar); +export_proto (cas_collsub_reduce_scalar); -void nca_collsub_broadcast_array (gfc_array_char * restrict, int/*, int *, char *, +void cas_collsub_broadcast_array (gfc_array_char * restrict, int/*, int *, char *, size_t*/); -export_proto (nca_collsub_broadcast_array); +export_proto (cas_collsub_broadcast_array); -void nca_collsub_broadcast_scalar (void * restrict, size_t, int/*, int *, char *, +void cas_collsub_broadcast_scalar (void * restrict, size_t, int/*, int *, char *, size_t*/); -export_proto(nca_collsub_broadcast_scalar); +export_proto(cas_collsub_broadcast_scalar); void -nca_coarray_alloc (gfc_array_void *desc, int elem_size, int corank, +cas_coarray_alloc (gfc_array_void *desc, int elem_size, int corank, int alloc_type) { int i, last_rank_index; @@ -153,11 +156,10 @@ nca_coarray_alloc (gfc_array_void *desc, int elem_size, int corank, else desc->base_addr = get_memory_by_id (&local->ai, size_in_bytes, (intptr_t) desc); - dprintf(2, "Base address of desc for image %d: %p\n", this_image.image_num + 1, desc->base_addr); } void -nca_coarray_free (gfc_array_void *desc, int alloc_type) +cas_coarray_free (gfc_array_void *desc, int alloc_type) { int i; if (alloc_type == GFC_NCA_LOCK_COARRAY) @@ -186,25 +188,25 @@ nca_coarray_free (gfc_array_void *desc, int alloc_type) } int -nca_coarray_this_image (int distance __attribute__((unused))) +cas_coarray_this_image (int distance __attribute__((unused))) { return this_image.image_num + 1; } int -nca_coarray_num_images (int distance __attribute__((unused))) +cas_coarray_num_images (int distance __attribute__((unused))) { return local->num_images; } void -nca_coarray_sync_all (int *stat __attribute__((unused))) +cas_coarray_sync_all (int *stat __attribute__((unused))) { sync_all (&local->si); } void -nca_sync_images (size_t s, int *images, +cas_sync_images (size_t s, int *images, int *stat __attribute__((unused)), char *error __attribute__((unused)), size_t err_size __attribute__((unused))) @@ -213,26 +215,26 @@ nca_sync_images (size_t s, int *images, } void -nca_lock (void *lock) +cas_lock (void *lock) { pthread_mutex_lock (lock); } void -nca_unlock (void *lock) +cas_unlock (void *lock) { pthread_mutex_unlock (lock); } void -nca_collsub_reduce_array (gfc_array_char *desc, void (*assign_function) (void *, void *), +cas_collsub_reduce_array (gfc_array_char *desc, void (*assign_function) (void *, void *), int *result_image) { collsub_reduce_array (&local->ci, desc, result_image, assign_function); } void -nca_collsub_reduce_scalar (void *obj, index_type elem_size, +cas_collsub_reduce_scalar (void *obj, index_type elem_size, void (*assign_function) (void *, void *), int *result_image) { @@ -240,7 +242,7 @@ nca_collsub_reduce_scalar (void *obj, index_type elem_size, } void -nca_collsub_broadcast_array (gfc_array_char * restrict a, int source_image +cas_collsub_broadcast_array (gfc_array_char * restrict a, int source_image /* , int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), size_t errmsg_len __attribute__ ((unused))*/) @@ -249,7 +251,7 @@ nca_collsub_broadcast_array (gfc_array_char * restrict a, int source_image } void -nca_collsub_broadcast_scalar (void * restrict obj, size_t size, int source_image/*, +cas_collsub_broadcast_scalar (void * restrict obj, size_t size, int source_image/*, int *stat __attribute__((unused)), char *errmsg __attribute__ ((unused)), size_t errmsg_len __attribute__ ((unused))*/) |