vmagnin / exploring_coarrays

Let's explore the modern Fortran features for parallel programming (coarrays, images, collective subroutines...)
MIT License
12 stars 2 forks source link

On PRNG seeding #4

Open christophe-pouzat opened 1 week ago

christophe-pouzat commented 1 week ago

Hi, Thanks for these very useful examples. Just a remark on the seeding of the PRNG. instead of:

 ! Each image will have its own RNG seed:
 call rng%seed([ -1337_i8, 9812374_i8 ] + 10*this_image())

I would suggest something like:

call rng%seed([ -1337_i8, 9812374_i8 ])
if (this_image() /= 1) then
  do i = 2, this_image()
    call rng%jump()
  end do
end if

The PRNG sequences on the different images are then guaranteed not to overlap.

Best,

Christophe

vmagnin commented 1 week ago

Thanks Christophe,

I will integrate your remark, not the next week but rather at the beginning of July when I have some time for looking into that project.

Best, Vincent