Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defect: get_team() does not compile properly #545

Open
ghost opened this issue May 31, 2018 · 18 comments
Open

Defect: get_team() does not compile properly #545

ghost opened this issue May 31, 2018 · 18 comments

Comments

@ghost
Copy link

ghost commented May 31, 2018

Avg response time
Issue Stats

Defect/Bug Report

  • OpenCoarrays Version: 2.1.0-22-gbca8f16
  • Fortran Compiler: GNU Fortran (GCC) 8.1.1 20180528
  • C compiler used for building lib: gcc 8.1.1 20180528
  • Installation method: cmake gui -> makefile -> make install
  • Output of uname -a: Linux dune 4.16.12-1-ARCH tests dis_transpose: test passed  #1 SMP PREEMPT Fri May 25 23:30:31 UTC 2018 x86_64 GNU/Linux (running under VirtualBox on an iMac)
  • MPI library being used: mpich 3.2.1
  • Machine architecture and number of physical cores: X86-64 / 4 cores
  • Version of CMake: 3.11.2

Observed Behavior

I get a compile error when trying to use the get_team() intrinsic:

program test_get_team
   use, intrinsic :: iso_fortran_env, only: team_type
   type(team_type) :: initial
   initial = get_team()
 end program test_get_team

Compiling the above, I get:

../get-team.f90:4:13:

    initial = get_team()
             1
Error: Can't convert INTEGER(4) to TYPE(team_type) at (1)

So, it appears that get_team() returns an integer.

FURTHER...

I then changed the return type to an integer:

program test_get_team
   use, intrinsic :: iso_fortran_env, only: team_type
   integer :: tn
   tn = get_team()
 end program test_get_team

I then get a internal compiler error:

[ 37%] Building Fortran object CMakeFiles/get-team.dir/get-team.f90.o
f951: internal compiler error: Intrinsic function '_gfortran_caf_get_team' (118) not recognized
0x61a32f gfc_internal_error(char const*, ...)
    ../.././gcc/fortran/error.c:1358
0x70ba60 gfc_conv_intrinsic_lib_function
    ../.././gcc/fortran/trans-intrinsic.c:855
0x70fa07 gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
    ../.././gcc/fortran/trans-intrinsic.c:9556
0x6ee8dc gfc_conv_function_expr
    ../.././gcc/fortran/trans-expr.c:6788
0x6eee2a gfc_conv_expr(gfc_se*, gfc_expr*)
    ../.././gcc/fortran/trans-expr.c:7922
0x6f6463 gfc_trans_assignment_1
    ../.././gcc/fortran/trans-expr.c:10098
0x6bc227 trans_code
    ../.././gcc/fortran/trans.c:1828
0x6e246b gfc_generate_function_code(gfc_namespace*)
    ../.././gcc/fortran/trans-decl.c:6507
0x673146 translate_all_program_units
    ../.././gcc/fortran/parse.c:6121
0x673146 gfc_parse_file()
    ../.././gcc/fortran/parse.c:6324
0x6b948f gfc_be_parse_file
    ../.././gcc/fortran/f95-lang.c:204
Please submit a full bug report,

Expected Behavior

get_team() should compile and link. get_team should return a TEAM_TYPE variable.

NOTE: This could be a bug in both gfortran and opencoarrays.

Steps to Reproduce

In Observed Behavior.

@zbeekman
Copy link
Collaborator

@dobrecht Sorry, am I understanding you correctly that you are compiling with GCC/GFortran trunk? Or at least the latest commit on the 8.x branch? Or are you using the 8.1.0 official release?

@zbeekman
Copy link
Collaborator

CC: @scrasmussen

@MichaelSiehl
Copy link

MichaelSiehl commented Jun 1, 2018

From my own testing: the get_team intrinsic function does not seem to be implemented yet and using it gives error messages at multiple levels (I did use gfortran 9.0.0 20180506 (experimental); on my system, the error messages are in german):

sync team (get_team())

generates the same compile time error as yours above.

sync team (get_team(1))

generates compile time error:
Error: Argument »level« of the intrinsic »get_team« at (1) is not supported yet

