Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > SSR > SSR__KMeans__Bench
diff kmeans.c @ 1:53dd2334f136
Working SSR version
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Wed, 28 Sep 2011 10:44:14 +0200 |
| parents | 0ce47c784647 |
| children |
line diff
1.1 --- a/kmeans.c Tue Sep 27 15:08:02 2011 +0200 1.2 +++ b/kmeans.c Wed Sep 28 10:44:14 2011 +0200 1.3 @@ -134,7 +134,7 @@ 1.4 break; 1.5 else 1.6 work(x, VProc); 1.7 - } 1.8 + } 1.9 1.10 SSR__dissipate_procr(VProc); 1.11 } 1.12 @@ -261,8 +261,7 @@ 1.13 ip[i].numClusters=numClusters; 1.14 ip[i].numCoords=numCoords; 1.15 1.16 - if(i!=0) 1.17 - tasks[i] = SSR__create_procr_with(tfwork, (void*)&ip[i], VProc); 1.18 + tasks[i] = SSR__create_procr_with(tfwork, (void*)&ip[i], VProc); 1.19 } 1.20 1.21 /* === COMPUTATIONAL PHASE === */ 1.22 @@ -270,18 +269,13 @@ 1.23 do { 1.24 delta = 0.0; 1.25 1.26 - printf("start children 1\n"); 1.27 for(i=0; i<nthreads; i++) 1.28 SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]); 1.29 1.30 //let the children do the work 1.31 1.32 - printf("receive results\n"); 1.33 for(i=0; i<nthreads; i++) 1.34 delta += *(double*)SSR__receive_from_to(tasks[i],VProc); 1.35 - printf("start children 2\n"); 1.36 - for(i=1; i<nthreads; i++) 1.37 - SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]); 1.38 1.39 /* Let the main thread perform the array reduction */ 1.40 for (i = 0; i < numClusters; i++) {
