Changeset 3895 in Sophya for trunk/AddOn


Ignore:
Timestamp:
Sep 28, 2010, 8:15:29 PM (15 years ago)
Author:
ansari
Message:

correction bugs divers ds calcul visibilites avec plusieurs threads en execution parallele et amelioration prints, Reza 28/09/2010

Location:
trunk/AddOn/TAcq
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/brviscalc.cc

    r3893 r3895  
    6969{
    7070  if (totnbpaq_<1)   return;
    71   cout << " BRVisibilityCalculator - Visibility Datatable : " << endl;
     71  cout << " ~BRVisibilityCalculator - Visibility Datatable : " << endl;
    7272  cout << visdt_;
    7373 
     
    7676  if (nbcalc_>1) {
    7777    char sbuff[32];
    78     sprintf(sbuff,"visdt_%d",(int)calcid_);
     78    sprintf(sbuff,"visdt_%d.ppf",(int)calcid_);
    7979    filename = outpath_+sbuff;
    8080  }
     
    230230          POutPersist po(flnm);
    231231          po << vismtx_;
    232           cout << numfile_ << "-BRVisibilityCalculator[" << calcid_ << "]::run() NPaqProc="
    233                << totnbpaq_ << "  -> Visibility Matrix in " << flnm << endl;
     232          cout << numfile_ << "-BRVisCalc[" << calcid_ << "/" << nbcalc_ << "]::run() NPaqProc="
     233               << totnbpaq_ << " TotMegaFLOP=" << (uint_8)TotNbMegaFLOP() << " -> VisibMtx in " << flnm << endl;
     234
    234235          FillVisibTable(moyfc_, moytt_);
    235236          numfile_++;
     
    237238        vismtx_ = complex<r_4>((r_4)0.,(r_4)0.);
    238239        moyfc_=moytt_=0.;
    239         first_fc_=curfc_[0];
    240         first_tt_= (vpaq_[0].TimeTag()-ttfirst_[0]);
    241240        first_tmstamp_.SetNow();  // Current date and time
    242241      }
     
    260259          moytt_ += (vpaq_[0].TimeTag()-ttfirst_[0]);
    261260          if ((fgcktt_)&&(calcid_==0))  CheckTimeTag();
     261          if (totnbpaq_%nmean_ == 0) {
     262            first_fc_=curfc_[0];
     263            first_tt_= (vpaq_[0].TimeTag()-ttfirst_[0]);
     264          }
    262265          totnbpaq_++;
    263266        }
    264267      }  // Fin de boucle sur les paquets
    265      
     268
    266269      // Execution parallele  pour calcul des visibilites par bandes de frequence
    267270      int rcpex=paralex_.execute();
     
    314317      POutPersist po(flnm);
    315318      po << vismtx_;
    316       cout << numfile_ << "-BRVisibilityCalculator::Process() NPaqProc="
    317            << totnbpaq_ << "  -> Visibility Matrix in " << flnm << endl;
     319      cout << numfile_ << "-BRVisCalc[" << calcid_ << "/" << nbcalc_ << "]::Process() NPaqProc="
     320           << totnbpaq_ << " TotMegaFLOP=" << (uint_8)TotNbMegaFLOP() << " -> VisibMtx in " << flnm << endl;
    318321      FillVisibTable(moyfc_, moytt_);
    319322      numfile_++;
     
    327330
    328331// kpair=numero sequentiel de la paire: 0->(0,0), 1->(0,1), 2->(0,2), 3->(0,3), 4->(1,1), 5->(1,2) ...
    329   sa_size_t kpair=0; 
     332  sa_size_t kpair=0;
     333  sa_size_t k=0;     // numero de ligne dans la matrice des visibilites
    330334  for(size_t i=0; i<vpdata_.size(); i++) {
    331335    for(size_t j=i; j<vpdata_.size(); j++) {
    332       if (kpair<pairst_)  continue;
    333       if (kpair>=(pairst_+nbpairs_))  break;
    334       TVector< complex<r_4> > vis = vismtx_.Row(kpair);   
     336      kpair++;
     337      if (kpair<(pairst_+1))  continue;
     338      if (kpair>=(pairst_+nbpairs_+1))  break;
     339      TVector< complex<r_4> > vis = vismtx_.Row(k);  k++;   
    335340      for(sa_size_t f=1; f<vis.Size(); f++) {
    336341        vis(f) += complex<r_4>((r_4)vpdata_[i][f].realB(), (r_4)vpdata_[i][f].imagB()) *
    337342          complex<r_4>((r_4)vpdata_[j][f].realB(), -(r_4)vpdata_[j][f].imagB());
    338343      }
    339       kpair++;
    340       nb_flop_ += (7.*(r_8)vis.Size());
     344      nb_flop_ += (8.*(r_8)(vis.Size()-1));
    341345    }
    342346  }
     
    385389  size_t paqsz=memgr_.PaqSize();
    386390  BRPaquet ppaq(paqsz);
     391
    387392
    388393  sa_size_t fdelt = vismtx_.NCols()/nparthr_;
     
    400405      pvpdata[2*fib+1] = ppaq.Data2C();
    401406    }
     407
     408
    402409// kpair=numero sequentiel de la paire: 0->(0,0), 1->(0,1), 2->(0,2), 3->(0,3), 4->(1,1), 5->(1,2) ...
    403     sa_size_t kpair=0; 
     410    sa_size_t kpair=0;
     411    sa_size_t k=0;     // numero de ligne dans la matrice des visibilites
    404412    for(size_t i=0; i<vpdata_.size(); i++) {
    405413      for(size_t j=i; j<vpdata_.size(); j++) {
    406         size_t kpair=i*vpdata_.size()+j;
    407         if (kpair<pairst_)  continue;
    408         if (kpair>=(pairst_+nbpairs_))  break;
    409         TVector< complex<r_4> > vis = vismtx_.Row(kpair)
     414        kpair++;
     415        if (kpair<(pairst_+1))  continue;
     416        if (kpair>=(pairst_+nbpairs_+1))  break;
     417        TVector< complex<r_4> > vis = vismtx_.Row(k);  k++
    410418        for(sa_size_t f=fdeb; f<ffin; f++) {
    411419          vis(f) += complex<r_4>((r_4)pvpdata[i][f].realB(), (r_4)pvpdata[i][f].imagB()) *
    412420            complex<r_4>((r_4)pvpdata[j][f].realB(), -(r_4)pvpdata[j][f].imagB());
    413421        }
    414         kpair++;
    415         nb_flop_ += (7.*(r_8)(ffin-fdeb));
     422        nb_flop_ += (8.*(r_8)(ffin-fdeb));
    416423      }
    417424    }
     
    539546  for(size_t i=0; i<viscalcp_.size(); i++) {
    540547    viscalcp_[i]->join();
     548    //    cout << " BRVisCalcGroup::join()/ VisibCalc[" << i << "]->TotNbMegaFLOP()="
     549    //   << viscalcp_[i]->TotNbFLOP()/1024e3 << endl;
    541550    totflop += viscalcp_[i]->TotNbFLOP();
    542551  }
    543552  tm_.SplitQ();
    544553  cout << "      ----------------------------------------------------------" << endl;
    545   cout << " BRVisCalcGroup::join() : Finished , Elaspsed time: " << tm_.PartialElapsedTimems()
    546        << " ms (total:" << tm_.TotalElapsedTimems() << ")" << endl;
     554  cout << " BRVisCalcGroup::join() : Finished " << viscalcp_.size() << " VisibilityCalculator(s)" << endl;
     555  cout << " ... Elaspsed time: " << tm_.PartialElapsedTimems()
     556       << " ms (total:" << tm_.TotalElapsedTimems() << ")"  << endl;
     557  double mflopsrate=totflop/(r_8)tm_.PartialElapsedTimems()/(1024.);
    547558  cout << " ... TotalMegaFLOP= " << totflop/(1024.e3) << " @ "
    548        << totflop/(r_8)tm_.PartialElapsedTimems()/(1024) << " MFLOP/s" << endl;
     559       << mflopsrate << " MFLOP/s" << " (=" << mflopsrate/(r_8)viscalcp_.size() << "/VisibCalcObject)" << endl;
    549560  cout << "      ----------------------------------------------------------" << endl;
    550561  return;
  • trunk/AddOn/TAcq/brviscalc.h

    r3893 r3895  
    5959  // Le nombre total d'operations effectuees
    6060  inline r_8 TotNbFLOP() { return nb_flop_; }
     61  inline r_8 TotNbMegaFLOP() { return nb_flop_/(1024.e3); }
    6162
    6263protected:
  • trunk/AddOn/TAcq/vismfib.cc

    r3894 r3895  
    5050    if (rc) return rc;
    5151    par.Print(cout);
    52 
     52    if ((par.action_!="cube3d")&&(par.action_!="vis")&&(par.action_!="viscktt")) {
     53      cout << " !!! visimfib.cc  BAD action = " << par.action_ << " possible values: vis,viscktt,cube3d" << endl;
     54      return 5;
     55    }   
    5356
    5457    cout << " ---------- visimfib.cc Start - Action= " << par.action_ << " ------------- " << endl;
     
    8285
    8386    if (par.action_ == "viscktt")  procg.ActivateTimeTagCheck(par.TotalNPaquets());
    84     BRMeanSpecCalculator procms(mmgr, par.outpath_, par.nmean_);
    8587
    8688    FitsCubeWriter wrt(mmgr, par.outpath_, par.nbloc_);
     
    9092    reader.start();
    9193    if (par.action_ == "cube3d")   wrt.start();
    92     else if (par.action_ == "mspec")   procms.start();
    9394    else  procg.start();
    9495    usleep(200000);
    9596    reader.join();
    9697    if (par.action_ == "cube3d")  wrt.join();
    97     else if (par.action_ == "mspec")  procms.join();
    9898    else procg.join();
    9999    mmgr.Print(cout);
Note: See TracChangeset for help on using the changeset viewer.