Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

gfortran - fortran coarray image access not working properly?

Working with a simple gfortran coarray program.

For some reason accessing images of a variable from the root process (e.g. a[2]) doesn't work.

Am I accessing these images correctly? Is it possible I have compiled the coarray library incorrectly?

coarray.f90

program coarraytest
    implicit none
    integer, codimension[*]:: a
    integer:: tot
    if(this_image()==1) then
     a=10
    endif
    if(this_image()==2) then
     a=20
    endif
    sync all                    ! synchronize
    if(this_image()==1) then
    tot=a+a[2]
     print *, a, a[2], tot
    end if
sync all
print *, this_image(), ': ', a
end program

Output

  10           0   682453724
   1 :           10
   2 :           20

Notes

system:

Ubuntu Linux 20.04

gfortran

OpenMPI (OpenRTE) 4.0.3

Compilation:

caf coarray.f90 -o coarray.o

Execution:

cafrun -n 2 coarraytest.o

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ok, looks like it was a band install. I followed this link first: https://askubuntu.com/questions/1277932/cannot-install-open-coarrays-bin-for-gfortran-on-ubuntu-20-04

Which is outdated. Had to uninstall all that junk and follow the following link:

https://github.com/sourceryinstitute/OpenCoarrays/blob/master/INSTALL.md#linux


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...