changeset 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 d930322470af
files kmeans kmeans.c
diffstat 2 files changed, 2 insertions(+), 8 deletions(-) [+]
line diff
     1.1 Binary file kmeans has changed
     2.1 --- a/kmeans.c	Tue Sep 27 15:08:02 2011 +0200
     2.2 +++ b/kmeans.c	Wed Sep 28 10:44:14 2011 +0200
     2.3 @@ -134,7 +134,7 @@
     2.4              break;
     2.5          else
     2.6              work(x, VProc);
     2.7 -    }
     2.8 +    }        
     2.9      
    2.10      SSR__dissipate_procr(VProc);
    2.11  }
    2.12 @@ -261,8 +261,7 @@
    2.13          ip[i].numClusters=numClusters;
    2.14          ip[i].numCoords=numCoords;
    2.15  
    2.16 -        if(i!=0)
    2.17 -            tasks[i] = SSR__create_procr_with(tfwork, (void*)&ip[i], VProc);
    2.18 +        tasks[i] = SSR__create_procr_with(tfwork, (void*)&ip[i], VProc);
    2.19      }
    2.20      
    2.21  	/* === COMPUTATIONAL PHASE === */
    2.22 @@ -270,18 +269,13 @@
    2.23      do {
    2.24          delta = 0.0;
    2.25          
    2.26 -        printf("start children 1\n");
    2.27          for(i=0; i<nthreads; i++)
    2.28              SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]);
    2.29          
    2.30          //let the children do the work
    2.31          
    2.32 -        printf("receive results\n");
    2.33          for(i=0; i<nthreads; i++)
    2.34              delta += *(double*)SSR__receive_from_to(tasks[i],VProc);
    2.35 -        printf("start children 2\n");
    2.36 -        for(i=1; i<nthreads; i++)
    2.37 -            SSR__send_from_to((void*)&syncMsg, VProc, tasks[i]);
    2.38          
    2.39  		/* Let the main thread perform the array reduction */
    2.40  		for (i = 0; i < numClusters; i++) {