Revision 779 branches/pthreads-737/tests/nst/nst.tpl

nst.tpl (revision 779)
15 15
  ofstream clogf;
16 16

  
17 17
  void * mp_ptr = NULL;
18
  int NSLAVES=10;
18 19

  
19 20

  
20 21
DATA_SECTION
......
22 23
  int m2
23 24
  int n
24 25
  vector x
25
  int NSLAVES
26
  //int NSLAVES
26 27
 LOCAL_CALCS
27
   m=150;
28
   m=25;
28 29
   m2 = m*m;
29
   NSLAVES = 24;
30
   //NSLAVES=2;
30 31
   n = NSLAVES;
31 32
   TTTRACE(m,m2,NSLAVES)
32 33
   x.allocate(1,m2);
......
62 63
  double cf=0.0;
63 64
  int nloop=3;
64 65
  adtimer adt;
66
  dvector w(1,5);
67
  w.fill_seqadd(1.5,1.5);
65 68
  for (int kk=1;kk<=n;kk++)
66 69
  {
67
     TRACE(kk)
68
     test_thread_manager->send_double_to_slave(1.0,kk);
70
     test_thread_manager->write_lock_buffer_master(kk);
71
     test_thread_manager->send_id_string_to_slave_nl("abcx",kk);
72
     test_thread_manager->send_double_to_slave_nl(2.4,kk);
69 73
     test_thread_manager->send_dvar_vector_to_slave(vx,kk);
74

  
75
     test_thread_manager->send_dvector_to_slave(w,kk);
76

  
77
     test_thread_manager->write_unlock_buffer_master(kk);
70 78
  }
71 79
       
72 80
  for (int kk=1;kk<=n;kk++)
73 81
  {
74
     TTRACE(kk,yy(kk))
75
     yy(kk)=test_thread_manager->get_dvariable_from_slave(kk);
76
     TTRACE(kk,yy(kk))
82
    test_thread_manager->read_lock_buffer_master(kk);
83
    test_thread_manager->verify_id_string_from_slave_nl("X1",kk); 
84
    yy(kk)=test_thread_manager->get_dvariable_from_slave(kk);
85
    test_thread_manager->read_unlock_buffer_master(kk);
77 86
  }
78 87
       
79 88
  f=sum(yy);
80 89
 
81 90

  
82 91
TOP_OF_MAIN_SECTION
92
  add_slave_suffix("xxx");
83 93
  adstring logname("nstlog.log");
84 94
  clogf.open(logname);
85 95
  if ( !clogf ) 
......
95 105
  //gradient_structure::set_MAX_NVAR_OFFSET(30000);
96 106

  
97 107
  test_thread_manager = new adpthread_manager(NSLAVES,500000);
108
  ad_comm::pthread_manager=test_thread_manager;
98 109

  
99 110
  thread_data* data1 = new thread_data[NSLAVES+1];
100 111
  // initialize data to pass to thread 1

Also available in: Unified diff