From: adash Date: Mon, 20 Apr 2009 23:21:47 +0000 (+0000) Subject: add new Barrier...the code still breaks on compiling. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;ds=sidebyside;h=1cd8c602fb9cd8119eb466aff3eff6de6ec73a33;p=IRC.git add new Barrier...the code still breaks on compiling. enable printing double values --- diff --git a/Robust/src/Benchmarks/SingleTM/KMeans/Cluster.java b/Robust/src/Benchmarks/SingleTM/KMeans/Cluster.java index 0ac33667..fb16765e 100644 --- a/Robust/src/Benchmarks/SingleTM/KMeans/Cluster.java +++ b/Robust/src/Benchmarks/SingleTM/KMeans/Cluster.java @@ -150,8 +150,6 @@ public class Cluster { { int itime; int nclusters; - //random_t* randomPtr; - //Random randomPtr = null; double[][] tmp_cluster_centres = null; int[] membership = new int[numObjects]; @@ -169,6 +167,7 @@ public class Cluster { * From min_nclusters to max_nclusters, find best_nclusters */ for (nclusters = min_nclusters; nclusters <= max_nclusters; nclusters++) { + //System.out.println("ncluster= " + nclusters); randomPtr.random_seed(randomPtr, 7); args.nclusters = nclusters; diff --git a/Robust/src/Benchmarks/SingleTM/KMeans/KMeans.java b/Robust/src/Benchmarks/SingleTM/KMeans/KMeans.java index 13b0b166..209257a8 100644 --- a/Robust/src/Benchmarks/SingleTM/KMeans/KMeans.java +++ b/Robust/src/Benchmarks/SingleTM/KMeans/KMeans.java @@ -117,14 +117,10 @@ public class KMeans extends Thread { } public void run() { - Barrier barr; - barr = new Barrier("128.195.136.162"); while(true) { - Barrier.enterBarrier(barr); - + Barrier.enterBarrier(); Normal.work(threadid, g_args); - - Barrier.enterBarrier(barr); + Barrier.enterBarrier(); } } @@ -141,6 +137,8 @@ public class KMeans extends Thread { KMeans kms = new KMeans(); KMeans.parseCmdLine(args, kms); nthreads = kms.nthreads; + /* Initiate Barriers */ + Barrier.setBarrier(nthreads); if (kms.max_nclusters < kms.min_nclusters) { System.out.println("Error: max_clusters must be >= min_clusters\n"); @@ -159,7 +157,6 @@ public class KMeans extends Thread { System.out.println("TODO: Unimplemented Binary file option\n"); System.exit(0); } - System.out.println("filename= " + kms.filename); FileInputStream inputFile = new FileInputStream(kms.filename); String line = null; while((line = inputFile.readLine()) != null) { @@ -181,12 +178,13 @@ public class KMeans extends Thread { /* Ignore the id (first attribute): numAttributes = 1; */ numAttributes = numAttributes - 1; // - System.out.println("numObjects= " + numObjects + "numAttributes= " + numAttributes); + System.out.println("numObjects= " + numObjects + " numAttributes= " + numAttributes); /* Allocate new shared objects and read attributes of all objects */ buf = new double[numObjects][numAttributes]; attributes = new double[numObjects][numAttributes]; KMeans.readFromFile(inputFile, kms.filename, buf); + System.out.println("Finished Reading from file ......"); /* * The core of the clustering @@ -199,8 +197,6 @@ public class KMeans extends Thread { KMeans[] km = new KMeans[nthreads]; GlobalArgs g_args = new GlobalArgs(); g_args.nthreads = nthreads; - //args.nfeatures = numAttributes; - //args.npoints = numObjects; /* Create and Start Threads */ for(int i = 1; i