public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jorge D'Elia <jdelia@intec.unl.edu.ar>
To: Gfortran List <fortran@gcc.gnu.org>
Subject: A doubt about lbound and ubound of an array inside a coarray
Date: Sun, 21 Mar 2021 13:18:13 -0300 (ART)	[thread overview]
Message-ID: <1171521953.1070.1616343493686.JavaMail.zimbra@intec.unl.edu.ar> (raw)
In-Reply-To: <121178681.597.1612108263047.JavaMail.zimbra@intec.unl.edu.ar>

Hi all,
 
I have a doubt about lbound and bound in the test below 
using gfortran with opencoarrays, gasnet, and openmpi.

With the AA coarray (each AA entry is a 2D array), 
the values obtained with lbound and ubound are different 
from the initial and final values arbitrarily defined for 
each array entry. 

Is this ok and did I miss something here? 

Thanks in advance for some clarification.

Regards.
Jorge.

$ which gfortran
/usr/beta/gcc-trunk/bin/gfortran

$ gfortran --version
GNU Fortran (GCC) 11.0.1 20210315 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.

$ which ompi_info
/usr/beta/openmpi/bin/ompi_info

$ ompi_info
  ...
  /usr/beta/gcc-trunk/bin/gfortran

$ mpifort -Wall -Wextra -g -fcoarray=lib doubt1.f90 -o doubt1-openmpi.exe -L/usr/beta/opencoarrays-openmpi/lib64 -lcaf_mpi -lopencoarrays_mod -lmpi

$ mpirun --mca pml ucx --mca osc ucx -np 4 --mca btl vader,self,tcp --machinefile ${HOME}/machi-openmpi.dat --map-by node --map-by slot --map-by core --bind-to l2cache --mca orte_base_help_aggregate 0 --report-bindings --display-allocation --display-devel-map  doubt1-openmpi.exe
 
======================   ALLOCATED NODES   ======================
        flags=0x11 slots=16 max_slots=16 slots_inuse=0 state=UP
=================================================================
 Data for JOB [53806,1] offset 0 Total slots allocated 16

 Mapper requested: NULL  Last mapper: round_robin  Mapping policy: BYCORE:NOOVERSUBSCRIBE  Ranking policy: CORE
 Binding policy: L2CACHE  Cpu set: NULL  PPR: NULL  Cpus-per-rank: 0
         Num new daemons: 0        New daemon starting vpid INVALID
         Num nodes: 1

 Data for node: State: 3        Flags: 11
         Daemon: [[53806,0],0]        Daemon launched: True
         Num slots: 16        Slots in use: 4        Oversubscribed: FALSE
         Num slots allocated: 16        Max slots: 16
         Num procs: 4        Next node_rank: 4
         Data for proc: [[53806,1],0]
                 Pid: 0        Local rank: 0        Node rank: 0        App rank: 0
                 State: INITIALIZED        App_context: 0
                 Locale:  [BB/../../..]
                 Binding: [BB/../../..]
         Data for proc: [[53806,1],1]
                 Pid: 0        Local rank: 1        Node rank: 1        App rank: 1
                 State: INITIALIZED        App_context: 0
                 Locale:  [../BB/../..]
                 Binding: [../BB/../..]
         Data for proc: [[53806,1],2]
                 Pid: 0        Local rank: 2        Node rank: 2        App rank: 2
                 State: INITIALIZED        App_context: 0
                 Locale:  [../../BB/..]
                 Binding: [../../BB/..]
         Data for proc: [[53806,1],3]
                 Pid: 0        Local rank: 3        Node rank: 3        App rank: 3
                 State: INITIALIZED        App_context: 0
                 Locale:  [../../../BB]
                 Binding: [../../../BB]
