Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > SSR > SSR__KMeans__Bench
comparison kmeans.c @ 3:d906272ff3a3
DataSet print
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Wed, 28 Sep 2011 15:04:24 +0200 |
| parents | 0ce47c784647 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:10c5db3eced7 | 1:e12aa8afb65a |
|---|---|
| 132 for(;;){ | 132 for(;;){ |
| 133 if(*((int*)SSR__receive_from_to(parentVP, VProc)) == END) | 133 if(*((int*)SSR__receive_from_to(parentVP, VProc)) == END) |
| 134 break; | 134 break; |
| 135 else | 135 else |
| 136 work(x, VProc); | 136 work(x, VProc); |
| 137 } | 137 } |
| 138 | 138 |
| 139 SSR__dissipate_procr(VProc); | 139 SSR__dissipate_procr(VProc); |
| 140 } | 140 } |
| 141 | 141 |
| 142 /* | 142 /* |
| 259 ip[i].local_newClusters=local_newClusters; | 259 ip[i].local_newClusters=local_newClusters; |
| 260 ip[i].numObjs=numObjs; | 260 ip[i].numObjs=numObjs; |
| 261 ip[i].numClusters=numClusters; | 261 ip[i].numClusters=numClusters; |
| 262 ip[i].numCoords=numCoords; | 262 ip[i].numCoords=numCoords; |
| 263 | 263 |
| 264 if(i!=0) | 264 tasks[i] = SSR__create_procr_with(tfwork, (void*)&ip[i], VProc); |
| 265 tasks[i] = SSR__create_procr_with(tfwork, (void*)&ip[i], VProc); | |
| 266 } | 265 } |
| 267 | 266 |
| 268 /* === COMPUTATIONAL PHASE === */ | 267 /* === COMPUTATIONAL PHASE === */ |
| 269 syncMsg = START; | 268 syncMsg = START; |
| 270 do { | 269 do { |
| 271 delta = 0.0; | 270 delta = 0.0; |
| 272 | 271 |
| 273 printf("start children 1\n"); | |
| 274 for(i=0; i<nthreads; i++) | 272 for(i=0; i<nthreads; i++) |
| 275 SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]); | 273 SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]); |
| 276 | 274 |
| 277 //let the children do the work | 275 //let the children do the work |
| 278 | 276 |
| 279 printf("receive results\n"); | |
| 280 for(i=0; i<nthreads; i++) | 277 for(i=0; i<nthreads; i++) |
| 281 delta += *(double*)SSR__receive_from_to(tasks[i],VProc); | 278 delta += *(double*)SSR__receive_from_to(tasks[i],VProc); |
| 282 printf("start children 2\n"); | |
| 283 for(i=1; i<nthreads; i++) | |
| 284 SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]); | |
| 285 | 279 |
| 286 /* Let the main thread perform the array reduction */ | 280 /* Let the main thread perform the array reduction */ |
| 287 for (i = 0; i < numClusters; i++) { | 281 for (i = 0; i < numClusters; i++) { |
| 288 for (j = 0; j < nthreads; j++) { | 282 for (j = 0; j < nthreads; j++) { |
| 289 newClusterSize[i] += local_newClusterSize[j][i]; | 283 newClusterSize[i] += local_newClusterSize[j][i]; |
