I was trying out the example from page 20 of Milan Curcic’s book “Modern Fortran”
program array_copy_caf
implicit none
integer :: array(5)[*]=0
integer,parameter :: sender=1, reciever=2
if (num_images() /= 2) &
stop 'Error, this process must run on two parallel processes'
if (this_image() == sender) array = [1,2,3,4,5]
print '(a,i2,a,5(4x,i2))','array on proc',this_image(), &
'before copy: ',array
sync all
if (this_image() == reciever) &
array(:) = array(:)[sender]
print '(a,i2,a,5(4x,i2))','array on proc',this_image(), &
'after copy: ',array
end program array_copy_caf
And I get this error
[agnelo@fedora fortran experiment]$ caf array_copy_caf.f90 -o array_copy_caf
[agnelo@fedora fortran experiment]$ cafrun -n 6 ./array_copy_caf
STOP Error, this process must ruSTOP Error, this process must run on two parallel processes
STOP Error, this process must run on two parallel processes
STOP Error, this process must run on two parallel processes
STOP Error, this process must run on two parallel processes
application called MPI_Abort(MPI_COMM_WORLD, 0) - process 4
STOP Error, this process must run on two parallel processes
The output I am supposed to get is this :
array on proc 1 before copy: 1 2 3 4 5
array on proc 2 before copy: 0 0 0 0 0
array on proc 1 after copy: 1 2 3 4 5
array on proc 2 after copy: 1 2 3 4 5
Does anyone know what went wrong ?
Thanks in advance