sync team (get_team(initial_team))

generates compile time error:
Error: Symbol »initial_team« at (1) has no IMPLICIT-Typ
(this error is also with the constants parent_team and current_team, they are missing in iso_fortran_env)

The full test case:

program Main
! please compile and run with 15 coarray images
  !
  use,intrinsic :: ISO_FORTRAN_ENV
  implicit none
  !
  integer :: intTeamNumber
  type (team_type) :: MainTeam
  type (team_type) :: SubTeam
  !
!
!************************************************
! MainTeam **************************************
!************************************************
!
! split the 15 images of the initial team into 3 child teams consisting of 5 images each:
  if (this_image() <= 5) then
    intTeamNumber = 1
  else if (this_image() >= 6 .and. this_image() <= 10) then
    intTeamNumber = 2
  else if (this_image() >= 11) then
    intTeamNumber = 3
  end if
  !
form team (intTeamNumber, MainTeam) ! this creates the 3 child teams in MainTeam
!
change team (MainTeam)
!
! important: the following gets executed on the images of all the 3 newly created child teams:
!
!************************************************
! SubTeam ***************************************
!************************************************
!
! split the 5 images of the MainTeam's child teams into two distinct teams resp.:
  if (this_image() < 3) then
    intTeamNumber = 1
  else
    intTeamNumber = 2
  end if
!
form team (intTeamNumber, SubTeam) ! this generates 6 teams (2 new sub teams in the 3 main teams resp.)
                                   ! within the change team (MainTeam) construct
change team (SubTeam)
!
sync team (get_team()) ! generates compile time error
!sync team (get_team(1)) ! generates compile time error
!sync team (get_team(initial_team)) ! generates compile time error
!
SubTeam_select: select case (team_number())
!
case (1) SubTeam_select
  ! codes for child team 1 of SubTeam:
  write(*,*) 'image number: ', this_image(), ' of team number: ', team_number(), &
             ' in SubTeam, of MainTeam''s child team number:' !, team_number(MainTeam)
              !Fortran runtime error on image 1: team_number does not yet support the optional team argument
  !
!*******************
case (2) SubTeam_select
  ! codes for child team 2 of SubTeam:
  write(*,*) 'image number: ', this_image(), ' of team number: ', team_number(), &
             ' in SubTeam, of MainTeam''s child team number:' !, team_number(MainTeam)
              !Fortran runtime error on image 1: team_number does not yet support the optional team argument
!
end select SubTeam_select
!
end team !(SubTeam)
!
!*************
!*************
!*************
!
end team !(MainTeam)
!
end program Main

Best Regards

@ghost
Copy link
Author

ghost commented Jun 1, 2018

@zbeekman I am using the updated branch of 8.1.X (gcc 8.1.1 20180528) ; the 2018-05-28 build

@ghost ghost changed the title Bug: get_team() does not compile properly Defect: get_team() does not compile properly Jun 5, 2018
@zbeekman
Copy link
Collaborator

zbeekman commented Sep 8, 2018

@scrasmussen is Fortran 8.2 and OpenCoarrays 2.2.0 supposed to support get_team() and sync team?

$ cat testteam.f90
sync team(get_team()) ; end
$ caf testteam.f90
f951: internal compiler error: Intrinsic function '_gfortran_caf_get_team' (118) not recognized
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
Error: comand:
   `/usr/local/bin/gfortran-8 -I/usr/local/include/OpenCoarrays-2.2.0-4-gc536225_GNU-8.2.0 -fcoarray=lib -Wl,-flat_namespace -Wl,-commons,use_dylibs -L/usr/local/Cellar/libevent/2.1.8/lib testteam.f90 /usr/local/lib/libcaf_mpi.a /usr/local/Cellar/open-mpi/3.1.2/lib/libmpi_usempif08.dylib /usr/local/Cellar/open-mpi/3.1.2/lib/libmpi_usempi_ignore_tkr.dylib /usr/local/Cellar/open-mpi/3.1.2/lib/libmpi_mpifh.dylib /usr/local/Cellar/open-mpi/3.1.2/lib/libmpi.dylib`
failed to compile.

@MichaelSiehl
Copy link

In case it helps:
My first successful test of using the SYNC TEAM statement as standalone was with gfortran 8.0.1 and OpenCoarrays 2.0.0, like this: sync team (new_team) . The effect of SYNC TEAM was only on the images with the same team number (within the SELECT CASE for code execution with that team number). Using SYNC ALL, on the other hand, did effect all images within the CHANGE TEAM construct. That is exactly the desired runtime behavior, everything was perfect with my testing.
(My above test case was only to show, that GET_TEAM() does not seem to be implemented yet. Instead, you can use the test case to test the SYNC TEAM statement by simply putting a SYNC TEAM(SubTeam) within the CASE(1) block, for example.)

cheers

@scrasmussen
Copy link
Contributor

scrasmussen commented Sep 9, 2018

@zbeekman Fortran 8.2 is supposed to support get_team(), I've started looking into this issue and will work on solving it. Thanks for pinging me and that short reproducer

Thanks @MichaelSiehl for your work and comments on this, they are helpful

@zbeekman
Copy link
Collaborator

Any updates @scrasmussen ?

@zbeekman
Copy link
Collaborator

After doing some code spelunking, it seems clear that get_team() just is not implemented, whatsoever on the library (OpenCoarrays) side.

@MichaelSiehl
Copy link

Just FYI, the missing intrinsic function get_team() can easily be circumvented by the programmer for the team variable of the parent and the current team (just by maintaining the values of these team variables locally). Only the team value of the initial team is not accessible to the programmer without the get_team() function.

@zbeekman zbeekman added this to Confirmed bugs in Bug squashing: Most wanted Mar 28, 2019
@stale
Copy link

stale bot commented Mar 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Mar 29, 2019
@stale stale bot removed the stale label Mar 29, 2019
@MichaelSiehl
Copy link

I did just newly check using OpenCoarrays 2.6.1 and the most recent gfortran 9.0.1 (experimental). My above test case does still generate the same compile time errors. Therefore, I would recommend to leave this issue open yet.

These error messages remain:

  • f951: internal compiler error: Intrinsic function '_gfortran_caf_get_team' not recognized
  • Error: Argument »level« of the intrinsic »get_team« at (1) is not supported yet
  • Error: Symbol »initial_team« at (1) has no IMPLICIT-Typ
    (that last error is also with the constants parent_team and current_team, they are missing in iso_fortran_env)

@zbeekman
Copy link
Collaborator

Yes, I agree... I needed to fix something in the configuration of the stalebot. This issue should stay open until it is resolved.

@nathanweeks
Copy link
Contributor

nathanweeks commented Apr 25, 2019

@zbeekman
Copy link
Collaborator

This bug happens with -fcoarray=single so it appears changes are needed on the compiler side too.

@milancurcic
Copy link

I read through this thread and understand that implementation of get_team() is a TODO.

Posting here for the next person who lands here: get_team is not implemented as of gcc-9.2.0 and OpenCoarrays-2.8.0.

It be extremely helpful to maintain a doc that lists the status of features (not implemented/in progress/implemented) so that people know what they can expect. Is there any such doc?

@MichaelSiehl
Copy link

I'm not part of the OpenCoarrays team but, regarding coarray teams, did maintain such a list myself. The good news: this open issue here was the last unresolved issue on my (old) list.

Among the already solved (more important) issues on my list are:
#533
#610
#524

But I did not too many new coding with coarray teams in the last few month, since my recent main focus is on object-oriented parallel programming through coarray components using OpenCoarrays/gfortran.

cheers

@nathanweeks
Copy link
Contributor

I think this would be more straightforward to implement if OpenCoarrays (at least when compiled with MPI support) used the underlying MPI communicator to directly represent the team object. I had a branch of an older version of OpenCoarrays that implemented this (as well as the optional TEAM argument to TEAM_NUMBER()): nathanweeks@31e39f2

If there's interest, I could update this branch for OpenCoarrays 2.8.0 and submit a PR for more formal review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bug squashing: Most wanted
  
Confirmed bugs
Development

No branches or pull requests

5 participants