Changeset 3613 in Sophya for trunk/SophyaProg


Ignore:
Timestamp:
Apr 30, 2009, 7:07:46 PM (16 years ago)
Author:
ansari
Message:

Adaptation a l'introduction de la suite des classes RandomGeneratorInterface et Cie , Reza 30/04/2009

Location:
trunk/SophyaProg
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/PrgMap/cl2map.cc

    r3512 r3613  
    1414#include "fitsspherehealpix.h"
    1515#include "fitstarray.h"
     16
     17#include "randr48.h"
    1618
    1719/*!
     
    115117       << "' msph= " << msph << ") beam=" << beam*minute2rad << " rad" << endl;
    116118  // on cree la carte
    117   RandomGenerator rg;
     119  ThSDR48RandGen rg;
    118120  if (fgair) {
    119121    cout << " Setting random number generator seed (using time) " << endl;
  • trunk/SophyaProg/Tests/tmtrnd.cc

    r3606 r3613  
    2828
    2929#include "srandgen.h"
    30 #include "stsrand.h"
    3130#include "randr48.h"
    3231
    3332
    34 // Choix du nom de la classe thread-safe a tests
     33// Choix du nom de la classe thread-safe a tester
    3534#define TC_RandomGenerator ThSDR48RandGen
    3635
  • trunk/SophyaProg/Tests/tmtrnd3.cc

    r3390 r3613  
    1717#include "timing.h"
    1818
    19 #include "stsrand.h"
     19#include "randr48.h"
    2020
    2121long Check_Redondances(TVector<r_8>& v);
     
    5555  cout<<"MTRndTest::run() - Nom= "<<nom_<<" vv.Size()= "<<vv_.Size()
    5656      <<" with threadsafe="<<thsafe_<<endl;
    57   if(thsafe_) {  // On appele RandomGenerator Thread-Safe
    58     RandomGenerator rgen(nbuff_,true);
     57  if(thsafe_) {  // On appele ThSDR48RandGen Thread-Safe
     58    ThSDR48RandGen rgen(nbuff_,true);
    5959    for(sa_size_t k=0; k<vv_.Size(); k++) vv_(k) = rgen.Flat01();
    60   } else {  // On appele RandomGenerator NO Thread-Safe
     60  } else {  // On appele ThSDR48RandGen NO Thread-Safe
    6161    // ATTENTION: le comportement est different selon qu'un thread
    6262    // se termine avant ou apres que le suivant commence:
     
    6565    // cela donne un comportement "tread_safe" APPARENT mais
    6666    // dans la realite drand48() N'EST PAS thread_safe !!!!
    67     RandomGenerator rgen(0,false);
     67    ThSDR48RandGen rgen(0,false);
    6868    for(sa_size_t k=0; k<vv_.Size(); k++) vv_(k) = rgen.Flat01();
    6969  }
     
    8383  if(NTH<=0) NTH = 1;
    8484  cout<<"tmtrnd/arguments, VSZ= "<<VSZ<<" NTH= "<<NTH<<" NBUFF="<<NBUFF<<endl;
    85   // Il ne faut pas que les buffers de RandomGenerator soient remplis
     85  // Il ne faut pas que les buffers de ThSDR48RandGen soient remplis
    8686  // au dela de ce qui est necessaire si on veut faire
    8787  // la comparaison avec le mono thread
     
    100100    //--- Init et set de l'aleatoire
    101101    //---
    102     RandomGenerator rgen_nothsf(0,false);
     102    ThSDR48RandGen rgen_nothsf(0,false);
    103103    unsigned short seed_16v[3];
    104104    {
    105105    cout<<"\n>>>>>>> Init de l'aleatoire"<<endl;
    106106    rgen_nothsf.AutoInit(5);
    107     rgen_nothsf.GetSeed(seed_16v,5);
     107    rgen_nothsf.GetSeed(seed_16v);
    108108    }
    109109
     
    116116    {
    117117    cout<<"\n>>>>>>> Remplissage en mono-thread avec drand48()"<<endl;
    118     rgen_nothsf.Init(seed_16v,5);
     118    rgen_nothsf.SetSeed(seed_16v);
    119119    for(int i=0;i<VSZ;i++) DATA0(i) = drand48();
    120120    PrtTim(" ");
     
    122122
    123123    //---
    124     //--- Remplissage par threads avec RandomGenerator thread safe
     124    //--- Remplissage par threads avec ThSDR48RandGen thread safe
    125125    //---
    126126    TVector<r_8> DATA1(VSZ);
    127127    {
    128     cout<<"\n>>>>>>> Remplissage par threads avec RandomGenerator thread safe"<<endl;
    129     rgen_nothsf.Init(seed_16v,5);
     128    cout<<"\n>>>>>>> Remplissage par threads avec ThSDR48RandGen thread safe"<<endl;
     129    rgen_nothsf.SetSeed(seed_16v);
    130130    vector<MTRndTest *> vth1;
    131131    cout<<"...tmtrnd/creating threads "<<endl;
     
    147147
    148148    //---
    149     //--- Remplissage par threads avec RandomGenerator SANS thread safe
     149    //--- Remplissage par threads avec ThSDR48RandGen SANS thread safe
    150150    //---
    151151    TVector<r_8> DATA2(VSZ);
    152152    {
    153     cout<<"\n>>>>>>> Remplissage par threads avec RandomGenerator SANS thread safe"<<endl;
    154     rgen_nothsf.Init(seed_16v,5);
     153    cout<<"\n>>>>>>> Remplissage par threads avec ThSDR48RandGen SANS thread safe"<<endl;
     154    rgen_nothsf.SetSeed(seed_16v);
    155155    vector<MTRndTest *> vth2;
    156156    cout << "......tmtrnd/creating threads " << endl;
     
    172172
    173173    //---
    174     //--- remplissage en mono-thread avec RandomGenerator
     174    //--- remplissage en mono-thread avec ThSDR48RandGen
    175175    //---
    176176    TVector<r_8> DATA0R(VSZ);
    177177    {
    178     cout<<"\n>>>>>>> Remplissage en mono-thread avec RandomGenerator"<<endl;
    179     rgen_nothsf.Init(seed_16v,5);
     178    cout<<"\n>>>>>>> Remplissage en mono-thread avec ThSDR48RandGen"<<endl;
     179    rgen_nothsf.SetSeed(seed_16v);
    180180    for(int i=0;i<VSZ;i++) DATA0R(i) = rgen_nothsf.Flat01();
    181181    PrtTim(" ");
Note: See TracChangeset for help on using the changeset viewer.