Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-26 Thread Alessandro Fanfarillo
Committed revision 257105.

Thanks.

On Wed, Jan 24, 2018 at 3:17 PM, Jakub Jelinek  wrote:
> On Wed, Jan 24, 2018 at 08:19:58PM +, Paul Richard Thomas wrote:
>> (Jakub, This is all hidden behind the -fcoarray option. To my mind
>> this is safe for release.)
>
> Ok from RM POV.
>
> Jakub



-- 

Alessandro Fanfarillo, Ph.D.
Postdoctoral Researcher
National Center for Atmospheric Research
Mesa Lab, Boulder, CO, USA
303-497-1229


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-24 Thread Jakub Jelinek
On Wed, Jan 24, 2018 at 08:19:58PM +, Paul Richard Thomas wrote:
> (Jakub, This is all hidden behind the -fcoarray option. To my mind
> this is safe for release.)

Ok from RM POV.

Jakub


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-24 Thread Damian Rouson

On January 24, 2018 at 1:29:12 PM, Steve Kargl 
(s...@troutmask.apl.washington.edu) wrote:


Yes, thanks, Paul. Unfortunately, I've run out of time.  
Damian, GCC is in stage 3, we need to wait for approval  
from the release manager (aka Jakub) before committing  
the patch.  


Will do.  

Damian

Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-24 Thread Steve Kargl
On Wed, Jan 24, 2018 at 01:25:51PM -0800, Damian Rouson wrote:
> Thank you, Paul.  I think Alessandro has commit rights.
> If so, then I’ll ask him to make the requested edits and commit it.
> 
> Damian
> 

Yes, thanks, Paul.  Unfortunately, I've run out of time.
Damian, GCC is in stage 3, we need to wait for approval
from the release manager (aka Jakub) before committing
the patch.

-- 
Steve


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-24 Thread Damian Rouson
Thank you, Paul.   I think Alessandro has commit rights.  If so, then I’ll ask 
him to make the requested edits and commit it.

Damian

On January 24, 2018 at 12:19:58 PM, Paul Richard Thomas 
(paul.richard.tho...@gmail.com) wrote:

Hi All,  

Given the delay relative to the start of stage 3, I thought that I had  
better deal with this asap:  


+ /* TODO: this works on any derived type when  
+ it should only work with team_type. */  
+ if (team->ts.type != BT_DERIVED)  
Why don't you give the team_type derived type an attribute 'team_type'  
and test that?  

- code node is passed. The result type and library subroutine name  
+ code ndoe is passed. The result type and library subroutine name  
typo  

+! Tests if team_number intrinsic fucntion works  

It's just as well that there is an 'n' in there, although it gives me  
an idea for a new type of fortran procedure that does what it says :-)  

Together with the change that Steve identified, this seems to me to be  
ready to go.  

(Jakub, This is all hidden behind the -fcoarray option. To my mind  
this is safe for release.)  

OK for trunk.  

Many thanks for this patch.  

Paul  


On 23 January 2018 at 05:45, Steve Kargl  
 wrote:  
> I'm heading out of town for a meeting at the end of  
> week, so gfortran patches/reviews are on hold at the  
> moment. If someone else wants to step up to review  
> the patch, I won't object.  
>  
> --  
> steve  
>  
> On Mon, Jan 22, 2018 at 08:29:41PM -0800, Damian Rouson wrote:  
>> Is Fortran 2018 teams patch ok for trunk?  
>>  
>> Damian  
>>  
>> On January 19, 2018 at 2:47:39 PM, Alessandro Fanfarillo (elfa...@ucar.edu) 
>> wrote:  
>>  
>> I can confirm that the little change suggested by Steve passes the  
>> regtests (on x86_64-pc-linux-gnu) and the regular tests using  
>> OpenCoarrays.  
>>  
>> On Fri, Jan 19, 2018 at 10:33 AM, Steve Kargl  
>>  wrote:  
>> > On Fri, Jan 19, 2018 at 09:18:14AM -0800, Damian Rouson wrote:  
>> >> Thanks for catching that, Steve, and for responding, Alessandro.  
>> >>  
>> >> Anything else?  
>> >>  
>> >  
>> > I've only just started to look at the patch. Unfortunately,  
>> > I know zero about teams, so need to read the patch and F2018  
>> > standard simultaneously.  
>> >  
>> > --  
>> > Steve  
>>  
>>  
>>  
>> --  
>>  
>> Alessandro Fanfarillo, Ph.D.  
>> Postdoctoral Researcher  
>> National Center for Atmospheric Research  
>> Mesa Lab, Boulder, CO, USA  
>> 303-497-1229  
>  
> --  
> Steve  
> 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4  
> 20161221 https://www.youtube.com/watch?v=IbCHE-hONow  



