This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Implementation of RANDOM_INIT from F2018


Hi Steve,

Here are the results of compiling with the OpenCoarrays “caf” compiler wrapper, which uses -fcoarray=lib -lcaf_mpi:

1. random_init(repeatable=.true., image_distinct=.true.) gives repeatable sequences that are distinct on each image.
2. random_init(.true., .false.) gives repeatable sequences that are identical on all images.
3. random_init(.false.,.true.) gives non-repeatable sequences that are distinct on each image.
4. random_init(.false.,.false.) gives non-repeatable sequences that are distinct on each image.

The behavior with test 2 differs from the description in the email below. I hope this is helpful.  I can provide the raw output if so desired. 

In case it’s of interest, there’s a script in OpenCoarrays that checks out the trunk, applies a provided patch to it, and then does a non-bootstrap build of the patched trunk, MPICH, and OpenCoarrays.  These were my steps:

git clone https://github.com/sourceryinstitute/opencoarrays
cd opencoarrays
./developer-scripts/patched-trunk-instal.sh random_init.diff
source prerequisites/installations/setup.sh
caf repeatable-distinct.f90
cafrun -n 4 ./a.out

If you decide to try this, please let me know.  I can edit the above script to give an option for multithreaded builds to speed things up quite a bit.

Damian


On January 8, 2018 at 6:03:26 PM, Steve Kargl (sgk@troutmask.apl.washington.edu) wrote:

On Mon, Jan 08, 2018 at 05:33:01PM -0800, Damian Rouson wrote:  
> I’ll be glad to test with -fcoarray=lib -lcaf_mpi with two caveats:  
>  
> 1. My turnaround time will probably usually be 48-72 hours for  
> such tests.  

Turn around time is unimportant to me. I'm simply interested if  
what I have done work or if I need to fix a bug.  

> 2. I don’t monitor this mailing list very closely so I might miss  
> similar requests unless they are also submitted as issues on the  
> OpenCoarrays GitHub repository.  

That's understandable. There is only so much time in a day.  

> For clarification, are you asking for simple execution of the  
> existing tests or do you suspect that the tests might need  
> modification (or new tests) to exercise the -fcoarray=lib option?  

Hopefully, this clarifies the situation. Suppose, you have a co-array  
program that causes execution of 2 images, say, image0 and image1.  
If the program contains  

call random_init(repeatable=.true., image_distinct=.true.)  

then image0 and image1 will have distinct PRNG sequences. Now, if you  
re-run the program, then image0 and image1 will have the same distinct  
sequences. If you have  

call  random_init(.true., .false.) 

image0 and image1 do not need to have distinct PRNG sequences, but  
I set up gfortran to have distinct sequences. If you re-run the  
program image0 and image1 should have the same sequences. Finally,  
if you have  

call random_init(.false.,.true.)  

image0 and image1 will have distinct sequence, and if you re-run the  
program image and image1 will should have different sequence than  
what was seen in the previous and these are distinct.  

There is one final detail, the standard says that calling random_init  
in one image cannot affect the PRNG sequence in another image if  
image_distinct=.false.  

--  
Steve  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]