Re: [arts-users] Is this a bug in ARTS

2018-10-26 Thread Oliver Lemke
Hi Alfred,

The "Rng_seed" is just a name that identifies the critical region. The pragma 
ensures that only one thread at a time enters critical regions with the same 
name. I don't see how that change could have any effect on your error.

Cheers,
Oliver


> On 26 Oct 2018, at 07:02, Alfred Xu  wrote:
> 
> Hello,everyone.
> when i used open-mp for ARTS, an error occurred because of error use of 
> vector. I traced the problem and found that Rng_seed has no definition.
> I changed Rng_seed to seeds (see code below)and got it work. So, I'd like to 
> know is this a bug in ARTS.
> 
> Thank you!
> Alfred xu
> 
> /*!
>  Seeds the Rng with the integer argument. 
> 
>  Every seed is only used once. The provided seed is increased by 1 until an
>  unused seed is found.
> */
> void Rng::seed(unsigned long int n, const Verbosity& verbosity)
> {
>   // Static pool of previously used seeds.
>   static vector seeds;
> 
> #pragma omp critical (Rng_seed)
>   {
> unsigned long int n_orig = n;
> //cout << "Requested seed: " << n;
> while (find(seeds.begin(), seeds.end(), n) != seeds.end())
> {
>   if (n >= ULONG_MAX - 1)
> n=0;
>   else
> n++;
>   
>   // If all possible seeds were already used, we empty the pool and
>   // start over.
>   if (n == n_orig)
>   {
> CREATE_OUT0;
> out0 << "Rng Warning: Couldn't find an unused seed. Clearing seed 
> pool.\n";
> seeds.empty();
> break;
>   }
> }
> seeds.push_back(n);
> seed_no=n;
> //cout << " Got seed: " << seed_no << endl;
>   }
>   
>   gsl_rng_set(r,seed_no);
> }
> ___
> arts_users.mi mailing list
> arts_users.mi@lists.uni-hamburg.de
> https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi

___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi


[arts-users] Is this a bug in ARTS

2018-10-25 Thread Alfred Xu
Hello,everyone.
when i used open-mp for ARTS, an error occurred because of error use of vector. 
I traced the problem and found that Rng_seed has no definition.
I changed Rng_seed to seeds (see code below)and got it work. So, I'd like to 
know is this a bug in ARTS.


Thank you!
Alfred xu


/*!
 Seeds the Rng with the integer argument. 

 Every seed is only used once. The provided seed is increased by 1 until an
 unused seed is found.
*/
void Rng::seed(unsigned long int n, const Verbosity& verbosity)
{
  // Static pool of previously used seeds.
  static vector seeds;

#pragma omp critical (Rng_seed)
  {
unsigned long int n_orig = n;
//cout << "Requested seed: " << n;
while (find(seeds.begin(), seeds.end(), n) != seeds.end())
{
  if (n >= ULONG_MAX - 1)
n=0;
  else
n++;
  
  // If all possible seeds were already used, we empty the pool and
  // start over.
  if (n == n_orig)
  {
CREATE_OUT0;
out0 << "Rng Warning: Couldn't find an unused seed. Clearing seed 
pool.\n";
seeds.empty();
break;
  }
}
seeds.push_back(n);
seed_no=n;
//cout << " Got seed: " << seed_no << endl;
  }
  
  gsl_rng_set(r,seed_no);
}___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi