Revision 757 branches/threaded2/tests/nst/new_sim_thread3.cpp
new_sim_thread3.cpp (revision 757)  

35  35 
}; 
36  36 
pthread_mutex_t mutex_print; 
37  37  
38 
const int NSLAVES=16;


38 
const int NSLAVES=24;


39  39  
40  40 
int mflag[NSLAVES+1]; 
41  41 
int sflag[NSLAVES+1]; 
...  ...  
626  626 
} 
627  627 
} 
628  628  
629 
const int m=75;


629 
const int m=150;


630  630 
const int m2=m*m; 
631  631  
632  632 
int main() 
...  ...  
645  645 
test_thread_manager>create_all(&admb_thread,data1); 
646  646 
const int n=NSLAVES; 
647  647 
{ 
648 
gradient_structure::set_MAX_NVAR_OFFSET(10000);


648 
gradient_structure::set_MAX_NVAR_OFFSET(30000);


649  649 
//gradient_structure::set_ARRAY_MEMBLOCK_SIZE(20000); 
650  650 
//gradient_structure::set_GRADSTACK_BUFFER_SIZE(200); 
651 
gradient_structure gs(1000000);


651 
gradient_structure gs(2000000);


652  652 
independent_variables x(1,m2); 
653  653 
random_number_generator rng(101); 
654  654 
x.fill_randn(rng); 
655 
adtimer adt; 

655  656 
dvar_vector vx=dvar_vector(x); 
656  657 
//int offset=0; 
657  658 
for (int kk=1;kk<=n;kk++) 
...  ...  
675  676 
gradcalc(m2,g); 
676  677 

677  678 
ofs1<<g<<endl; 
679 
cout << adt.get_elapsed_time_and_reset()<<endl; 

678  680 

679  681 
} 
680  682 
test_thread_manager>pthread_join_all(); 
...  ...  
709  711 
u.fill_seqadd(sno,1.0/sno); 
710  712 

711  713 
dvariable z=0.0; 
712 
for (int i=1;i<=20;i++)


714 
for (int i=1;i<=50;i++)


713  715 
{ 
714  716 
z+=norm2(solve(M,u+double(i))); 
715  717 
} 
Also available in: Unified diff