Changeset 1033 in Sophya for trunk


Ignore:
Timestamp:
May 25, 2000, 11:42:08 AM (25 years ago)
Author:
ansari
Message:

programme test thread+PI+TArray , Reza 25/5/2000

Location:
trunk/SophyaProg/Tests
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/JTCMakefile

    r1032 r1033  
    1919
    2020LIBF =  $(SLB)libsophya.so
    21 LIBS = -L$(SLB) -lPI -lextsophya -lsophya -L$(EXTSLBPATH) -lJTC -lm
     21LIBS = -L$(SLB) -lPI -lextsophya -lsophya -L$(EXTSLBPATH) -lJTC -lXm -lXt -lX11 -lm
    2222ifeq ($(MACHEROS),OSF1)
    2323LIBS := $(LIBS) -lfor
  • trunk/SophyaProg/Tests/jtctarr.cc

    r1030 r1033  
    1313
    1414// A global monitor for print synchronisation
    15 JTCMonitor prtmon;
     15JTCMonitor prtmon;  // <JThreadC++>
    1616
    1717// A thread class for doing matrix computation
    18 class MtxComputer : public JTCThread
     18class MtxComputer : public JTCThread   // <JThreadC++>
    1919{
    2020public:
     
    3838  Matrix id;
    3939  id = IdentityMatrix(1.,n);
     40  double gmax = -1.e99;
     41  double gmin = 1.e99;
     42  int npb = 0;
    4043  // Loop creating a random matrix, inverting it
    4144  // and checking the result
     
    5760          if (fabs(x) > seuil)  nerr++;
    5861        }
    59       {  // Synchronized writing to cout stream
    60         JTCSynchronized sync(prtmon);
     62      if (min < gmin) gmin = min;
     63      if (max > gmax) gmax = max;
     64      if (nerr > 0) npb++;
     65      {  // Synchronized writing to cout stream 
     66        JTCSynchronized sync(prtmon);  // <JThreadC++>
    6167        cout << " ------- Thread[" << id_ << "] K= "
    6268             << k << "  NErr = " << nerr << endl;
    6369        cout << "  Min(Diff) = " << min << " Max(Diff) = " << max << endl;
     70        if (k == nloop_-1) {
     71          double frac = (double)npb*100./(double)nloop_;
     72          cout << " ...... Thread[" << id_ << "] End NPb= " << npb
     73               << " / NTot= " << nloop_ << " ( = " << frac << " %) " << endl;
     74        cout << "  GMin(Diff) = " << gmin << " GMax(Diff) = " << gmax << endl;
     75        cout << " ..................................................... " << endl;
     76        }
    6477      }
    6578    }
     
    6881             << ") Msg= " << e.Msg() << endl;
    6982    }
    70     catch (JTCException const & e) {
     83    catch (JTCException const & e) {  // <JThreadC++>
    7184        cerr << " Catched JTCException in  Thread(" << (string)getName()
    7285             << ") Msg= " << e.getMessage() << endl;
     
    8699         << " NThreads=1...4  NLoop=10...10^4  MtxSize=10...10^3 \n"
    87100         << endl;
     101    exit(0);
    88102  }
    89103
     
    100114  try {
    101115    SophyaInit();  // Sophya Initialization
    102     JTCInitialize iniJTC(narg, arg);
    103     JTCThreadHandle t[MAXNTHR];
     116    JTCInitialize iniJTC(narg, arg);  // <JThreadC++>  Initialize library
     117
     118    JTCThreadHandle t[MAXNTHR];  // <JThreadC++> 
    104119    int k;
    105120    for(k=0; k<nthr; k++)  t[k] = new MtxComputer(k, size, nloop);
    106121    cout << " Starting threads ... " << endl;
    107     for(k=0; k<nthr; k++) t[k]->start();
     122    for(k=0; k<nthr; k++) t[k]->start();  // <JThreadC++>
    108123    // Waiting for threads to end
    109     for(k=0; k<nthr; k++) t[k]->join();
     124    for(k=0; k<nthr; k++) t[k]->join();   // <JThreadC++>
    110125  }
    111126  catch (PThrowable const & e) {
    112127    cerr << " Catched PThrowable in main Msg= " << e.Msg() << endl;
    113128  }
    114   catch (JTCException const & e) {
     129  catch (JTCException const & e) {  // <JThreadC++>
    115130    cerr << " Catched JTCException in main Msg= " << e.getMessage() << endl;
    116131  }
Note: See TracChangeset for help on using the changeset viewer.