--  
"If you can't explain it simply, you don't understand it well enough"  
- Albert Einstein  


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-24 Thread Paul Richard Thomas
Hi All,

Given the delay relative to the start of stage 3, I thought that I had
better deal with this asap:


+  /* TODO: this works on any derived type when
+ it should only work with team_type.  */
+  if (team->ts.type != BT_DERIVED)
Why don't you give the team_type derived type an attribute 'team_type'
and test that?

-   code node is passed.  The result type and library subroutine name
+   code ndoe is passed.  The result type and library subroutine name
typo

+! Tests if team_number intrinsic fucntion works

It's just as well that there is an 'n' in there, although it gives me
an idea for a new type of fortran procedure that does what it says :-)

Together with the change that Steve identified, this seems to me to be
ready to go.

(Jakub, This is all hidden behind the -fcoarray option. To my mind
this is safe for release.)

OK for trunk.

Many thanks for this patch.

Paul


On 23 January 2018 at 05:45, Steve Kargl
 wrote:
> I'm heading out of town for a meeting at the end of
> week, so gfortran patches/reviews are on hold at the
> moment.  If someone else wants to step up to review
> the patch, I won't object.
>
> --
> steve
>
> On Mon, Jan 22, 2018 at 08:29:41PM -0800, Damian Rouson wrote:
>> Is Fortran 2018 teams patch ok for trunk?
>>
>> Damian
>>
>> On January 19, 2018 at 2:47:39 PM, Alessandro Fanfarillo (elfa...@ucar.edu) 
>> wrote:
>>
>> I can confirm that the little change suggested by Steve passes the
>> regtests (on x86_64-pc-linux-gnu) and the regular tests using
>> OpenCoarrays.
>>
>> On Fri, Jan 19, 2018 at 10:33 AM, Steve Kargl
>>  wrote:
>> > On Fri, Jan 19, 2018 at 09:18:14AM -0800, Damian Rouson wrote:
>> >> Thanks for catching that, Steve, and for responding, Alessandro.
>> >>
>> >> Anything else?
>> >>
>> >
>> > I've only just started to look at the patch. Unfortunately,
>> > I know zero about teams, so need to read the patch and F2018
>> > standard simultaneously.
>> >
>> > --
>> > Steve
>>
>>
>>
>> --
>>
>> Alessandro Fanfarillo, Ph.D.
>> Postdoctoral Researcher
>> National Center for Atmospheric Research
>> Mesa Lab, Boulder, CO, USA
>> 303-497-1229
>
> --
> Steve
> 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
> 20161221 https://www.youtube.com/watch?v=IbCHE-hONow



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-22 Thread Steve Kargl
I'm heading out of town for a meeting at the end of
week, so gfortran patches/reviews are on hold at the
moment.  If someone else wants to step up to review
the patch, I won't object.

-- 
steve

On Mon, Jan 22, 2018 at 08:29:41PM -0800, Damian Rouson wrote:
> Is Fortran 2018 teams patch ok for trunk?   
> 
> Damian
> 
> On January 19, 2018 at 2:47:39 PM, Alessandro Fanfarillo (elfa...@ucar.edu) 
> wrote:
> 
> I can confirm that the little change suggested by Steve passes the  
> regtests (on x86_64-pc-linux-gnu) and the regular tests using  
> OpenCoarrays.  
> 
> On Fri, Jan 19, 2018 at 10:33 AM, Steve Kargl  
>  wrote:  
> > On Fri, Jan 19, 2018 at 09:18:14AM -0800, Damian Rouson wrote:  
> >> Thanks for catching that, Steve, and for responding, Alessandro.  
> >>  
> >> Anything else?  
> >>  
> >  
> > I've only just started to look at the patch. Unfortunately,  
> > I know zero about teams, so need to read the patch and F2018  
> > standard simultaneously.  
> >  
> > --  
> > Steve  
> 
> 
> 
> --  
> 
> Alessandro Fanfarillo, Ph.D.  
> Postdoctoral Researcher  
> National Center for Atmospheric Research  
> Mesa Lab, Boulder, CO, USA  
> 303-497-1229  

-- 
Steve
20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
20161221 https://www.youtube.com/watch?v=IbCHE-hONow


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-22 Thread Damian Rouson
Is Fortran 2018 teams patch ok for trunk?   

Damian

On January 19, 2018 at 2:47:39 PM, Alessandro Fanfarillo (elfa...@ucar.edu) 
wrote:

I can confirm that the little change suggested by Steve passes the  
regtests (on x86_64-pc-linux-gnu) and the regular tests using  
OpenCoarrays.  

On Fri, Jan 19, 2018 at 10:33 AM, Steve Kargl  
 wrote:  
