[3695] | 1 | // Utilisation de SOPHYA pour faciliter les tests ...
|
---|
| 2 | #include "sopnamsp.h"
|
---|
| 3 | #include "machdefs.h"
|
---|
| 4 |
|
---|
| 5 | /* ----------------------------------------------------------
|
---|
| 6 | Programme de lecture / calcul de visibilite multi-canaux
|
---|
| 7 | BAORadio - LAL/IRFU R. Ansari, C. Magneville
|
---|
| 8 | V1 : Nov 2009
|
---|
| 9 | ---------------------------------------------------------- */
|
---|
| 10 |
|
---|
| 11 | // include standard c/c++
|
---|
| 12 | #include <iostream>
|
---|
| 13 | #include <string>
|
---|
| 14 | #include <exception>
|
---|
| 15 |
|
---|
| 16 | // include sophya mesure ressource CPU/memoire ...
|
---|
| 17 | #include "resusage.h"
|
---|
| 18 | #include "ctimer.h"
|
---|
| 19 | #include "timing.h"
|
---|
| 20 | #include "timestamp.h"
|
---|
| 21 | #include "strutilxx.h"
|
---|
| 22 | #include "tarrinit.h"
|
---|
| 23 | #include "histinit.h"
|
---|
| 24 |
|
---|
| 25 | #include "brpaqu.h"
|
---|
| 26 | #include "brfitsrd.h"
|
---|
| 27 | #include "brproc.h"
|
---|
[3872] | 28 | #include "brviscalc.h"
|
---|
[3695] | 29 | #include "brdiskw.h"
|
---|
| 30 |
|
---|
| 31 | #include "branap.h"
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | //----------------------------------------------------
|
---|
| 36 | //----------------------------------------------------
|
---|
| 37 | int main(int narg, char* arg[])
|
---|
| 38 | {
|
---|
| 39 |
|
---|
| 40 | TArrayInitiator _inia;
|
---|
| 41 |
|
---|
| 42 | int rc = 0;
|
---|
| 43 | try {
|
---|
| 44 | // Decodage parametres
|
---|
| 45 | BRAnaParam par;
|
---|
[3872] | 46 | cout << " ===> visimfib.cc: decoding command line arguments " << endl;
|
---|
[3695] | 47 | rc = par.DecodeArgs(narg, arg);
|
---|
| 48 | if (rc) return rc;
|
---|
| 49 | rc = par.PaqSizeFromFits();
|
---|
| 50 | if (rc) return rc;
|
---|
| 51 | par.Print(cout);
|
---|
[3895] | 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 | }
|
---|
[3695] | 56 |
|
---|
| 57 | cout << " ---------- visimfib.cc Start - Action= " << par.action_ << " ------------- " << endl;
|
---|
| 58 | ResourceUsage resu;
|
---|
| 59 |
|
---|
[3956] | 60 | BRPaquet paq(par.paqsize_);
|
---|
| 61 | uint_4 procsz=sizeof(float)*(paq.DataSize()+4);
|
---|
| 62 | if ((par.fgdatafft_)||(par.action_=="cube3d")) procsz = 0;
|
---|
| 63 | cout << " visimfib: Creating MemZoneMgr/processing threads - PaqSz= " << par.paqsize_
|
---|
| 64 | << " ProcPaqSz=" << procsz << endl;
|
---|
[3695] | 65 |
|
---|
[3956] | 66 | RAcqMemZoneMgr mmgr(par.nzones_, par.dirlist_.size(), par.npaqinzone_, par.paqsize_, procsz);
|
---|
| 67 |
|
---|
[3894] | 68 | BRMultiFitsReader reader(mmgr, par.dirlist_, par.rdsamefc_, par.imin_, par.imax_, par.istep_);
|
---|
[3893] | 69 | reader.SetPrintLevel(par.prtlevel_,par.prtmodulo_);
|
---|
[3695] | 70 |
|
---|
[3776] | 71 | /* BRVisibilityCalculator proc(mmgr, par.outpath_, par.nmean_, par.nthreads_);
|
---|
| 72 | proc.SelectFreqBinning(par.freqmin_, par.freqmax_, par.nbinfreq_); */
|
---|
[3957] | 73 | BRVisCalcGroup procg(par.nbcalgrp_, mmgr, par.outpath_, par.nmean_, 0, 999999999, false, par.nthreads_);
|
---|
[3776] | 74 | procg.SelectFreqBinning(par.freqmin_, par.freqmax_, par.nbinfreq_);
|
---|
| 75 |
|
---|
| 76 | if (par.action_ == "viscktt") procg.ActivateTimeTagCheck(par.TotalNPaquets());
|
---|
[3956] | 77 | if (par.fgfitsout_) procg.SetFitsOutput();
|
---|
[3776] | 78 |
|
---|
[3956] | 79 | BRFFTCalculator procfft(mmgr, par.fgsinglechannel_);
|
---|
| 80 |
|
---|
| 81 | // On determine MemZaction pour chaque processeur et le finalizemask en fonction du traitement demande
|
---|
| 82 | if (par.action_ == "cube3d") mmgr.SetFinalizedMask((uint_4)MemZS_Saved);
|
---|
| 83 | else {
|
---|
| 84 | MemZStatus mfmask=MemZS_ProcA;
|
---|
| 85 | if (par.fgdatafft_) mfmask=procg.SetMemZAction(MemZA_ProcA);
|
---|
[3967] | 86 | else {
|
---|
| 87 | mfmask=procg.SetMemZAction(MemZA_ProcB);
|
---|
| 88 | procg.SetRawData();
|
---|
| 89 | }
|
---|
[3956] | 90 | mmgr.SetFinalizedMask((uint_4)mfmask);
|
---|
| 91 | }
|
---|
| 92 |
|
---|
[3695] | 93 | FitsCubeWriter wrt(mmgr, par.outpath_, par.nbloc_);
|
---|
| 94 | // BRBaseProcessor proc(mmgr);
|
---|
| 95 |
|
---|
| 96 | cout << " visimfib: Starting threads (reader procVisi) ... " << endl;
|
---|
| 97 | reader.start();
|
---|
| 98 | if (par.action_ == "cube3d") wrt.start();
|
---|
[3956] | 99 | else {
|
---|
| 100 | if (!par.fgdatafft_) procfft.start();
|
---|
| 101 | procg.start();
|
---|
| 102 | }
|
---|
[3695] | 103 | usleep(200000);
|
---|
| 104 | reader.join();
|
---|
| 105 | if (par.action_ == "cube3d") wrt.join();
|
---|
[3956] | 106 | else {
|
---|
| 107 | if (!par.fgdatafft_) procfft.join();
|
---|
| 108 | procg.join();
|
---|
| 109 | }
|
---|
[3695] | 110 | mmgr.Print(cout);
|
---|
| 111 | cout << resu ;
|
---|
| 112 | }
|
---|
| 113 | catch (std::exception& sex) {
|
---|
| 114 | cerr << "\n visimfib.cc std::exception :" << (string)typeid(sex).name()
|
---|
| 115 | << "\n msg= " << sex.what() << endl;
|
---|
| 116 | rc = 78;
|
---|
| 117 | }
|
---|
| 118 | catch (...) {
|
---|
| 119 | cerr << " visimfib.cc catched unknown (...) exception " << endl;
|
---|
| 120 | rc = 79;
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | cout << ">>>> visimfib.cc ------- END ----------- RC=" << rc << endl;
|
---|
| 124 | return rc;
|
---|
| 125 |
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 |
|
---|