sync all not doing its job

sync all not doing its job

Hi,

I've attached a co-array program in which the "sync all" statement does not seems to work.

The output of the program is the following:

$ make clean; make; ./a.out
ifort -coarray -coarray-num-images=2 -c mesh_class.f90 -o mesh_class.o
ifort -coarray -coarray-num-images=2 -c main.f90 -o main.o
ifort -coarray -coarray-num-images=2 main.o mesh_class.o -o a.out
  [Main]:1/2: Starting
  [Main]:1/2: allocated(Mesh%Block) = F
  [Main]:1/2: Allocating Block
  [Main]:1/2: Allocating Xv
  [Main]:1/2: ==========> sync all <==========
  [Main]:1/2: Ending
  [Main]:2/2: Starting
  [Main]:2/2: allocated(Mesh%Block) = F
  [Main]:2/2: Allocating Block
  [Main]:2/2: Allocating Xv
  [Main]:2/2: ==========> sync all <==========
  [Main]:2/2: Ending

As you can see, the 1s image ends before the 2nd image starts.

If I un-comment the call to the Construct_Mesh procedure in main, I get the following output:

make clean; make; ./a.out
ifort -coarray -coarray-num-images=2 -c mesh_class.f90 -o mesh_class.o
ifort -coarray -coarray-num-images=2 -c main.f90 -o main.o
ifort -coarray -coarray-num-images=2 main.o mesh_class.o -o a.out
  [Main]:1/2: Starting
  [Main]:1/2: Calling Construct_Mesh with NBlock=1 Nx=2 Ny=5
    [Construct_Mesh]:1/2: Entering
    [Construct_Mesh]:1/2: allocated(Mesh%Block) = F
    [Construct_Mesh]:1/2: Allocating Block
    [Construct_Mesh]:1/2: Allocating Xv
    [Construct_Mesh]:1/2: ==========> sync all <==========
    [Construct_Mesh]:1/2: Local  write
    [Construct_Mesh]:1/2: size(Mesh%Block) =   1
    [Construct_Mesh]:1/2: Mesh%Block(1)%Nx           =   2   Mesh%Block(1)%Ny           =   5
    [Construct_Mesh]:1/2: lbound(Mesh%Block(1)%Xv,1) =   1   lbound(Mesh%Block(1)%Xv,2) =   1
    [Construct_Mesh]:1/2: ubound(Mesh%Block(1)%Xv,1) =   2   ubound(Mesh%Block(1)%Xv,2) =   5
    [Construct_Mesh]:1/2: Remote write
    [Construct_Mesh]:1/2: i=1 size(Mesh%Block) =   1
    [Construct_Mesh]:1/2: i=1 Mesh%Block(1)%Nx           =   2   Mesh%Block(1)%Ny           =   5
    [Construct_Mesh]:1/2: i=1 lbound(Mesh%Block(1)%Xv,1) =   1   lbound(Mesh%Block(1)%Xv,2) =   1
    [Construct_Mesh]:1/2: i=1 ubound(Mesh%Block(1)%Xv,1) =   2   ubound(Mesh%Block(1)%Xv,2) =   5
    [Construct_Mesh]:1/2: i=2 size(Mesh%Block) =   1
    [Construct_Mesh]:1/2: i=2 Mesh%Block(1)%Nx           =   2   Mesh%Block(1)%Ny           =   5
    [Construct_Mesh]:1/2: i=2 lbound(Mesh%Block(1)%Xv,1) =   1   lbound(Mesh%Block(1)%Xv,2) =   1
    [Construct_Mesh]:1/2: i=2 ubound(Mesh%Block(1)%Xv,1) =   2   ubound(Mesh%Block(1)%Xv,2) =   5
    [Construct_Mesh]:1/2: Exiting
  [Main]:1/2: allocated(Mesh%Block) = T
  [Main]:1/2: Allocating Block
  [Main]:1/2: Allocating Xv
  [Main]:1/2: ==========> sync all <==========
  [Main]:1/2: Ending
  [Main]:2/2: Starting
  [Main]:2/2: Calling Construct_Mesh with NBlock=1 Nx=2 Ny=5
    [Construct_Mesh]:2/2: Entering
    [Construct_Mesh]:2/2: allocated(Mesh%Block) = F
    [Construct_Mesh]:2/2: Allocating Block
    [Construct_Mesh]:2/2: Allocating Xv
    [Construct_Mesh]:2/2: ==========> sync all <==========
    [Construct_Mesh]:2/2: Local  write
    [Construct_Mesh]:2/2: size(Mesh%Block) =   1
    [Construct_Mesh]:2/2: Mesh%Block(1)%Nx           =   2   Mesh%Block(1)%Ny           =   5
    [Construct_Mesh]:2/2: lbound(Mesh%Block(1)%Xv,1) =   1   lbound(Mesh%Block(1)%Xv,2) =   1
    [Construct_Mesh]:2/2: ubound(Mesh%Block(1)%Xv,1) =   2   ubound(Mesh%Block(1)%Xv,2) =   5
    [Construct_Mesh]:2/2: Remote write
    [Construct_Mesh]:2/2: i=1 size(Mesh%Block) =   1
    [Construct_Mesh]:2/2: i=1 Mesh%Block(1)%Nx           =   2   Mesh%Block(1)%Ny           =   5
    [Construct_Mesh]:2/2: i=1 lbound(Mesh%Block(1)%Xv,1) =   1   lbound(Mesh%Block(1)%Xv,2) =   1
    [Construct_Mesh]:2/2: i=1 ubound(Mesh%Block(1)%Xv,1) =   2   ubound(Mesh%Block(1)%Xv,2) =   5
    [Construct_Mesh]:2/2: i=2 size(Mesh%Block) =   1
    [Construct_Mesh]:2/2: i=2 Mesh%Block(1)%Nx           =   2   Mesh%Block(1)%Ny           =   5
    [Construct_Mesh]:2/2: i=2 lbound(Mesh%Block(1)%Xv,1) =   1   lbound(Mesh%Block(1)%Xv,2) =   1
    [Construct_Mesh]:2/2: i=2 ubound(Mesh%Block(1)%Xv,1) =   2   ubound(Mesh%Block(1)%Xv,2) =   5
    [Construct_Mesh]:2/2: Exiting
  [Main]:2/2: allocated(Mesh%Block) = T
  [Main]:2/2: Allocating Block
  [Main]:2/2: Allocating Xv
  [Main]:2/2: ==========> sync all <==========
  [Main]:2/2: Ending

Same problem !!!

Any idea what is going wrong here ?

My ifort compiler is:

ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.1.1.163 Build 20130313
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

Thanks

AttachmentSize
Downloadapplication/octet-stream sync-all-error.tar.gz1.34 KB
4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Actually, I was wrong, the "sync all" statement is indeed synchroizing the images.

But I don't understand why the output is written in this order.

For programs running in parallel the order of I/O is determined by the operating system and does not necessarily reflect the order statements were executed.

Good to know !!

Thanks

Leave a Comment

Please sign in to add a comment. Not a member? Join today