Changeset 3263 in Sophya


Ignore:
Timestamp:
Jun 11, 2007, 6:56:30 PM (18 years ago)
Author:
ansari
Message:

Ajout nouveaux cas de test avec threads select= arrdl OU arrmf (calcul de type DL sur vecteur OU v2=Sin(v1)) dans zthr.cc , Reza 11/06/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/zthr.cc

    r3253 r3263  
    88#include "tmatrix.h"
    99#include "tvector.h"
     10#include "matharr.h"
    1011#include "tarrinit.h"
    1112
     
    1718  SOPHYA::ZThread SOPHYA::ZMutex ...
    1819  Exemples d'execution
    19   csh> time zthr mtx 2 500
     20  csh> time zthr mtx 2 500     
    2021  csh> time zthr arr 2 500
     22  csh> time zthr arrdl 2 500
     23  csh> time zthr arrmf 2 500
    2124  csh> time zthr sync 4 1000
     25  csh> time zthr syncp 4 1000
    2226*/
    2327 
     
    7478  return;
    7579}
    76 // --- fonction de test simple avec calcul sur tableaux
     80// --- fonction de test simple avec calcul sur tableaux entier I4
    7781void arr_funzt(void *arg)
    7882{
     
    9094  ares = (4*a1)+(12*a2);
    9195  sprintf(buff, "arr-funzt(ThId=%d) EndOfOper", za->thid);
     96  PrtTim(buff);
     97  return;
     98}
     99// --- fonction de test simple avec calcul de type DL sur tableaux double 1D
     100void arrdl_funzt(void *arg)
     101{
     102  ztarg * za = (ztarg *)arg;
     103  sa_size_t vsz = za->M*za->M;
     104
     105  cout << ">>>> arrdl-funzt(ThId=" << za->thid << " VecSz=M*M " << vsz 
     106       << " V2=DLO4(V1) , NOp ~= 10*vsz=" << 10*vsz << endl;
     107 
     108  TVector<r_8> v1(vsz), v2(vsz);
     109  v1 = RegularSequence(1.,0.001);
     110  char buff[128];
     111  sprintf(buff, "arrdl-funzt(ThId=%d) EndOfInit", za->thid);
     112  PrtTim(buff);
     113  for(sa_size_t i=0; i<vsz; i++) {
     114    double x = v1(i);
     115    v2(i) = x*(1+x*(x/2.+x*(x/6.+x*x/24.)));
     116  }
     117  sprintf(buff, "arrdl-funzt(ThId=%d) EndOfOper", za->thid);
     118  PrtTim(buff);
     119  return;
     120}
     121// --- fonction de test simple avec calcul de type fonction mathematique sur tableaux double 1D
     122void arrmf_funzt(void *arg)
     123{
     124  ztarg * za = (ztarg *)arg;
     125  sa_size_t vsz = za->M*za->M;
     126
     127  cout << ">>>> arrmf-funzt(ThId=" << za->thid << " VecSz=M*M " << vsz 
     128       << " V2=Sin(V1) , NOp ~= 10*vsz=" << 10*vsz << endl;
     129 
     130  TVector<r_8> v1(vsz), v2(vsz);
     131  v1 = RegularSequence(1.,0.001);
     132  char buff[128];
     133  sprintf(buff, "arrmf-funzt(ThId=%d) EndOfInit", za->thid);
     134  PrtTim(buff);
     135  v2 = Sin(v1);
     136
     137  sprintf(buff, "arrmf-funzt(ThId=%d) EndOfOper", za->thid);
    92138  PrtTim(buff);
    93139  return;
     
    329375    cout << " Usage: zthr select N LM [Sz] " << endl;
    330376    cout << "  select= sl -> simple loop with sleep " << endl;
    331     cout << "  select= mtx -> matrix init and multiply mx1*mx2" << endl;
    332     cout << "  select= arr -> array/matrix init and operation c1*a1+c2*a2 " << endl;
     377    cout << "  select= mtx -> matrix<r_8> init and multiply mx1*mx2" << endl;
     378    cout << "  select= arr -> array/matrix<int_4> init and operation c1*a1+c2*a2 " << endl;
     379    cout << "  select= arrdl -> vectorOpe V2 ~= DLO4(V1), VSz=LM*LM " << endl;
     380    cout << "  select= arrmf -> vectorOpe V2 = Sin(V1), VSz=LM*LM " << endl;
    333381    cout << "  select= clk -> Mutex lock count  " << endl;
    334382    cout << "  select= sync -> Thread synchronisation using ZMutex" << endl;
     
    342390  string sel = arg[1];
    343391  if ((sel != "sl") && (sel != "mtx") && (sel != "arr") &&
     392      (sel != "arrdl") && (sel != "arrmf") &&
    344393      (sel != "sync") && (sel != "syncp") && (sel != "clk")) {
    345394    cout << "zthr/erreur argument sel (!= sl / mtx / arr / clk) " << endl;
     
    361410  try {
    362411    ResourceUsage res(ResourceUsage::RU_All);
    363     if ((sel == "mtx") || (sel == "arr") || (sel == "sl") || (sel == "sync") || (sel == "syncp")) {
     412    if ((sel == "mtx") || (sel == "arr") || (sel == "sl") ||
     413        (sel == "arrdl") || (sel == "arrmf") ||
     414        (sel == "sync") || (sel == "syncp")) {
    364415      if ( (sel == "sync") || (sel == "syncp"))  mtvp = new MTVecPool(N,VSZ,M);
    365416      vector<ztarg *> vza;
     
    376427        if (sel == "mtx")  pzt->setAction(mtx_funzt, vza[i]);
    377428        else if (sel == "arr")  pzt->setAction(arr_funzt, vza[i]);
     429        else if (sel == "arrdl")  pzt->setAction(arrdl_funzt, vza[i]);
     430        else if (sel == "arrmf")  pzt->setAction(arrmf_funzt, vza[i]);
    378431        else if (sel == "sync")  pzt->setAction(sync_funzt, vza[i]);
    379432        else if (sel == "syncp")  pzt->setAction(syncp_funzt, vza[i]);
Note: See TracChangeset for help on using the changeset viewer.