> On Fri, Jan 19, 2018 at 09:18:14AM -0800, Damian Rouson wrote:  
>> Thanks for catching that, Steve, and for responding, Alessandro.  
>>  
>> Anything else?  
>>  
>  
> I've only just started to look at the patch. Unfortunately,  
> I know zero about teams, so need to read the patch and F2018  
> standard simultaneously.  
>  
> --  
> Steve  



--  

Alessandro Fanfarillo, Ph.D.  
Postdoctoral Researcher  
National Center for Atmospheric Research  
Mesa Lab, Boulder, CO, USA  
303-497-1229  


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-19 Thread Alessandro Fanfarillo
I can confirm that the little change suggested by Steve passes the
regtests (on x86_64-pc-linux-gnu) and the regular tests using
OpenCoarrays.

On Fri, Jan 19, 2018 at 10:33 AM, Steve Kargl
 wrote:
> On Fri, Jan 19, 2018 at 09:18:14AM -0800, Damian Rouson wrote:
>> Thanks for catching that, Steve, and for responding, Alessandro.
>>
>> Anything else?
>>
>
> I've only just started to look at the patch.   Unfortunately,
> I know zero about teams, so need to read the patch and F2018
> standard simultaneously.
>
> --
> Steve



-- 

Alessandro Fanfarillo, Ph.D.
Postdoctoral Researcher
National Center for Atmospheric Research
Mesa Lab, Boulder, CO, USA
303-497-1229


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-19 Thread Steve Kargl
On Fri, Jan 19, 2018 at 09:18:14AM -0800, Damian Rouson wrote:
> Thanks for catching that, Steve, and for responding, Alessandro.
> 
> Anything else?
> 

I've only just started to look at the patch.   Unfortunately,
I know zero about teams, so need to read the patch and F2018
standard simultaneously.

-- 
Steve


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-19 Thread Damian Rouson
Thanks for catching that, Steve, and for responding, Alessandro.

Anything else?

Damian

On January 19, 2018 at 9:17:03 AM, Alessandro Fanfarillo (elfa...@ucar.edu) 
wrote:

Yes, definitively ar->team. 

On Fri, Jan 19, 2018 at 8:36 AM, Steve Kargl 
 wrote: 