[55028] MCW rank 0 bound to socket 0[core 0[hwt 0-1]]: [BB/../../..]
[55028] MCW rank 1 bound to socket 0[core 1[hwt 0-1]]: [../BB/../..]
[55028] MCW rank 2 bound to socket 0[core 2[hwt 0-1]]: [../../BB/..]
[55028] MCW rank 3 bound to socket 0[core 3[hwt 0-1]]: [../../../BB]

  ti h lbound(aa%oo,1) ubound(aa%oo,1) lbound(aa%oo,2) ubound(aa%oo,2)
           1           1           1           2           1           2
           3           1           1           2           1           2
           4           1           1           2           1           2
           2           1           1           2           1           2
           2           2           1           3           1           3
           1           2           1           3           1           3
           4           2           1           3           1           3
           3           2           1           3           1           3
           3           3           1           4           1           4
           2           3           1           4           1           4
           1           3           1           4           1           4
           4           3           1           4           1           4
           4           4           1           5           1           5
           3           4           1           5           1           5
           2           4           1           5           1           5
           1           4           1           5           1           5

  ti h aa[h]%i1 aa[h]%i2 aa[h]%j1 aa[h]%j1 aa[h]%j2
           1           1           2           3           4           5
           2           1           2           3           4           5
           2           2           8          10          12          14
           1           2           8          10          12          14
           2           3          14          17          20          23
           2           4          20          24          28          32
           3           1           2           3           4           5
           4           1           2           3           4           5
           1           3          14          17          20          23
           3           2           8          10          12          14
           4           2           8          10          12          14
           1           4          20          24          28          32
           3           3          14          17          20          23
           4           3          14          17          20          23
           3           4          20          24          28          32
           4           4          20          24          28          32

$ cat doubt1.f90
program doubt1
  implicit none
  type tma
    integer, allocatable :: oo (:,:)
    integer :: i1,i2,j1,j2
  end type tma
  type (tma) :: aa [*]
  !
  integer, parameter :: np = 2, nq = 2
  integer :: map (np,nq)
  integer :: ni, ti
  integer :: i1, i2, j1, j2
  integer :: h, k, p, q
  !
  ni = num_images()
  ti = this_image()
  !
  if (ni .ne. 4) error stop "num_images() must be 4"
  !
  k = 1
  do q = 1, nq
  do p = 1, np
    map (p,q) = k
    k = k + 1
  end do
  end do
  !
  i1 = 2
  i2 = 3
  j1 = 4
  j2 = 5
  do  h = 1, ni
    if (ti .eq. h) then
      allocate (aa % oo (i1:i2,j1:j2))
      aa % oo (i1:i2,j1:j2) = k
      aa % i1 = i1
      aa % i2 = i2
      aa % j1 = j1
      aa % j2 = j2
    end if
    i1 = i1 + 6
    i2 = i2 + 7
    j1 = j1 + 8
    j2 = j2 + 9
  end do
  !
  sync all
  !
  if (ti .eq. 1) then
    write (*,*)
    write (*,*)" ti h lbound(aa%oo,1) ubound(aa%oo,1) lbound(aa%oo,2) ubound(aa%oo,2)"
  end if
  do h = 1, ni
    write (*,*) ti,h,lbound (aa[h]%oo,1), ubound (aa[h]%oo,1), &
                     lbound (aa[h]%oo,2), ubound (aa[h]%oo,2)
  end do
  !
  sync all
  !
  if (ti .eq. 1) then
    write (*,*)
    write (*,*)" ti h aa[h]%i1 aa[h]%i2 aa[h]%j1 aa[h]%j1 aa[h]%j2"
  end if
  do h = 1, ni
    write (*,*) ti, h, aa [h] % i1, aa [h] % i2, &
                       aa [h] % j1, aa [h] % j2
  end do
  !
end program doubt1
#end

      parent reply	other threads:[~2021-03-21 16:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 15:51 A question about coarrays and -Warray-temporaries Jorge D'Elia
2021-02-01  7:42 ` Thomas Koenig
2021-02-01 10:43   ` Jorge D'Elia
2021-02-01 11:52   ` Tobias Burnus
2021-02-02 11:46     ` [Patch] Fortran: Fix Array dependency with local coarrays [PR98913] (was: Re: A question about coarrays and -Warray-temporaries) Tobias Burnus
2021-02-02 14:32       ` Jorge D'Elia
2021-02-02 14:54       ` Thomas Koenig
2021-02-02 17:15         ` Tobias Burnus
2021-02-09 11:52           ` [Patch] Fortran: Fix coarray handling for gfc_dep_resolver [PR99010] (was: Re: [Patch] Fortran: Fix Array dependency with local coarrays [PR98913] Tobias Burnus
2021-02-13 19:57             ` Tobias Burnus
2021-02-19  9:33             ` *PING**2 " Tobias Burnus
2021-02-19 16:25               ` Jerry DeLisle
2021-03-21 16:18 ` Jorge D'Elia [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1171521953.1070.1616343493686.JavaMail.zimbra@intec.unl.edu.ar \
    --to=jdelia@intec.unl.edu.ar \
    --cc=fortran@gcc.gnu.org \
    --cc=jdelia@cimec.unl.edu.ar \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).