Changeset 3724 in Sophya for trunk/AddOn
- Timestamp:
- Dec 29, 2009, 12:34:19 AM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/branap.cc
r3707 r3724 26 26 npaqinzone_=npaqz; 27 27 prtlevel_=0; 28 nthreads_=1; 28 29 } 29 30 … … 70 71 ka+=2; 71 72 } 73 else if (strcmp(arg[ka],"-nthr")==0) { 74 nthreads_=atoi(arg[ka+1]); 75 ka+=2; 76 } 72 77 else if (strcmp(arg[ka],"-in")==0) { 73 78 if ((narg-ka)<4) { … … 108 113 cout << " --- BRAnaParam : Reading/Processing BAORadio FITS files parameters " << endl; 109 114 cout << " Usage: prgname [-act ACT] [-out OutPath] [-nmean NMean] [-zones NZones,nPaqinZone] \n" 110 << " [-nbloc NBloc] [-freq NumFreqMin,NumFreqMax,NBinFreq] [-prtlev lev] \n" 115 << " [-nbloc NBloc] [-freq NumFreqMin,NumFreqMax,NBinFreq] \n" 116 << " [-prtlev lev] [-nthr n] \n" 111 117 << " -in Imin,Imax,Istep InPath FiberList [InPath2 FiberList2 InPath3 FiberList3 ...] \n" << endl; 112 118 if (fgshort) { … … 123 129 << " -freq NumFreqMin,NumFreqMax,NBinFreq : Frequency zone and number of bins \n" 124 130 << " -prtlev lev : Print level (0,1,2...) \n" 131 << " -nthr n : number of threads for parallel execution (default=1) \n" 125 132 << " -in : input files/directory definition : \n" 126 133 << " Imin,Imax,Istep: fits files signalII.fits Imin<=II<=Imax Istep=increment \n" -
trunk/AddOn/TAcq/branap.h
r3705 r3724 38 38 uint_4 npaqinfile_; // nombre de paquets dans un fichier p 39 39 int prtlevel_; 40 uint_4 nthreads_; // Nb de threads pour l'execution parallele 40 41 }; 41 42 -
trunk/AddOn/TAcq/brproc.cc
r3710 r3724 32 32 /* --Methode-- */ 33 33 BRVisibilityCalculator::BRVisibilityCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean, 34 uint_4 freq1, uint_4 freq2, uint_4 nbfreq )35 : BRBaseProcessor(memgr), outpath_(outpath), nmean_(nmean), numfreq1_(freq1), numfreq2_(freq2), nbinfreq_(nbfreq),36 vpdata_(2*memgr.NbFibres())34 uint_4 freq1, uint_4 freq2, uint_4 nbfreq, size_t nthr) 35 : BRBaseProcessor(memgr), paralex_(*this, nthr), nparthr_(nthr), outpath_(outpath), nmean_(nmean), 36 numfreq1_(freq1), numfreq2_(freq2), nbinfreq_(nbfreq), vpdata_(2*memgr.NbFibres()) 37 37 // , dtfos_(outpath+"visdt.fits", Fits_Create), visdt_(dtfos_, 1024, true); 38 38 … … 100 100 } 101 101 delete[] xnt_; 102 } 103 104 /* --Methode-- */ 105 void BRVisibilityCalculator::run() 106 { 107 if (nparthr_ > 1) { 108 paralex_.SetParallelTask(*this); 109 cout << " BRVisibilityCalculator::run()/Info : starting ParallelExecutor with nThreads=" 110 << paralex_.nThreads() << " ... " << endl; 111 paralex_.start(); 112 } 113 return BRBaseProcessor::run(); 102 114 } 103 115 … … 152 164 moyfc_=moytt_=0.; 153 165 } 166 167 if (nparthr_ > 1) { // Execution parallele 168 int rcpex=paralex_.execute(); 169 if (rcpex!=0) cout << " BRVisibilityCalculator::Process() / Error Rc[paralex_.execute()]=" << rcpex << endl; 170 } 171 else { 172 sa_size_t k=0; 173 for(size_t i=0; i<vpdata_.size(); i++) { 174 for(size_t j=i; j<vpdata_.size(); j++) { 175 TVector< complex<r_4> > vis = vismtx_.Row(k); k++; 176 for(sa_size_t f=1; f<vis.Size(); f++) { 177 vis(f) += complex<r_4>((r_4)vpdata_[i][f].realB(), (r_4)vpdata_[i][f].imagB()) * 178 complex<r_4>((r_4)vpdata_[j][f].realB(), -(r_4)vpdata_[j][f].imagB()); 179 } 180 } 181 } 182 } 183 moyfc_ += curfc_[0]; 184 moytt_ += (vpaq_[0].TimeTag()-ttfirst_[0]); 185 if (fgcktt_) CheckTimeTag(); 186 totnbpaq_++; 187 return 0; 188 } 189 190 /* --Methode-- */ 191 int BRVisibilityCalculator::execute(int tid) 192 { 193 sa_size_t fdelt = vismtx_.NCols()/nparthr_; 194 sa_size_t fdeb = tid*fdelt; 195 sa_size_t ffin = (tid+1)*fdelt; 196 if (fdeb<1) fdeb=1; 197 if ((ffin>vismtx_.NCols())||(tid==(nparthr_-1))) ffin=vismtx_.NCols(); 154 198 155 199 sa_size_t k=0; … … 157 201 for(size_t j=i; j<vpdata_.size(); j++) { 158 202 TVector< complex<r_4> > vis = vismtx_.Row(k); k++; 159 for(sa_size_t f= 1; f<vis.Size(); f++) {203 for(sa_size_t f=fdeb; f<ffin; f++) { 160 204 vis(f) += complex<r_4>((r_4)vpdata_[i][f].realB(), (r_4)vpdata_[i][f].imagB()) * 161 205 complex<r_4>((r_4)vpdata_[j][f].realB(), -(r_4)vpdata_[j][f].imagB()); … … 163 207 } 164 208 } 165 166 moyfc_ += curfc_[0];167 moytt_ += (vpaq_[0].TimeTag()-ttfirst_[0]);168 if (fgcktt_) CheckTimeTag();169 totnbpaq_++;170 209 return 0; 171 210 } -
trunk/AddOn/TAcq/brproc.h
r3711 r3724 14 14 #include "racqumem.h" 15 15 #include "brbaseproc.h" 16 #include "parlex.h" 16 17 #include "sopnamsp.h" 17 18 #include "tvector.h" … … 25 26 // Classe de traitement - calcul de visibilite pour n fibres 26 27 //--------------------------------------------------------------------- 27 class BRVisibilityCalculator : public BRBaseProcessor {28 class BRVisibilityCalculator : public BRBaseProcessor, ParallelTaskInterface { 28 29 public: 29 30 BRVisibilityCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean=1000, 30 uint_4 freq1=0, uint_4 freq2=0, uint_4 nbfreq=1 );31 uint_4 freq1=0, uint_4 freq2=0, uint_4 nbfreq=1, size_t nthr=1); 31 32 virtual ~BRVisibilityCalculator(); // Fait le nettoyage final , sauvegarde des objets ... 32 33 34 virtual void run(); 33 35 // Pour activer la verification des timetag 34 36 // Creation / sauvegarde d'une matrice de TimeTag / FrameCounter avec NCols=maxnpaq (nb de paquets/trigger) 35 37 int ActivateTimeTagCheck(uint_8 maxnpaq); 38 39 // Methode de la classe ParallelTaskInterface 40 virtual int execute(int tid); 36 41 37 42 protected: … … 39 44 virtual int FillVisibTable(double fcm, double ttm); 40 45 virtual int CheckTimeTag(); 46 47 ParallelExecutor paralex_; // Pour l'execution en parallele 48 size_t nparthr_; 41 49 42 50 uint_4 nmean_; // Nombre de spectres pour le calcul des moyennes -
trunk/AddOn/TAcq/vismfib.cc
r3705 r3724 62 62 reader.SetPrintLevel(par.prtlevel_); 63 63 64 BRVisibilityCalculator proc(mmgr, par.outpath_, par.nmean_, par.freqmin_, par.freqmax_, par.nbinfreq_); 64 BRVisibilityCalculator proc(mmgr, par.outpath_, par.nmean_, par.freqmin_, par.freqmax_, 65 par.nbinfreq_, par.nthreads_); 65 66 if (par.action_ == "viscktt") proc.ActivateTimeTagCheck(par.TotalNPaquets()); 66 67 FitsCubeWriter wrt(mmgr, par.outpath_, par.nbloc_);
Note:
See TracChangeset
for help on using the changeset viewer.