> index 882fe577b76..b4baf5be554 100644 
> --- a/gcc/fortran/array.c 
> +++ b/gcc/fortran/array.c 
> @@ -158,6 +158,7 @@ gfc_match_array_ref (gfc_array_ref *ar, gfc_array_spec 
> *as, int init, 
> bool matched_bracket = false; 
> gfc_expr *tmp; 
> bool stat_just_seen = false; 
> + bool team_just_seen = false; 
> 
> memset (ar, '\0', sizeof (*ar)); 
> 
> @@ -230,8 +231,21 @@ coarray: 
> if (m == MATCH_ERROR) 
> return MATCH_ERROR; 
> 
> + team_just_seen = false; 
> stat_just_seen = false; 
> - if (gfc_match(" , stat = %e",) == MATCH_YES && ar->stat == NULL) 
> + if (gfc_match (" , team = %e", ) == MATCH_YES && ar->stat == NULL) 
> 
> 
> Is the 2nd ar->stat suppose to be ar->team? 
> 
> -- 
> Steve 



-- 

Alessandro Fanfarillo, Ph.D. 
Postdoctoral Researcher 
National Center for Atmospheric Research 
Mesa Lab, Boulder, CO, USA 
303-497-1229 


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-19 Thread Alessandro Fanfarillo
Yes, definitively ar->team.

On Fri, Jan 19, 2018 at 8:36 AM, Steve Kargl
 wrote:
> index 882fe577b76..b4baf5be554 100644
> --- a/gcc/fortran/array.c
> +++ b/gcc/fortran/array.c
> @@ -158,6 +158,7 @@ gfc_match_array_ref (gfc_array_ref *ar, gfc_array_spec
> *as, int init,
>bool matched_bracket = false;
>gfc_expr *tmp;
>bool stat_just_seen = false;
> +  bool team_just_seen = false;
>
>memset (ar, '\0', sizeof (*ar));
>
> @@ -230,8 +231,21 @@ coarray:
>if (m == MATCH_ERROR)
> return MATCH_ERROR;
>
> +  team_just_seen = false;
>stat_just_seen = false;
> -  if (gfc_match(" , stat = %e",) == MATCH_YES && ar->stat == NULL)
> +  if (gfc_match (" , team = %e", ) == MATCH_YES && ar->stat == NULL)
>
>
> Is the 2nd ar->stat suppose to be ar->team?
>
> --
> Steve



-- 

Alessandro Fanfarillo, Ph.D.
Postdoctoral Researcher
National Center for Atmospheric Research
Mesa Lab, Boulder, CO, USA
303-497-1229


Re: [PATCH, fortran] Support Fortran 2018 teams

2018-01-19 Thread Steve Kargl
index 882fe577b76..b4baf5be554 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -158,6 +158,7 @@ gfc_match_array_ref (gfc_array_ref *ar, gfc_array_spec
*as, int init,
   bool matched_bracket = false;
   gfc_expr *tmp;
   bool stat_just_seen = false;
+  bool team_just_seen = false;

   memset (ar, '\0', sizeof (*ar));

@@ -230,8 +231,21 @@ coarray:
   if (m == MATCH_ERROR)
return MATCH_ERROR;

+  team_just_seen = false;
   stat_just_seen = false;
-  if (gfc_match(" , stat = %e",) == MATCH_YES && ar->stat == NULL)
+  if (gfc_match (" , team = %e", ) == MATCH_YES && ar->stat == NULL)


Is the 2nd ar->stat suppose to be ar->team?

-- 
Steve


[PATCH, fortran] Support Fortran 2018 teams

2018-01-18 Thread Damian Rouson
 
All,

Attached please find what I hope is the final version of the patch that adds 
partial support for teams of images, the last remaining major Fortran 2018 
feature without current support in gfortran (or any other Fortran compiler of 
which I’m aware).  I submitted the first draft of this patch last September. 
Regression tests show no unexpected failures (i.e., the output of ‘grep -w FAIL 
gfortran.sum’ is empty). The Changelogs are below.

Among the details remaining for future commits are the following: support for 
the GET_TEAM intrinsic function is incomplete, the TEAM_NUMBER intrinsic 
function doesn’t yet accept the optional argument, and a SYNC TEAM test is 
needed.  Using any of the unsupported features generates a compile-time error 
message from gfortran or a runtime error message from OpenCoarrays. There are 
no internal compiler errors of which I’m aware.  And there remains one big, 
dissertation-worthy project in handling the use of teams in the presence of 
failed images.

Ok for trunk?

Damian


2018-01-18  Damian Rouson  
        Alessandro Fanfarillo  

        Partial support for Fortran 2018 teams features.

        * array.c (gfc_match_array_ref): add team attribute in coarray
        transfers.
        * check.c (gfc_check_get_team, gfc_check_team_number): add new 
        functions for get_team and team_number.
        * dump-parse-tree.c (show_code_node): add new statements: form team,
        change team, end team, and sync team.
        * expr.c (gfc_find_team_co): add new function.
        * gfortran.h: add new statements.
        * intrinsic.c (add_functions): add get_team and team_number functions.
        * intrinsic.h: add get_team and team_number prototypes for check,
        simplify, and resolve.
        * iresolve.c (gfc_resolve_get_team, gfc_resolve_team_number): add new 
        functions.
        * iso-fortran-env.def: add the team_type derived type.
        * match.c (gfc_match_if, gfc_match_form_team, gfc_match_team_number)
        (gfc_match_end_team, gfc_match_sync_team, gfc_match_change_team):
        add change team, end team, form team, sync team match and functions.
        * match.h: add new prototypes for change team, end team, form team,
        and sync team.
        * parse.c (decode_statement): add cases for change team, end team,
        form team, and sync team.
        * resolve.c: add cases for exec form team, change team, end team, and 
        sync team.
        * simplify.c (gfc_simplify_get_team): add new function for get team.
        * st.c (gfc_free_statement): add cases exec for change team, end team,
        form team, sync team.
        * trans-decl.c (gfor_fndecl_caf_form_team)
        (gfor_fndecl_caf_change_team, gfor_fndecl_caf_end_team)
        (gfor_fndecl_caf_sync_team, gfor_fndecl_caf_get_team)
        (gfor_fndecl_caf_team_number): add functions and definitions.
        * trans-intrinsic.c (conv_caf_send, conv_intrinsic_team_number): add 
        new function and team_type argument support.
        * trans-stmt.c (gfc_trans_form_team, gfc_trans_change_team)
        (gfc_trans_end_team, gfc_trans_sync_team): add new functions.
        * trans-stmt.h: add new prototypes.
        * trans-types.c (gfc_get_derived_type): check condition for team_type.
        * trans.c (trans_code): new exec cases for form team, change team, end 
        team, and sync team.
        * trans.h: add new prototypes.

2018-01-18  Damian Rouson  
        Alessandro Fanfarillo  

        Fortran 2018 teams tests.

        * gfortran.dg/team_number_1.f90: new test for team_number.
        * gfortran.dg/team_change_1.f90: new test for change team.
        * gfortran.dg/team_end_1.f90: new test for end team.
        * gfortran.dg/team_form_1.f90: new test for form team.





teams-patch.diff
Description: Binary data