Merge branch '202_MPI-random-seed' into 'development'

avoid repeated random sequences on different processes

Closes #202

See merge request damask/DAMASK!639
This commit is contained in:
Daniel Otto de Mentock 2022-10-31 11:29:50 +00:00
commit a1b91e5fcf
2 changed files with 12 additions and 5 deletions

View File

@ -10,8 +10,17 @@ module math
use IO use IO
use config use config
use YAML_types use YAML_types
use parallelization
use LAPACK_interface use LAPACK_interface
#ifdef PETSC
#include <petsc/finclude/petscsys.h>
use PETScSys
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY)
use MPI_f08
#endif
#endif
implicit none(type,external) implicit none(type,external)
public public
#if __INTEL_COMPILER >= 1900 #if __INTEL_COMPILER >= 1900
@ -105,7 +114,7 @@ subroutine math_init()
call random_seed(get = seed) call random_seed(get = seed)
end if end if
call random_seed(put = seed) call random_seed(put = seed + worldrank*42_MPI_INTEGER_KIND)
call random_number(randTest) call random_number(randTest)
print'(/,a,i2)', ' size of random seed: ', randSize print'(/,a,i2)', ' size of random seed: ', randSize

View File

@ -27,15 +27,13 @@ module parallelization
#ifndef PETSC #ifndef PETSC
integer, parameter, public :: & integer, parameter, public :: &
MPI_INTEGER_KIND = pI64 MPI_INTEGER_KIND = pI64 !< needed for MSC.Marc
integer(MPI_INTEGER_KIND), parameter, public :: & integer(MPI_INTEGER_KIND), parameter, public :: &
worldrank = 0_MPI_INTEGER_KIND, & !< MPI dummy worldrank
worldsize = 1_MPI_INTEGER_KIND !< MPI dummy worldsize
#else #else
integer(MPI_INTEGER_KIND), protected, public :: & integer(MPI_INTEGER_KIND), protected, public :: &
#endif
worldrank = 0_MPI_INTEGER_KIND, & !< MPI worldrank (/=0 for MPI simulations only) worldrank = 0_MPI_INTEGER_KIND, & !< MPI worldrank (/=0 for MPI simulations only)
worldsize = 1_MPI_INTEGER_KIND !< MPI worldsize (/=1 for MPI simulations only) worldsize = 1_MPI_INTEGER_KIND !< MPI worldsize (/=1 for MPI simulations only)
#endif
#ifndef PETSC #ifndef PETSC
public :: parallelization_bcast_str public :: parallelization_bcast_str