Changeset 3613 in Sophya for trunk/SophyaProg
- Timestamp:
- Apr 30, 2009, 7:07:46 PM (16 years ago)
- Location:
- trunk/SophyaProg
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PrgMap/cl2map.cc
r3512 r3613 14 14 #include "fitsspherehealpix.h" 15 15 #include "fitstarray.h" 16 17 #include "randr48.h" 16 18 17 19 /*! … … 115 117 << "' msph= " << msph << ") beam=" << beam*minute2rad << " rad" << endl; 116 118 // on cree la carte 117 RandomGeneratorrg;119 ThSDR48RandGen rg; 118 120 if (fgair) { 119 121 cout << " Setting random number generator seed (using time) " << endl; -
trunk/SophyaProg/Tests/tmtrnd.cc
r3606 r3613 28 28 29 29 #include "srandgen.h" 30 #include "stsrand.h"31 30 #include "randr48.h" 32 31 33 32 34 // Choix du nom de la classe thread-safe a test s33 // Choix du nom de la classe thread-safe a tester 35 34 #define TC_RandomGenerator ThSDR48RandGen 36 35 -
trunk/SophyaProg/Tests/tmtrnd3.cc
r3390 r3613 17 17 #include "timing.h" 18 18 19 #include " stsrand.h"19 #include "randr48.h" 20 20 21 21 long Check_Redondances(TVector<r_8>& v); … … 55 55 cout<<"MTRndTest::run() - Nom= "<<nom_<<" vv.Size()= "<<vv_.Size() 56 56 <<" with threadsafe="<<thsafe_<<endl; 57 if(thsafe_) { // On appele RandomGeneratorThread-Safe58 RandomGeneratorrgen(nbuff_,true);57 if(thsafe_) { // On appele ThSDR48RandGen Thread-Safe 58 ThSDR48RandGen rgen(nbuff_,true); 59 59 for(sa_size_t k=0; k<vv_.Size(); k++) vv_(k) = rgen.Flat01(); 60 } else { // On appele RandomGeneratorNO Thread-Safe60 } else { // On appele ThSDR48RandGen NO Thread-Safe 61 61 // ATTENTION: le comportement est different selon qu'un thread 62 62 // se termine avant ou apres que le suivant commence: … … 65 65 // cela donne un comportement "tread_safe" APPARENT mais 66 66 // dans la realite drand48() N'EST PAS thread_safe !!!! 67 RandomGeneratorrgen(0,false);67 ThSDR48RandGen rgen(0,false); 68 68 for(sa_size_t k=0; k<vv_.Size(); k++) vv_(k) = rgen.Flat01(); 69 69 } … … 83 83 if(NTH<=0) NTH = 1; 84 84 cout<<"tmtrnd/arguments, VSZ= "<<VSZ<<" NTH= "<<NTH<<" NBUFF="<<NBUFF<<endl; 85 // Il ne faut pas que les buffers de RandomGeneratorsoient remplis85 // Il ne faut pas que les buffers de ThSDR48RandGen soient remplis 86 86 // au dela de ce qui est necessaire si on veut faire 87 87 // la comparaison avec le mono thread … … 100 100 //--- Init et set de l'aleatoire 101 101 //--- 102 RandomGeneratorrgen_nothsf(0,false);102 ThSDR48RandGen rgen_nothsf(0,false); 103 103 unsigned short seed_16v[3]; 104 104 { 105 105 cout<<"\n>>>>>>> Init de l'aleatoire"<<endl; 106 106 rgen_nothsf.AutoInit(5); 107 rgen_nothsf.GetSeed(seed_16v ,5);107 rgen_nothsf.GetSeed(seed_16v); 108 108 } 109 109 … … 116 116 { 117 117 cout<<"\n>>>>>>> Remplissage en mono-thread avec drand48()"<<endl; 118 rgen_nothsf. Init(seed_16v,5);118 rgen_nothsf.SetSeed(seed_16v); 119 119 for(int i=0;i<VSZ;i++) DATA0(i) = drand48(); 120 120 PrtTim(" "); … … 122 122 123 123 //--- 124 //--- Remplissage par threads avec RandomGeneratorthread safe124 //--- Remplissage par threads avec ThSDR48RandGen thread safe 125 125 //--- 126 126 TVector<r_8> DATA1(VSZ); 127 127 { 128 cout<<"\n>>>>>>> Remplissage par threads avec RandomGeneratorthread 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); 130 130 vector<MTRndTest *> vth1; 131 131 cout<<"...tmtrnd/creating threads "<<endl; … … 147 147 148 148 //--- 149 //--- Remplissage par threads avec RandomGeneratorSANS thread safe149 //--- Remplissage par threads avec ThSDR48RandGen SANS thread safe 150 150 //--- 151 151 TVector<r_8> DATA2(VSZ); 152 152 { 153 cout<<"\n>>>>>>> Remplissage par threads avec RandomGeneratorSANS 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); 155 155 vector<MTRndTest *> vth2; 156 156 cout << "......tmtrnd/creating threads " << endl; … … 172 172 173 173 //--- 174 //--- remplissage en mono-thread avec RandomGenerator174 //--- remplissage en mono-thread avec ThSDR48RandGen 175 175 //--- 176 176 TVector<r_8> DATA0R(VSZ); 177 177 { 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); 180 180 for(int i=0;i<VSZ;i++) DATA0R(i) = rgen_nothsf.Flat01(); 181 181 PrtTim(" ");
Note:
See TracChangeset
for help on using the changeset viewer.