aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/caf/mpi.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-19libcaf.h: Add caf_reference_type.Andre Vehreschild1-1/+2
libgfortran/ChangeLog: 2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org> * caf/libcaf.h: Add caf_reference_type. * caf/mpi.c: Adapted signature of caf_register(). * caf/single.c (struct caf_single_token): Added to keep the pointer to the memory registered and array descriptor. (caf_internal_error): Added convenience interface. (_gfortran_caf_register): Adapted to work with caf_single_token and return memory in the array descriptor. (_gfortran_caf_deregister): Same. (assign_char1_from_char4): Fixed style. (convert_type): Fixed incorrect conversion. (_gfortran_caf_get): Adapted to work with caf_single_token. (_gfortran_caf_send): Same. (_gfortran_caf_sendget): Same. (copy_data): Added to stop repeating it in all _by_ref functions. (get_for_ref): Recursive getting of coarray data using a chain of references. (_gfortran_caf_get_by_ref): Driver for computing the memory needed for the get and checking properties of the operation. (send_by_ref): Same as get_for_ref but for sending data. (_gfortran_caf_send_by_ref): Same like caf_get_by_ref but for sending. (_gfortran_caf_sendget_by_ref): Uses get_by_ref and send_by_ref to implement sendget for reference chains. (_gfortran_caf_atomic_define): Adapted to work with caf_single_token. (_gfortran_caf_atomic_ref): Likewise. (_gfortran_caf_atomic_cas): Likewise. (_gfortran_caf_atomic_op): Likewise. (_gfortran_caf_event_post): Likewise. (_gfortran_caf_event_wait): Likewise. (_gfortran_caf_event_query): Likewise. (_gfortran_caf_lock): Likewise. (_gfortran_caf_unlock): Likewise. gcc/testsuite/ChangeLog: 2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray/alloc_comp_4.f90: New test. * gfortran.dg/coarray_38.f90: * gfortran.dg/coarray_alloc_comp_1.f08: New test. * gfortran.dg/coarray_alloc_comp_2.f08: New test. * gfortran.dg/coarray_allocate_7.f08: New test. * gfortran.dg/coarray_allocate_8.f08: New test. * gfortran.dg/coarray_allocate_9.f08: New test. * gfortran.dg/coarray_lib_alloc_1.f90: Adapted scan-tree-dumps to expect new caf_register. * gfortran.dg/coarray_lib_alloc_2.f90: Same. * gfortran.dg/coarray_lib_alloc_3.f90: Same. * gfortran.dg/coarray_lib_comm_1.f90: Adapted scan-tree-dumps to expect get_by_refs. * gfortran.dg/coarray_lib_token_3.f90: Same as for coarray_lib_alloc2. * gfortran.dg/coarray_lock_7.f90: Same. * gfortran.dg/coarray_poly_5.f90: Same. * gfortran.dg/coarray_poly_6.f90: Same. * gfortran.dg/coarray_poly_7.f90: Same. * gfortran.dg/coarray_poly_8.f90: Same. * gfortran.dg/coindexed_1.f90: Changed errors expected. gcc/fortran/ChangeLog: 2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org> * expr.c (gfc_check_assign): Added flag to control whether datatype conversion is allowed. * gfortran.h: Added caf-token-tree to gfc_component. Changed prototypes mostly to add whether datatype conversion is allowed. * gfortran.texi: Added documentation for the caf_reference_t and the caf_*_by_ref function. * primary.c (caf_variable_attr): Similar to gfc_variable_attr but focused on the needs of coarrays. (gfc_caf_attr): Same. * resolve.c (resolve_ordinary_assign): Set the conversion allowed flag when not in a coarray. * trans-array.c (gfc_array_init_size): Moved setting of array descriptor's datatype before the alloc, because caf_register needs it. (gfc_array_allocate): Changed notion of whether an array is a coarray. (gfc_array_deallocate): Same. (gfc_alloc_allocatable_for_assignment): Added setting of coarray's array descriptor datatype before the register. And using deregister/ register to mimmick a realloc for coarrays. * trans-decl.c (gfc_build_builtin_function_decls): Corrected signatures of old caf-functions and added signature definitions of the _by_ref ones. (generate_coarray_sym_init): Adapted to new caf_register signature. * trans-expr.c (gfc_conv_scalar_to_descriptor): Make sure a constant is translated to an lvalue expression before use in an array descriptor. (gfc_get_ultimate_alloc_ptr_comps_caf_token): New function. Get the last allocatable component's coarray token. (gfc_get_tree_for_caf_expr): For top-level object get the coarray token and check for unsupported features. (gfc_get_caf_token_offset): Getting the offset might procude new statements, which now are stored in the pre and post of the current se. (gfc_caf_get_image_index): For this image return a call to caf_this_image. (expr_may_alias_variables): Check that the result is set for testing its properties. (alloc_scalar_allocatable_for_assignment): Added auto allocation of coarray components. (gfc_trans_assignment_1): Rewrite an assign to a coarray object to be a sendget. * trans-intrinsic.c (conv_caf_vector_subscript_elem): Corrected wrong comment. (compute_component_offset): Compute the correct offset a structure member. (conv_expr_ref_to_caf_ref): Convert to a chain of refs into caf_references. (gfc_conv_intrinsic_caf_get): Call caf_get_by_ref instead of caf_get. (conv_caf_send): Call caf_*_by_ref for coarrays that need reallocation. (gfc_conv_intrinsic_function): Adapted to new signuature of the caf drivers. (conv_intrinsic_atomic_op): Add pre and post statements correctly. (conv_intrinsic_atomic_ref): Same. (conv_intrinsic_atomic_cas): Same. (conv_intrinsic_event_query): Same. * trans-stmt.c (gfc_trans_lock_unlock): Same. (gfc_trans_event_post_wait): Same. (gfc_trans_allocate): Support allocation of allocatable coarrays. (gfc_trans_deallocate): And there deallocation. * trans-types.c (gfc_typenode_for_spec): Added flag to control whether a component is part of coarray. When so, then add space to store a coarray token. (gfc_build_array_type): Same. (gfc_get_array_descriptor_base): Same. (gfc_get_array_type_bounds): Same. (gfc_sym_type): Same. (gfc_get_derived_type): Same. (gfc_get_caf_reference_type): Declare the caf_reference_type. * trans-types.h: Prototype changes only. * trans.c (gfc_allocate_using_lib): Use the updated caf_register signature. (gfc_allocate_allocatable): Same. (gfc_deallocate_with_status): Same. * trans.h: Defined the runtime types for caf_reference_t and the enums. From-SVN: r240231
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-05-11trans-intrinsic.c (gfc_build_builtin_function_decls): Change type of second ↵Tobias Burnus1-1/+1
argument to int. 2014-05-11 Tobias Burnus <burnus@net-b.de> * trans-intrinsic.c (gfc_build_builtin_function_decls): Change type of second argument to int. 2014-05-11 Tobias Burnus <burnus@net-b.de> * caf/libcaf.h (_gfortran_caf_num_images): Change type of second argument to int. * caf/mpi.c (_gfortran_caf_num_images): Ditto. * caf/single.c (_gfortran_caf_num_images): Ditto. From-SVN: r210311
2014-04-30gfortran.h (gfc_init_coarray_decl): Remove.Tobias Burnus1-14/+26
2014-04-30 Tobias Burnus <burnus@net-b.de> * gfortran.h (gfc_init_coarray_decl): Remove. * parse.c (translate_all_program_units): Remove call to it. (gfc_parse_file): Update call. * trans.h (gfor_fndecl_caf_this_image, gfor_fndecl_caf_num_images): Add. (gfort_gvar_caf_num_images, gfort_gvar_caf_this_image): Remove. * trans-decl.c (gfor_fndecl_caf_this_image, gfor_fndecl_caf_num_images): Add. (gfort_gvar_caf_num_images, gfort_gvar_caf_this_image): Remove. (gfc_build_builtin_function_decls): Init new decl. (gfc_init_coarray_dec): Remove. (create_main_function): Change calls. * trans-intrinsic.c (trans_this_image, trans_image_index, conv_intrinsic_cobound): Generate call to new library function instead of to a static variable. * trans-stmt.c (gfc_trans_sync): Ditto. 2014-04-30 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray_lib_this_image_1.f90: New. * gfortran.dg/coarray_lib_this_image_2.f90: New. 2014-04-30 Tobias Burnus <burnus@net-b.de> * caf/libcaf.h (_gfortran_caf_this_image, * _gfortran_caf_num_images): New prototypes. (_gfortran_caf_init): Change prototype. (mpi_token_t): New typedef. (TOKEN): New define. * caf/mpi.c (_gfortran_caf_this_image, * _gfortran_caf_num_images): New functions. (_gfortran_caf_init): Update. (_gfortran_caf_finalize, _gfortran_caf_register, _gfortran_caf_deregister): Use mpi_token_t. * caf/single.c (_gfortran_caf_this_image, * _gfortran_caf_num_images): New functions. (_gfortran_caf_init): Update. (_gfortran_caf_finalize, _gfortran_caf_register, _gfortran_caf_deregister): Use mpi_token_t, simplify. From-SVN: r209951
2014-01-02Update copyright years in libgfortran/Richard Sandiford1-1/+1
From-SVN: r206296
2013-01-14Update copyright years in libgfortran.Richard Sandiford1-2/+1
From-SVN: r195167
2012-01-062012-01-06 Tobias Burnus <burnus@net-b.de>Tobias Burnus1-10/+11
* trans-openmp.c (gfc_omp_clause_dtor, * gfc_trans_omp_array_reduction): Update call to gfc_trans_dealloc_allocated. * trans.c (gfc_allocate_using_malloc): Fix spacing. (gfc_allocate_allocatable): For gfc_allocate_using_lib, jump to label_finish when an error occurs. (gfc_deallocate_with_status): Call caf_deregister for -fcoarray=lib. * trans.h (gfc_allocate_allocatable, * gfc_deallocate_with_status): Update prototype. (gfor_fndecl_caf_deregister): New tree symbol. * trans-expr.c (gfc_conv_procedure_call): Update gfc_deallocate_with_status and gfc_trans_dealloc_allocated calls. * trans-array.c (gfc_array_allocate, * gfc_trans_dealloc_allocated, structure_alloc_comps, gfc_trans_deferred_array): Ditto. (gfc_array_deallocate): Handle coarrays with -fcoarray=lib. * trans-array.h (gfc_array_deallocate, gfc_array_allocate, gfc_trans_dealloc_allocated): Update prototypes. * trans-stmt.c (gfc_trans_sync): Fix indentation. (gfc_trans_allocate): Fix errmsg padding and label handling. (gfc_trans_deallocate): Ditto and handle -fcoarray=lib. * expr.c (gfc_is_coarray): Fix algorithm for BT_CLASS. * libgfortran.h (GFC_STAT_STOPPED_IMAGE): Use large value to avoid other stats accidentally matching this one. * trans-decl.c (gfor_fndecl_caf_deregister): New global var. (gfc_build_builtin_function_decls): Fix prototype decl of caf_register and add decl for caf_deregister. (gfc_trans_deferred_vars): Handle CAF vars with -fcoarrays=lib. * trans-intrinsic.c (conv_intrinsic_move_alloc): Update call to gfc_deallocate_with_status. 2012-01-06 Tobias Burnus <burnus@net-b.de> * caf/single.c (_gfortran_caf_register, * _gfortran_caf_deregister): Fix token handling. * caf/mpi.c (_gfortran_caf_register, _gfortran_caf_deregister): * Ditto. * caf/libcaf.h (STAT_STOPPED_IMAGE): Sync with libgfortran.h. (_gfortran_caf_register, _gfortran_caf_deregister): Update prototype. 2012-01-06 Tobias Burnus <burnus@net-b.de> * gfortran.dg/deallocate_stat_2.f90: New. * coarray/allocate_errgmsg.f90: New. * gfortran.dg/coarray_lib_alloc_1.f90: New. * gfortran.dg/coarray_lib_alloc_2.f90: New. * coarray/subobject_1.f90: Fix for num_images > 1. * gfortran.dg/deallocate_stat.f90: Update due to changed stat= handling. From-SVN: r182951
2011-08-29trans-decl.c (generate_coarray_sym_init): Use GFC_CAF_COARRAY_STATIC for ↵Tobias Burnus1-6/+37
static coarrays. gcc/fortran/ 2011-08-29 Tobias Burnus <burnus@net-b.de> * trans-decl.c (generate_coarray_sym_init): Use GFC_CAF_COARRAY_STATIC for static coarrays. libgfortan/ 2011-08-29 Tobias Burnus <burnus@net-b.de> * caf/libcaf.h (_gfortran_caf_deregister): Update prototype. * caf/mpi.c (_gfortran_caf_deregister): Modify prototype, actually free memory and add error diagnostic. (_gfortran_caf_finalize): Add additional free calls. * caf/single.c (_gfortran_caf_deregister): Modify prototype, actually free memory and add error diagnostic. (_gfortran_caf_finalize): Add additional free calls. From-SVN: r178193
2011-07-15mpi.c (caf_runtime_error): Change fprintf to vfprintf.Daniel Carrera1-1/+1
2011-07-15 Daniel Carrera <dcarrera@gmail.com> * caf/mpi.c (caf_runtime_error): Change fprintf to vfprintf. * caf/single.c (caf_runtime_error): Ditto. From-SVN: r176340
2011-07-14Remove error parameter from caf_runtime_error. Add caf_runtime_error to ↵Daniel Carrera1-6/+7
single.c. From-SVN: r176278
2011-07-09mpi.c (runtime_error): New function.Tobias Burnus1-46/+74
2011-07-09 Tobias Burnus <burnus@net-b.de> Daniel Carrera <dcarrera@gmail.com> * caf/mpi.c (runtime_error): New function. (_gfortran_caf_register): Use it. (_gfortran_caf_sync_all): Use it, add STAT_STOPPED_IMAGE as possible status value. (_gfortran_caf_sync_images): Ditto. Co-Authored-By: Daniel Carrera <dcarrera@gmail.com> From-SVN: r176080
2011-07-07trans.c (gfc_allocate_with_status): Call _gfortran_caf_register with NULL ↵Tobias Burnus1-4/+54
arguments for (new) stat=/errmsg= arguments. 2011-07-07 Tobias Burnus <burnus@net-b.de> * trans.c (gfc_allocate_with_status): Call _gfortran_caf_register with NULL arguments for (new) stat=/errmsg= arguments. 2011-07-07 Tobias Burnus <burnus@net-b.de> * libcaf.h (__attribute__, unlikely, likely): New macros. (caf_register_t): Update comment. (_gfortran_caf_register): Add stat, errmsg, errmsg_len arguments. * single.c (_gfortran_caf_register): Ditto; add error diagnostics. * mpi.c (_gfortran_caf_register): Ditto. (caf_is_finalized): New global variable. (_gfortran_caf_finalize): Use it. From-SVN: r175966
2011-06-17single.c (_gfortran_caf_register): Store the address of all static coarrays ↵Daniel Carrera1-13/+47
in a linked list. 2011-06-17 Daniel Carrera <dcarrera@gmail.com> * caf/single.c (_gfortran_caf_register): Store the address of all static coarrays in a linked list. (_gfortran_caf_finalize): Free memory of staic coarrays. * caf/mpi.c (_gfortran_caf_register): Store the address of all static coarrays in a linked list. Initialize MPI if necessary. (_gfortran_caf_finalize): Free memory of staic coarrays. (_gfortran_caf_init): Check if MPI is already initialized before initializing again. * caf/libcaf.h: Add a type to caf_register_t to distinguish static coarrays and add the type caf_static_t to make the linked list of static coarrays. From-SVN: r175124
2011-06-10trans-decl.c (gfc_build_builtin_function_decls): Updated declaration of ↵Daniel Carrera1-30/+46
caf_sync_all and caf_sync_images. gcc/fortran/ 2011-06-10 Daniel Carrera <dcarrera@gmail.com> * trans-decl.c (gfc_build_builtin_function_decls): Updated declaration of caf_sync_all and caf_sync_images. * trans-stmt.c (gfc_trans_sync): Function can now handle a "stat" variable that has an integer type different from integer_type_node. libgfortran/ 2011-06-10 Daniel Carrera <dcarrera@gmail.com> * caf/mpi.c (_gfortran_caf_sync_all, _gfortran_caf_sync_images): Functions have void return type and move status into parameter list. * caf/single.c (_gfortran_caf_sync_all, _gfortran_caf_sync_images): Functions have void return type and move status into parameter list. * caf/libcaf.h (_gfortran_caf_sync_all, _gfortran_caf_sync_images): Functions have void return type and move status into parameter list. gcc/testsuite/ 2011-06-10 Daniel Carrera <dcarrera@gmail.com> * gfortran.dg/coarray/sync_1.f90: New test for "SYNC ALL", "SYNC MEMORY" and "SYNC IMAGES". From-SVN: r174896
2011-05-06re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-24/+20
2011-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * caf/libcaf.h: Cleanup headers. (_gfortran_caf_critical, _gfortran_caf_end_critical): Make stub. (caf_register_t): New enum. (_gfortran_caf_register, _gfortran_caf_deregister): New prototype. * caf/single.c (_gfortran_caf_critical, _gfortran_caf_end_critical): Remove. (_gfortran_caf_register, _gfortran_caf_deregister): New functions. * caf/mpi.c (_gfortran_caf_critical, _gfortran_caf_end_critical): Remove. (_gfortran_caf_register, _gfortran_caf_deregister): New functions. (caf_world_window): Remove global variable. (_gfortran_caf_init): Fix off-by-one error of this_image. From-SVN: r173505
2011-04-06re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-10/+9
2011-04-06 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * caf/mpi.c (_gfortran_caf_init, _gfortran_caf_finalize): Add global variable caf_mpi_initialized and use it for when finalizing. From-SVN: r172059
2011-03-27re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-0/+211
2011-03-27 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * caf/libcaf.h: New - coarray communication library. * caf/mpi.c: New. * caf/single.c: New. From-SVN: r171570