[Dart-dev] [5625] DART/branches/development/assim_tools/assim_tools_mod.f90: filter kinds 2, 3 and 5 use the random number generator.

nancy at ucar.edu nancy at ucar.edu
Wed Mar 28 11:48:23 MDT 2012


Revision: 5625
Author:   nancy
Date:     2012-03-28 11:48:23 -0600 (Wed, 28 Mar 2012)
Log Message:
-----------
filter kinds 2,3 and 5 use the random number generator.  the original code used the default seed in every MPI task which meant they would be generating identical sequences of random values.  the updated code seeds the random number generator with the task number so different tasks generate unrelated random numbers.

Modified Paths:
--------------
    DART/branches/development/assim_tools/assim_tools_mod.f90

-------------- next part --------------
Modified: DART/branches/development/assim_tools/assim_tools_mod.f90
===================================================================
--- DART/branches/development/assim_tools/assim_tools_mod.f90	2012-03-26 22:53:09 UTC (rev 5624)
+++ DART/branches/development/assim_tools/assim_tools_mod.f90	2012-03-28 17:48:23 UTC (rev 5625)
@@ -1072,11 +1072,18 @@
    new_mean  = obs
 endif
 
-! Now, just form a random sample from the updated distribution
+! This will reproduce exactly for multiple runs with the same task count,
+! but WILL NOT reproduce for a different number of MPI tasks.
+! To make it independent of the number of MPI tasks, it would need to
+! use the global ensemble number or something else that remains constant
+! as the processor count changes.  this is not currently an argument to
+! this function and so we are not trying to make it task-count invariant.
+
+! Form a random sample from the updated distribution
 ! Then adjust the mean (what about adjusting the variance?)!
 ! Definitely need to sort with this; sort is done in main obs_increment
 if(first_inc_ran_call) then
-   call init_random_seq(inc_ran_seq)
+   call init_random_seq(inc_ran_seq, my_task_id() + 1)
    first_inc_ran_call = .false.
 endif
 
@@ -1299,9 +1306,15 @@
 prior_var_inv = 1.0_r8 / prior_var
 new_var       = 1.0_r8 / (prior_var_inv + obs_var_inv)
 
-! If this is first time through, need to initialize the random sequence
+! If this is first time through, need to initialize the random sequence.
+! This will reproduce exactly for multiple runs with the same task count,
+! but WILL NOT reproduce for a different number of MPI tasks.
+! To make it independent of the number of MPI tasks, it would need to
+! use the global ensemble number or something else that remains constant
+! as the processor count changes.  this is not currently an argument to
+! this function and so we are not trying to make it task-count invariant.
 if(first_inc_ran_call) then
-   call init_random_seq(inc_ran_seq)
+   call init_random_seq(inc_ran_seq, my_task_id() + 1)
    first_inc_ran_call = .false.
 endif
 
@@ -1383,9 +1396,15 @@
    cum_frac(i) = cum_weight / total_weight
 end do
 
-! If this is first time through, need to initialize the random sequence
+! If this is first time through, need to initialize the random sequence.
+! This will reproduce exactly for multiple runs with the same task count,
+! but WILL NOT reproduce for a different number of MPI tasks.
+! To make it independent of the number of MPI tasks, it would need to
+! use the global ensemble number or something else that remains constant
+! as the processor count changes.  this is not currently an argument to
+! this function and so we are not trying to make it task-count invariant.
 if(first_inc_ran_call) then
-   call init_random_seq(inc_ran_seq)
+   call init_random_seq(inc_ran_seq, my_task_id() + 1)
    first_inc_ran_call = .false.
 endif
 


More information about the Dart-dev mailing list