sourceryinstitute / OpenCoarrays

A parallel application binary interface for Fortran 2018 compilers.
http://www.opencoarrays.org
BSD 3-Clause "New" or "Revised" License
244 stars 58 forks source link

STOP normal termination: missing OUTPUT_UNIT output #160

Closed mexas closed 8 years ago

mexas commented 8 years ago
$ cat term.f90
integer :: i[*], j, img
  img = this_image()
  i = img
  if ( img .eq. 1 ) stop "img 1 cannot continue"
  do j = 1 , 100000000
    i = int( atan( real( j ) ) )
  end do
  write (*,*) "img=", img, "i=", i
end

$ caf -o term.ox -Werror -O2 term.f90

$ cafrun -np 5 term.ox
STOP img 1 cannot continue

The output from other images is missing. Should be something like this:

img 1 cannot continue
 img=           3 i=           1
 img=           2 i=           1
 img=           4 i=           1
 img=           5 i=           1

This has been confirmed as incorrect behaviour at: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=comp-fortran-90;f35859ec.1603

Anton

afanfa commented 8 years ago

Anton, thanks for reporting this. I'll fix it during the weekend.

Alessandro

afanfa commented 8 years ago

Hi, I've noticed that the STOP statement is translated into an invocation to a function not implemented in OpenCoarrays. This function is commonly used for serial execution and does not have any knowledge about coarrays. I need to modify GFortran to distinguish coarray and non-coarray cases and invoke the right function accordingly. Obviously, in the coarray case, the program will invoke the function implemented into OpenCoarrays (to do).

afanfa commented 8 years ago

Hi,

I've got a working patch for GFortran and OpenCoarrays about this bug. I'll submit them tomorrow.

Cheers, Alessandro

rouson commented 8 years ago

:clap:

afanfa commented 8 years ago

The GFortran patch has been applied to trunk and gcc-5-branch.

afanfa commented 8 years ago

Fixed

zbeekman commented 8 years ago

@mexas I just wanted to confirm that this has solved your problem. We are issuing a new release today with these changes---since builds of OpenCoarrays with gcc-trunk or gcc-5-branch (GCC > 5.3) will have a build failure with previous releases of OpenCoarrays ( <= 1.3.8)

mexas commented 8 years ago

I don't see any change.

$ which caf /panfs/panasas01/mech/mexas/OpenCoarrays-1.4.0/opencoarrays-installation/bin/caf $ which cafrun /panfs/panasas01/mech/mexas/OpenCoarrays-1.4.0/opencoarrays-installation/bin/cafrun $ caf -o term.ox -Werror -O2 term.f90 $ cafrun -np 8 term.ox STOP img 1 cannot continue $ cat term.f90 implicit none integer :: i[_], j, img img = thisimage() i = img if ( img .eq. 1 ) stop "img 1 cannot continue" do j = 1 , 100000000 i = int( atan( real( j ) ) ) end do write (,*) "img=", img, "i=", i end $ ldd term.ox linux-vdso.so.1 => (0x00002aaaaaacb000) libmpifort.so.12 => /panfs/panasas01/mech/mexas/mpich3.2-install/lib/libmpifort.so.12 (0x00002aaaaaccd000) libmpi.so.12 => /panfs/panasas01/mech/mexas/mpich3.2-install/lib/libmpi.so.12 (0x00002aaaaaf03000) libgfortran.so.3 => /cm/shared/languages/GCC-5.3/lib64/libgfortran.so.3 (0x00002aaaab391000) libm.so.6 => /lib64/libm.so.6 (0x00002aaaab6ce000) libgcc_s.so.1 => /cm/shared/languages/GCC-5.3/lib64/libgcc_s.so.1 (0x00002aaaab953000) libquadmath.so.0 => /cm/shared/languages/GCC-5.3/lib64/libquadmath.so.0 (0x00002aaaabb69000) libc.so.6 => /lib64/libc.so.6 (0x00002aaaabda7000) librt.so.1 => /lib64/librt.so.1 (0x00002aaaac13c000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaac344000) /lib64/ld-linux-x86-64.so.2 (0x00002aaaaaaab000) $ caf -v

OpenCoarrays Coarray Fortran Compiler Wrapper (caf version 1.4.0) Copyright (C) 2015-2016 Sourcery, Inc.

OpenCoarrays comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of OpenCoarrays under the terms of the BSD 3-Clause License. For more information about these matters, see the file named LICENSE.

$ caf -w caf wraps CAFC=mpif90 $ mpif90 -v mpifort for MPICH version 3.2 Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/cm/shared/languages/GCC-5.3/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-5.3.0/configure --prefix=/cm/shared/languages/GCC-5.3 --enable-languages=c,c++,fortran --with-gmp=/cm/shared/languages/GCC-5.3 --with-mpfr=/cm/shared/languages/GCC-5.3 Thread model: posix gcc version 5.3.0 (GCC)

afanfa commented 8 years ago

Dear Anton, the bug was on library AND compiler. You also need to update your gcc with the latest trunk version (gcc-6) or gcc 5.4 (not yet released but available as snapshot).

Cheers, Alessandro

zbeekman commented 8 years ago

@mexas ah yes, my apologies, I forgot to mention that you will need to try using a development version of gcc... if you're on Mac OS X and use homebrew, you can install the trunk version (GCC 6) with brew install --HEAD gcc. Currently there is a small issue with the binary suffix names: you'll need to use gcc- and gfortran- as the compiler names if you take this approach. Alternatively, you can wait for an official release of GCC 5.4 or GCC 6.1 (not sure when these will be released, but they should be in the next month or two I would guess)

mexas commented 8 years ago

Dear Anton, the bug was on library AND compiler. You also need to update your gcc with the latest trunk version (gcc-6) or gcc 5.4 (not yet released but available as snapshot).

ok, in this case, I need more time to check.

Thank you

Anton

mexas commented 8 years ago

ok, thanks. Will try later. I'm battling to build GCC 5.3 on BG/Q right now.

Thank you

Anton

mexas commented 8 years ago

got there finally with (GCC) 6.0.0 20160410

newblue4> cafrun -np 8 term.ox STOP img 1 cannot continue img= 2 i= 1 img= 7 i= 1 img= 8 i= 1 img= 4 i= 1 img= 5 i= 1 img= 6 i= 1 img= 3 i= 1 newblue4>

Thanks

Anton

zbeekman commented 8 years ago

Awesome! Happy to hear that this has resolved the issue. (or at least, once gcc 5.4 or gcc 6 become available)

On Tue, Apr 12, 2016 at 6:33 PM mexas notifications@github.com wrote:

got there finally with (GCC) 6.0.0 20160410

newblue4> cafrun -np 8 term.ox

STOP img 1 cannot continue

img= 2 i= 1 img= 7 i= 1 img= 8 i= 1 img= 4 i= 1 img= 5 i= 1 img= 6 i= 1 img= 3 i= 1 newblue4>

Thanks

Anton

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sourceryinstitute/opencoarrays/issues/160#issuecomment-209130061