Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
450 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...