Changeset 1033 in Sophya
- Timestamp:
- May 25, 2000, 11:42:08 AM (25 years ago)
- Location:
- trunk/SophyaProg/Tests
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/JTCMakefile
r1032 r1033 19 19 20 20 LIBF = $(SLB)libsophya.so 21 LIBS = -L$(SLB) -lPI -lextsophya -lsophya -L$(EXTSLBPATH) -lJTC -lm21 LIBS = -L$(SLB) -lPI -lextsophya -lsophya -L$(EXTSLBPATH) -lJTC -lXm -lXt -lX11 -lm 22 22 ifeq ($(MACHEROS),OSF1) 23 23 LIBS := $(LIBS) -lfor -
trunk/SophyaProg/Tests/jtctarr.cc
r1030 r1033 13 13 14 14 // A global monitor for print synchronisation 15 JTCMonitor prtmon; 15 JTCMonitor prtmon; // <JThreadC++> 16 16 17 17 // A thread class for doing matrix computation 18 class MtxComputer : public JTCThread 18 class MtxComputer : public JTCThread // <JThreadC++> 19 19 { 20 20 public: … … 38 38 Matrix id; 39 39 id = IdentityMatrix(1.,n); 40 double gmax = -1.e99; 41 double gmin = 1.e99; 42 int npb = 0; 40 43 // Loop creating a random matrix, inverting it 41 44 // and checking the result … … 57 60 if (fabs(x) > seuil) nerr++; 58 61 } 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++> 61 67 cout << " ------- Thread[" << id_ << "] K= " 62 68 << k << " NErr = " << nerr << endl; 63 69 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 } 64 77 } 65 78 } … … 68 81 << ") Msg= " << e.Msg() << endl; 69 82 } 70 catch (JTCException const & e) { 83 catch (JTCException const & e) { // <JThreadC++> 71 84 cerr << " Catched JTCException in Thread(" << (string)getName() 72 85 << ") Msg= " << e.getMessage() << endl; … … 86 99 << " NThreads=1...4 NLoop=10...10^4 MtxSize=10...10^3 \n" 87 100 << endl; 101 exit(0); 88 102 } 89 103 … … 100 114 try { 101 115 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++> 104 119 int k; 105 120 for(k=0; k<nthr; k++) t[k] = new MtxComputer(k, size, nloop); 106 121 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++> 108 123 // 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++> 110 125 } 111 126 catch (PThrowable const & e) { 112 127 cerr << " Catched PThrowable in main Msg= " << e.Msg() << endl; 113 128 } 114 catch (JTCException const & e) { 129 catch (JTCException const & e) { // <JThreadC++> 115 130 cerr << " Catched JTCException in main Msg= " << e.getMessage() << endl; 116 131 }
Note:
See TracChangeset
for help on using the changeset viewer.