-singleTM flag problems for more than 1 thread still exists, some problem in TRANSREAD, Amem_cpy()
make
-By default, this produces an executable named "kmeans", which can then be
+By default, this produces an executable named "KMeans.bin", which can then be
run in the following manner:
- ./kmeans -m <max_clusters> \
+ ./KMeans.bin -m <max_clusters> \
-n <min_clusters> \
-t <threshold> \
-i <input_file_name> \
*/
public class Alg_Radix_Smp {
- int[] global_myHisto;
- int[] global_psHisto;
- int[] global_lTemp;
- int[] global_lTemp2;
- int myId;
- int numThread;
-
- public class Alg_Radix_Smp(int myId, int numThread) {
+ public int[] global_myHisto;
+ public int[] global_psHisto;
+ public int[] global_lTemp;
+ public int[] global_lTemp2;
+
+ public Alg_Radix_Smp() {
global_myHisto = null;
global_psHisto = null;
global_lTemp = null;
global_lTemp2 = null;
- this.myId = myId;
- this.numThread = numThread;
}
- public int BITS(x, k, j) {
+ public int BITS(int x, int k, int j) {
int retval = ((x>>k) & ~(~0<<j));
return retval;
}
* q (elems/proc) must be a multiple of NODES
* =============================================================================
*/
- void
- all_countsort_node (int q,
+ /*
+ public void
+ all_countsort_node (
+ int q,
int[] lKey,
int[] lSorted,
int R,
int bitOff,
- int m,
- )
+ int m)
{
int[] myHisto = null;
int[] psHisto = null;
LocalStartStop lss = new LocalStartStop();
CreatePartition.createPartition(0, q, myId, numThread, lss);
- for (int k = lss.i_start; k < i_stop; k++) {
+ for (int k = lss.i_start; k < lss.i_stop; k++) {
myHisto[(myId * R) + BITS(lKey[k],bitOff,m)]++;
}
int offset = 0;
- for (k = 0; k < R; k++) {
+ for (int k = 0; k < R; k++) {
myHisto[(myId * R) + k] = (psHisto[(myId * R) + k] - myHisto[(myId * R) + k]) + offset;
offset += psHisto[((numThread - 1) * R) + k];
}
myHisto = null;
}
}
+*/
/* =============================================================================
* q (elems/proc) must be a multiple of NODES
* =============================================================================
*/
- void
+ /*
+ public void
all_countsort_node_aux_seq (int q,
int[] lKey,
int[] lSorted,
auxSorted[myHisto[j]] = lKey[k];
myHisto[j]++;
- /*
- lSorted[mhp[j]] = lKey[k];
- auxSorted[mhp[j]] = auxKey[k];
- mhp[j]++;
- */
+ //
+ //lSorted[mhp[j]] = lKey[k];
+ //auxSorted[mhp[j]] = auxKey[k];
+ //mhp[j]++;
+
}
psHisto = null;
myHisto = null;
}
+*/
/* =============================================================================
* q (elems/proc) must be a multiple of NODES
* =============================================================================
*/
- void
- all_countsort_node_aux (int q,
+ public void
+ all_countsort_node_aux (int myId,
+ int numThread,
+ int q,
int[] lKey,
int[] lSorted,
int[] auxKey,
int[] auxSorted,
int R,
int bitOff,
- int m)
+ int m,
+ Alg_Radix_Smp rdxsort)
{
int[] myHisto = null;
int[] psHisto = null;
if (myId == 0) {
myHisto = new int[numThread * R];
- global_myHisto = myHisto;
+ rdxsort.global_myHisto = myHisto;
psHisto = new int[numThread * R];
- global_psHisto = psHisto;
+ rdxsort.global_psHisto = psHisto;
}
Barrier.enterBarrier();
- myHisto = global_myHisto;
- psHisto = global_psHisto;
+ myHisto = rdxsort.global_myHisto;
+ psHisto = rdxsort.global_psHisto;
for (int k = 0; k < R; k++) {
myHisto[((myId*R) + k)] = 0;
int offset = 0;
for (int k = 0; k < R; k++) {
- myHisto[(myId*R) +k] = (psHisto[ ((myId*R) + k)] - myHisto[ ((myId*R) +k])) + offset;
+ myHisto[(myId*R)+k] = (psHisto[(myId*R) + k] - myHisto[(myId*R) +k]) + offset;
offset += psHisto[((numThread -1) * R) + k];
}
* q (elems/proc) must be a multiple of NODES
* =============================================================================
*/
- void
+ /*
+ public void
all_radixsort_node_s3 (int q,
int[] lKeys,
int[] lSorted)
Barrier.enterBarrier();
if (myId == 0) {
- lTemp = null
+ lTemp = null;
}
}
+ */
/* =============================================================================
* q (elems/proc) must be a multiple of NODES
* =============================================================================
*/
- void
+ /*
+ public void
all_radixsort_node_s2 (int q,
int[] lKeys,
int[] lSorted)
lTemp = null;
}
}
+ */
/* =============================================================================
* q (elems/proc) must be a multiple of NODES
* =============================================================================
*/
- void
+ /*
+ public void
all_radixsort_node_aux_s3_seq (int q,
int[] lKeys,
int[] lSorted,
lTemp = null;
lTemp2 = null;
}
+ */
/* =============================================================================
* =============================================================================
*/
public static void
- all_radixsort_node_aux_s3 (int q,
+ all_radixsort_node_aux_s3 (int myId,
+ int numThread,
+ int q,
int[] lKeys,
int[] lSorted,
int[] auxKey,
- int[] auxSorted)
+ int[] auxSorted,
+ Alg_Radix_Smp rdxsort)
{
int[] lTemp = null;
int[] lTemp2 = null;
if (myId == 0) {
lTemp = new int[ q];
- global_lTemp = lTemp;
+ rdxsort.global_lTemp = lTemp;
lTemp2 = new int[ q];
- global_lTemp2 = lTemp2;
+ rdxsort.global_lTemp2 = lTemp2;
}
Barrier.enterBarrier();
- lTemp = global_lTemp;
- lTemp2 = global_lTemp2;
+ lTemp = rdxsort.global_lTemp;
+ lTemp2 = rdxsort.global_lTemp2;
- all_countsort_node_aux(q, lKeys, lSorted, auxKey, auxSorted, (1<<11), 0, 11);
- all_countsort_node_aux(q, lSorted, lTemp, auxSorted, lTemp2, (1<<11), 11, 11);
- all_countsort_node_aux(q, lTemp, lSorted, lTemp2, auxSorted, (1<<10), 22, 10);
+ rdxsort.all_countsort_node_aux(myId, numThread, q, lKeys, lSorted, auxKey, auxSorted, (1<<11), 0, 11, rdxsort);
+ rdxsort.all_countsort_node_aux(myId, numThread, q, lSorted, lTemp, auxSorted, lTemp2, (1<<11), 11, 11, rdxsort);
+ rdxsort.all_countsort_node_aux(myId, numThread, q, lTemp, lSorted, lTemp2, auxSorted, (1<<10), 22, 10, rdxsort);
Barrier.enterBarrier();
- if(myId = 0) {
+ if(myId == 0) {
lTemp = null;
lTemp2 = null;
}
if (myId > 0) {
int add_value = p[NOSHARE(myId-1)];
- for (j = start-1; j < end; j++) {
+ for (int j = start-1; j < end; j++) {
result[j] += add_value;
}
}
//Graph GPtr = computeGraphArgs.GPtr;
//GraphSDG SDGdataPtr = computeGraphArgs.SDGdata;
- int j;
+ //int j;
int maxNumVertices = 0;
int numEdgesPlaced = computeGraphArgs.SDGdataPtr.numEdgesPlaced;
}
atomic {
- int tmp_maxNumVertices = global_maxNumVertices;
+ int tmp_maxNumVertices = computeGraphArgs.global_maxNumVertices;
int new_maxNumVertices = CreatePartition.MAX( tmp_maxNumVertices, maxNumVertices) + 1;
- global_maxNumVertices = new_maxNumVertices;
+ computeGraphArgs.global_maxNumVertices = new_maxNumVertices;
}
Barrier.enterBarrier();
- maxNumVertices = global_maxNumVertices;
+ maxNumVertices = computeGraphArgs.global_maxNumVertices;
if (myId == 0) {
CreatePartition.createPartition(0, computeGraphArgs.GPtr.numVertices, myId, numThread, lss);
- for (i = lss.i_start; i < lss.i_stop; i++) {
+ for (int i = lss.i_start; i < lss.i_stop; i++) {
computeGraphArgs.GPtr.outDegree[i] = 0;
computeGraphArgs.GPtr.outVertexIndex[i] = 0;
}
Barrier.enterBarrier();
- prefix_sums(myId, numThread, computeGraphArgs.GPtr.outVertexIndex, computeGraphArgs.GPtr.outDegree, computeGraphArgs.GPtr.numVertices);
+ computeGraphArgs.prefix_sums(myId, numThread, computeGraphArgs.GPtr.outVertexIndex, computeGraphArgs.GPtr.outDegree, computeGraphArgs.GPtr.numVertices);
Barrier.enterBarrier();
atomic {
- global_outVertexListSize = global_outVertexListSize + outVertexListSize;
+ computeGraphArgs.global_outVertexListSize = computeGraphArgs.global_outVertexListSize + outVertexListSize;
}
Barrier.enterBarrier();
- outVertexListSize = global_outVertexListSize;
+ outVertexListSize = computeGraphArgs.global_outVertexListSize;
if (myId == 0) {
computeGraphArgs.GPtr.numDirectedEdges = outVertexListSize;
if (myId == 0) {
impliedEdgeList = new int[computeGraphArgs.GPtr.numVertices * glb.MAX_CLUSTER_SIZE];
- global_impliedEdgeList = impliedEdgeList;
+ computeGraphArgs.global_impliedEdgeList = impliedEdgeList;
}
Barrier.enterBarrier();
- impliedEdgeList = global_impliedEdgeList;
+ impliedEdgeList = computeGraphArgs.global_impliedEdgeList;
CreatePartition.createPartition(0,
(computeGraphArgs.GPtr.numVertices * glb.MAX_CLUSTER_SIZE),
int[][] auxArr;
if (myId == 0) {
auxArr = new int[computeGraphArgs.GPtr.numVertices][glb.MAX_CLUSTER_SIZE];
- global_auxArr = auxArr;
+ computeGraphArgs.global_auxArr = auxArr;
}
Barrier.enterBarrier();
- auxArr = global_auxArr;
+ auxArr = computeGraphArgs.global_auxArr;
CreatePartition.createPartition(0, computeGraphArgs.GPtr.numVertices, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
/* Inspect adjacency list of vertex i */
- for (j = computeGraphArgs.GPtr.outVertexIndex[i];
+ for (int j = computeGraphArgs.GPtr.outVertexIndex[i];
j < (computeGraphArgs.GPtr.outVertexIndex[i] + computeGraphArgs.GPtr.outDegree[i]);
j++)
{
int inDegree = computeGraphArgs.GPtr.inDegree[v];
computeGraphArgs.GPtr.inDegree[v] = (inDegree + 1);
if ( inDegree < glb.MAX_CLUSTER_SIZE) {
- impliedEdgeList[v*glb.MAX_CLUSTER_SIZE+inDegree] = i
+ impliedEdgeList[v*glb.MAX_CLUSTER_SIZE+inDegree] = i;
} else {
/* Use auxiliary array to store the implied edge */
/* Create an array if it's not present already */
} else {
a = auxArr[v];
}
- a[inDegree % MAX_CLUSTER_SIZE] = i;
+ a[inDegree % glb.MAX_CLUSTER_SIZE] = i;
}
}
}
Barrier.enterBarrier();
- prefix_sums(myId, numThread, computeGraphArgs.GPtr.inVertexIndex, computeGraphArgs.GPtr.inDegree, computeGraphArgs.GPtr.numVertices);
+ computeGraphArgs.prefix_sums(myId, numThread, computeGraphArgs.GPtr.inVertexIndex, computeGraphArgs.GPtr.inDegree, computeGraphArgs.GPtr.numVertices);
if (myId == 0) {
computeGraphArgs.GPtr.numUndirectedEdges = computeGraphArgs.GPtr.inVertexIndex[computeGraphArgs.GPtr.numVertices-1]
impliedEdgeList = null;
}
- for (i = i_start; i < i_stop; i++) {
- if (computeGraphArgs.GPtr.inDegree[i] > MAX_CLUSTER_SIZE) {
+ for (int i = lss.i_start; i < lss.i_stop; i++) {
+ if (computeGraphArgs.GPtr.inDegree[i] > glb.MAX_CLUSTER_SIZE) {
auxArr[i] = null;
}
}
Barrier.enterBarrier();
if (myId == 0) {
- auxArr = null
+ auxArr = null;
}
}
public static void
createPartition (int min, int max, int id, int n, LocalStartStop lss)
{
+ //System.out.println("Inside createPartition() \n");
int range = max - min;
int chunk = MAX(1, ((range + n/2) / n)); /* rounded */
int start = min + chunk * id;
stop = MIN(max, (start + chunk));
}
- lss.start = start;
- lss.stop = stop;
+ lss.i_start = start;
+ lss.i_stop = stop;
}
public static int MAX(int a, int b) {
--- /dev/null
+public class FindSubGraphs0_arg_t {
+ Graph GPtr;
+ VList intWtVList;
+ VList strWtVList;
+ Edge maxIntWtList;
+ int maxIntWtListSize;
+ Edge soughtStrWtList;
+ int soughtStrWtListSize;
+
+ public FindSubGraphs0_arg_t() {
+
+ }
+}
* Constructor
**/
public GenScalData() {
- global_permV; = null;
+ global_permV = null;
global_cliqueSizes = null;
global_totCliques = 0;
global_firstVsInCliques = null;
*/
public static void
- genScalData (int myId, int numThread, Globals glb, GraphSDG SDGdataPtr)
+ genScalData (int myId, int numThread, Globals glb, GraphSDG SDGdataPtr, GenScalData gsd, Alg_Radix_Smp radixsort)
{
/*
* STEP 0: Create the permutations required to randomize the vertices
*/
Random randomPtr = new Random();
- randomPtr = randomPtr.random_alloc();
+ randomPtr.random_alloc();
randomPtr.random_seed(myId);
int[] permV;
if (myId == 0) {
permV = new int[glb.TOT_VERTICES];
- global_permV = permV;
+ gsd.global_permV = permV;
}
Barrier.enterBarrier();
- permV = global_permV;
+ permV = gsd.global_permV;
LocalStartStop lss = new LocalStartStop();
- CreatePartition cp = new CreatePartition();
- cp.createPartition(0, glb.TOT_VERTICES, myId, numThread, lss);
+ //CreatePartition cp = new CreatePartition();
+ CreatePartition.createPartition(0, glb.TOT_VERTICES, myId, numThread, lss);
/* Initialize the array */
for (int i = lss.i_start; i < lss.i_stop; i++) {
Barrier.enterBarrier();
- for (int i = i_start; i < i_stop; i++) {
- int t1 = randomPtr.random_generate();
+ for (int i = lss.i_start; i < lss.i_stop; i++) {
+ int t1 = (int) (randomPtr.random_generate());
+ if(t1 < 0)
+ t1*=(-1);
int t = i + t1 % (glb.TOT_VERTICES - i);
if (t != i) {
atomic {
int[] cliqueSizes;
- int estTotCliques = (int)(Math.ceil(1.5d * glb.TOT_VERTICES / ((1+glb.MAX_CLIQUE_SIZE)/2)));
+ int estTotCliques = (int)(Math.ceil(1.5 * glb.TOT_VERTICES / ((1+glb.MAX_CLIQUE_SIZE)/2)));
/*
* Allocate mem for Clique array
*/
if (myId == 0) {
cliqueSizes = new int[estTotCliques];
- global_cliqueSizes = cliqueSizes;
+ gsd.global_cliqueSizes = cliqueSizes;
}
Barrier.enterBarrier();
- cliqueSizes = global_cliqueSizes;
+ cliqueSizes = gsd.global_cliqueSizes;
- cp.createPartition(0, estTotCliques, myId, numThread, lss);
+ CreatePartition.createPartition(0, estTotCliques, myId, numThread, lss);
/* Generate random clique sizes. */
for (int i = lss.i_start; i < lss.i_stop; i++) {
- cliqueSizes[i] = 1 + (randomPtr.random_generate() % glb.MAX_CLIQUE_SIZE);
+ cliqueSizes[i] = (int) ( 1 + (randomPtr.random_generate() % glb.MAX_CLIQUE_SIZE));
+ if(cliqueSizes[i] < 0)
+ cliqueSizes[i] *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
}
Barrier.enterBarrier();
* Allocate memory for cliqueList
*/
- int[] firstVsInCliques;
+ int[] lastVsInCliques;
int[] firstVsInCliques;
if (myId == 0) {
lastVsInCliques = new int[estTotCliques];
- global_lastVsInCliques = lastVsInCliques;
+ gsd.global_lastVsInCliques = lastVsInCliques;
firstVsInCliques = new int[estTotCliques];
- global_firstVsInCliques = firstVsInCliques;
+ gsd.global_firstVsInCliques = firstVsInCliques;
/*
* Sum up vertices in each clique to determine the lastVsInCliques array
}
totCliques = i + 1;
- global_totCliques = totCliques;
+ gsd.global_totCliques = totCliques;
/*
* Fix the size of the last clique
Barrier.enterBarrier();
- lastVsInCliques = global_lastVsInCliques;
- firstVsInCliques = global_firstVsInCliques;
- totCliques = global_totCliques;
+ lastVsInCliques = gsd.global_lastVsInCliques;
+ firstVsInCliques = gsd.global_firstVsInCliques;
+ totCliques = gsd.global_totCliques;
/* Compute start Vertices in cliques. */
- cp.createPartition(1, totCliques, myId, numThread, lss);
- for (int i = i_start; i < i_stop; i++) {
+ CreatePartition.createPartition(1, totCliques, myId, numThread, lss);
+ for (int i = lss.i_start; i < lss.i_stop; i++) {
firstVsInCliques[i] = lastVsInCliques[i-1] + 1;
}
int[] endV;
if (numThread > 3) {
- int numByte = 1.5 * (estTotEdges/numThread);
+ int numByte = (int) (1.5 * (estTotEdges/numThread));
startV = new int[numByte];
endV = new int[numByte];
} else {
* Create edges in parallel
*/
//int i_clique;
- cp.createPartition(0, totCliques, myId, numThread, lss);
+ CreatePartition.createPartition(0, totCliques, myId, numThread, lss);
for (int i_clique = lss.i_start; i_clique < lss.i_stop; i_clique++) {
-
+
/*
* Get current clique parameters
*/
} /* for i */
if (i_cliqueSize != 1) {
- int randNumEdges = randomPtr.random_generate() % (2*i_cliqueSize*glb.MAX_PARAL_EDGES);
+ int randNumEdges = (int) (randomPtr.random_generate() % (2*i_cliqueSize*glb.MAX_PARAL_EDGES));
+ if(randNumEdges < 0)
+ randNumEdges *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
//int i_paralEdge;
for (int i_paralEdge = 0; i_paralEdge < randNumEdges; i_paralEdge++) {
int i = (int) (randomPtr.random_generate() % i_cliqueSize);
+ if(i < 0)
+ i *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
int j = (int) (randomPtr.random_generate() % i_cliqueSize);
+ if(j < 0)
+ j *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
if ((i != j) && (tmpEdgeCounter[i][j] < glb.MAX_PARAL_EDGES)) {
float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if (r >= p) {
int[] i_edgeEndCounter;
if (myId == 0) {
- i_edgeStartCounter = new int[ numThread];
- global_i_edgeStartCounter = i_edgeStartCounter;
+ i_edgeStartCounter = new int[numThread];
+ gsd.global_i_edgeStartCounter = i_edgeStartCounter;
i_edgeEndCounter = new int[numThread];
- global_i_edgeEndCounter = i_edgeEndCounter;
+ gsd.global_i_edgeEndCounter = i_edgeEndCounter;
}
Barrier.enterBarrier();
- i_edgeStartCounter = global_i_edgeStartCounter;
- i_edgeEndCounter = global_i_edgeEndCounter;
+ i_edgeStartCounter = gsd.global_i_edgeStartCounter;
+ i_edgeEndCounter = gsd.global_i_edgeEndCounter;
i_edgeEndCounter[myId] = i_edgePtr;
i_edgeStartCounter[myId] = 0;
}
atomic {
- global_edgeNum = global_edgeNum + i_edgePtr;
+ gsd.global_edgeNum = gsd.global_edgeNum + i_edgePtr;
}
Barrier.enterBarrier();
- int edgeNum = global_edgeNum;
+ int edgeNum = gsd.global_edgeNum;
/*
* Initialize edge list arrays
startVertex = new int[numByte];
endVertex = new int[numByte];
}
- global_startVertex = startVertex;
- global_endVertex = endVertex;
+ gsd.global_startVertex = startVertex;
+ gsd.global_endVertex = endVertex;
}
Barrier.enterBarrier();
- startVertex = global_startVertex;
- endVertex = global_endVertex;
+ startVertex = gsd.global_startVertex;
+ endVertex = gsd.global_endVertex;
for (int i = i_edgeStartCounter[myId]; i < i_edgeEndCounter[myId]; i++) {
startVertex[i] = startV[i-i_edgeStartCounter[myId]];
*/
i_edgePtr = 0;
- p = PROB_INTERCL_EDGES;
+ p = glb.PROB_INTERCL_EDGES;
/*
* Generating inter-clique edges as given in the specs
*/
- cp.createPartition(0, glb.TOT_VERTICES, myId, numThread, lss);
+ CreatePartition.createPartition(0, glb.TOT_VERTICES, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
int tempVertex1 = i;
int t1 = firstVsInCliques[t];
//int d;
- for (int d = 1, p = glb.PROB_INTERCL_EDGES; d < glb.TOT_VERTICES; d *= 2, p /= 2) {
+ p = glb.PROB_INTERCL_EDGES;
+ for (int d = 1; d < glb.TOT_VERTICES; d *= 2, p /= 2) {
float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
l = 0;
t = -1;
while (h - l > 1) {
- int m = (((h + l) / 2);
+ int m = (h + l) / 2;
if (tempVertex2 >= firstVsInCliques[m]) {
l = m;
} else {
if (t1 != t2) {
int randNumEdges =
- randomPtr.random_generate() % glb.MAX_PARAL_EDGES + 1;
+ (int) (randomPtr.random_generate() % glb.MAX_PARAL_EDGES + 1);
+ if(randNumEdges < 0)
+ randNumEdges *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
//int j;
for (int j = 0; j < randNumEdges; j++) {
startV[i_edgePtr] = tempVertex1;
if (t1 != t2) {
int randNumEdges =
- randomPtr.random_generate() % glb.MAX_PARAL_EDGES + 1;
+ (int) (randomPtr.random_generate() % glb.MAX_PARAL_EDGES + 1);
+ if(randNumEdges < 0)
+ randNumEdges *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
for (int j = 0; j < randNumEdges; j++) {
startV[i_edgePtr] = tempVertex1;
endV[i_edgePtr] = tempVertex2;
i_edgeStartCounter[myId] = 0;
if (myId == 0) {
- global_edgeNum = 0;
+ gsd.global_edgeNum = 0;
}
Barrier.enterBarrier();
}
atomic {
- global_edgeNum = global_edgeNum + i_edgePtr;
+ gsd.global_edgeNum = gsd.global_edgeNum + i_edgePtr;
}
Barrier.enterBarrier();
- edgeNum = global_edgeNum;
- int numEdgesPlacedOutside = global_edgeNum;
+ edgeNum = gsd.global_edgeNum;
+ int numEdgesPlacedOutside = gsd.global_edgeNum;
- for (int i = (i_edgeStartCounter[myId]; i < i_edgeEndCounter[myId]; i++) {
+ for (int i = i_edgeStartCounter[myId]; i < i_edgeEndCounter[myId]; i++) {
startVertex[i+numEdgesPlacedInCliques] = startV[i-i_edgeStartCounter[myId]];
endVertex[i+numEdgesPlacedInCliques] = endV[i-i_edgeStartCounter[myId]];
}
p = glb.PERC_INT_WEIGHTS;
int numStrWtEdges = 0;
- cp.createPartition(0, numEdgesPlaced, myId, numThread, lss);
+ CreatePartition.createPartition(0, numEdgesPlaced, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if (r <= p) {
SDGdataPtr.intWeight[i] =
- 1 + (randomPtr.random_generate() % (MAX_INT_WEIGHT-1));
+ (int) (1 + (randomPtr.random_generate() % (glb.MAX_INT_WEIGHT-1)));
+ if(SDGdataPtr.intWeight[i] < 0)
+ SDGdataPtr.intWeight[i] *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
} else {
SDGdataPtr.intWeight[i] = -1;
numStrWtEdges++;
}
atomic {
- global_numStrWtEdges = global_numStrWtEdges + numStrWtEdges;
+ gsd.global_numStrWtEdges = gsd.global_numStrWtEdges + numStrWtEdges;
}
Barrier.enterBarrier();
- numStrWtEdges = global_numStrWtEdges;
+ numStrWtEdges = gsd.global_numStrWtEdges;
if (myId == 0) {
SDGdataPtr.strWeight = new char[numStrWtEdges * glb.MAX_STRLEN];
Barrier.enterBarrier();
- cp.createPartition(0, numEdgesPlaced, myId, numThread, lss);
+ CreatePartition.createPartition(0, numEdgesPlaced, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
if (SDGdataPtr.intWeight[i] <= 0) {
if (myId == 0) {
- if (SOUGHT_STRING.length != glb.MAX_STRLEN) {
- glb.SOUGHT_STRING = new char[MAX_STRLEN];
+ if (glb.SOUGHT_STRING.length != glb.MAX_STRLEN) {
+ glb.SOUGHT_STRING = new char[glb.MAX_STRLEN];
+ //glb.SOUGHT_STRING = new String(MAX_STRLEN);
}
- int t = randomPtr.random_generate() % numStrWtEdges;
+ int t = (int) (randomPtr.random_generate() % numStrWtEdges);
+ if (t < 0)
+ t *= -1; //TODO fix the long->int casting error that creates negative numbers for randomPtr
for (int j = 0; j < glb.MAX_STRLEN; j++) {
//FIXME
- SOUGHT_STRING[j] =
- (char) (SDGdataPtr.strWeight[(t*glb.MAX_STRLEN+j)]);
+ glb.SOUGHT_STRING[j] =
+ SDGdataPtr.strWeight[(t*glb.MAX_STRLEN+j)];
}
}
*/
for (int i = lss.i_start; i < lss.i_stop; i++) {
- startVertex[i] = permV[(startVertex[i])];
- endVertex[i] = permV[(endVertex[i])];
+ startVertex[i] = permV[startVertex[i]];
+ endVertex[i] = permV[endVertex[i]];
}
Barrier.enterBarrier();
Barrier.enterBarrier();
- Alg_Radix_Smp.all_radixsort_node_aux_s3(numEdgesPlaced,
+ //Alg_Radix_Smp radixsort = new Alg_Radix_Smp(myId, numThread);
+ //radixsort.all_radixsort_node_aux_s3(numEdgesPlaced,
+ Alg_Radix_Smp.all_radixsort_node_aux_s3(myId,
+ numThread,
+ numEdgesPlaced,
startVertex,
SDGdataPtr.startVertex,
endVertex,
- SDGdataPtr.endVertex);
+ SDGdataPtr.endVertex,
+ radixsort);
Barrier.enterBarrier();
if (myId == 0) {
tempIndex = new int[glb.TOT_VERTICES + 1];
- global_tempIndex = tempIndex;
+ gsd.global_tempIndex = tempIndex;
/*
* Update degree of each vertex
Barrier.enterBarrier();
- tempIndex = global_tempIndex;
+ tempIndex = gsd.global_tempIndex;
/*
* Insertion sort for now, replace with something better later on
*/
public class GetUserParameters {
- Globals glb;
-
public GetUserParameters(Globals glb) {
- this.glb = glb;
-
/*
* Scalable Data Generator parameters - defaults
*/
glb.THREADS = 1;
glb.SCALE = 20; /* binary scaling heuristic */
glb.MAX_PARAL_EDGES = 3; /* between vertices. */
- glb.PERC_INT_WEIGHTS = 0.6; /* % int (vs. string) edge weights */
- glb.PROB_UNIDIRECTIONAL = 0.1;
- glb.PROB_INTERCL_EDGES = 0.5; /* Init probability link between cliques */
+ glb.PERC_INT_WEIGHTS = (float) 0.6f; /* % int (vs. string) edge weights */
+ glb.PROB_UNIDIRECTIONAL = (float) 0.1f;
+ glb.PROB_INTERCL_EDGES = (float) 0.5f; /* Init probability link between cliques */
glb.SUBGR_EDGE_LENGTH = 3; /* Kernel 3: max. path length, */
/* measured by num edges in subgraph */
glb.K3_DS = 2; /* 0 - Array */
/* 1 - Linked List */
/* 2 - Dynamic Array */
-
}
+
/* =============================================================================
* displayUsage
* =============================================================================
*/
- static void
+ public static void
displayUsage ()
{
- System.out.println("Usage: ./SSCA.bin [options]\n");
- System.out.println(" i <double> Probability [i]nter-clique (%f)\n", PROB_INTERCL_EDGES);
- System.out.println(" k <int> [k]ind: 0=array 1=list 2=vector (%li)\n", K3_DS);
- System.out.println(" l <int> Max path [l]ength (%li)\n", SUBGR_EDGE_LENGTH);
- System.out.println(" p <int> Max [p]arallel edges (%li)\n", MAX_PARAL_EDGES);
- System.out.println(" s <int> Problem [s]cale (%li)\n", SCALE);
- System.out.println(" t <int> Number of [t]hreads (%li)\n", THREADS);
- System.out.println(" u <double> Probability [u]nidirectional (%f)\n", PROB_UNIDIRECTIONAL);
- System.out.println(" w <double> Fraction integer [w]eights (%f)\n", PERC_INT_WEIGHTS);
+ System.out.println("Usage: ./SSCA.bin [options]");
+ System.out.println(" i <float> Probability [i]nter-clique ");
+ System.out.println(" k <int> [k]ind: 0=array 1=list 2=vector ");
+ System.out.println(" l <int> Max path [l]ength ");
+ System.out.println(" p <int> Max [p]arallel edges ");
+ System.out.println(" s <int> Problem [s]cale ");
+ System.out.println(" t <int> Number of [t]hreads ");
+ System.out.println(" u <float> Probability [u]nidirectional ");
+ System.out.println(" w <float> Fraction integer [w]eights ");
System.exit(-1);
}
* parseArgs
* =============================================================================
*/
- public static void
- parseArgs(String[] args)
+ public void
+ parseArgs(String[] args, Globals glb)
{
int i = 0;
String arg;
//check options
if(arg.equals("-i")) {
if(i < args.length) {
- glb.PROB_INTERCL_EDGES = new Integer(args[i++]).doubleValue();
+ glb.PROB_INTERCL_EDGES = new Integer(args[i++]).floatValue();
}
} else if(arg.equals("-k")) {
if(i < args.length) {
glb.K3_DS = new Integer(args[i++]).intValue();
}
- if(!(glb.K3_DS >=0 && K3_DS <=2))
+ if(!(glb.K3_DS >=0 && glb.K3_DS <=2))
System.out.println("Input a valid number for -k option between >=0 and <= 2");
} else if(arg.equals("-l")) {
if(i < args.length) {
}
} else if(arg.equals("-u")) {
if(i < args.length) {
- glb.PROB_UNIDIRECTIONAL = new Integer(args[i++]).doubleValue();
+ glb.PROB_UNIDIRECTIONAL = new Integer(args[i++]).floatValue();
}
} else if(arg.equals("-w")) {
if(i < args.length) {
- glb.PERC_INT_WEIGHTS = new Integer(args[i++]).doubleValue();
+ glb.PERC_INT_WEIGHTS = new Integer(args[i++]).floatValue();
}
} else if(arg.equals("-h")) {
displayUsage();
* getUserParameters
* =============================================================================
*/
- static void
- getUserParameters (String[] argv)
+ public void
+ getUserParameters (String[] argv, Globals glb)
{
/*
* Scalable Data Generator parameters - defaults
glb.THREADS = 1;
glb.SCALE = 20; /* binary scaling heuristic */
glb.MAX_PARAL_EDGES = 3; /* between vertices. */
- glb.PERC_INT_WEIGHTS = 0.6; /* % int (vs. string) edge weights */
- glb.PROB_UNIDIRECTIONAL = 0.1;
- glb.PROB_INTERCL_EDGES = 0.5; /* Init probability link between cliques */
+ glb.PERC_INT_WEIGHTS = (float)0.6; /* % int (vs. string) edge weights */
+ glb.PROB_UNIDIRECTIONAL = (float)0.1;
+ glb.PROB_INTERCL_EDGES = (float)0.5; /* Init probability link between cliques */
glb.SUBGR_EDGE_LENGTH = 3; /* Kernel 3: max. path length, */
/* measured by num edges in subgraph */
/* 1 - Linked List */
/* 2 - Dynamic Array */
- parseArgs(argv); /* overrides default values set above */
+ parseArgs(argv, glb); /* overrides default values set above */
glb.TOT_VERTICES = (1<<glb.SCALE);
glb.MAX_INT_WEIGHT = (1<<glb.SCALE); /* Max int value in edge weight */
glb.MAX_STRLEN = glb.SCALE;
- glb.SOUGHT_STRING = ""; /* Kernel 2: Character string sought: */
+ glb.SOUGHT_STRING = new char[1]; /* Kernel 2: Character string sought: */
/* specify here, else it is picked */
/* picked from randomly selected entry */
/* in genScalData.c */
public float PROB_INTERCL_EDGES;
public int SUBGR_EDGE_LENGTH;
public int MAX_CLUSTER_SIZE;
- public int MAX_STRLEN;
public int K3_DS;
public int THREADS;
}
public int[] outVertexList;
public int[] paralEdgeIndex;
- public int inDegree;
- public int inVertexIndex;
- public int inVertexList;
+ public int[] inDegree;
+ public int[] inVertexIndex;
+ public int[] inVertexList;
public int[] intWeight;
public char[] strWeight;
int i_stop;
public LocalStartStop() {
- i_start = 0L;
- i_stop = 0L;
- }
-
- public static void init() {
- i_start = 0L;
- i_stop = 0L;
+ i_start = 0;
+ i_stop = 0;
}
}
To build the application, simply run:
- make -f <makefile>
+ make
-in the source directory. For example, for the sequential flavor, run:
-
- make -f Makefile.seq
-
-By default, this produces an executable named "yada", which can then be
+By default, this produces an executable named "SSCA2.bin", which can then be
run in the following manner:
- ./ssca2 -i <probability_of_inter_clique> \
+ ./SSCA2.bin -i <probability_of_inter_clique> \
-k <data_structure_kind> \
-l <max_path_length> \
-p <max_number_of_parallel_edges> \
The following arguments are recommended for simulated runs:
- -s13 -i1.0 -u1.0 -l3 -p3
+ -s 13 -i 1.0 -u 1.0 -l 3 -p 3 -t 1
For non-simulator runs, a larger input can be used:
- -s20 -i1.0 -u1.0 -l3 -p3
+ -s 20 -i 1.0 -u 1.0 -l 3 -p 3 -t 1
References
--- /dev/null
+/* =============================================================================
+ *
+ * ssca2.java
+ *
+ * =============================================================================
+ *
+ * Unless otherwise noted, the following license applies to STAMP files:
+ *
+ * Copyright (c) 2007, Stanford University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Stanford University nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * =============================================================================
+ */
+
+public class SSCA2 extends Thread {
+ /*
+ * Tuple for Scalable Data Generation
+ * stores startVertex, endVertex, long weight and other info
+ */
+ GraphSDG SDGdata;
+
+ /**
+ * The graph data structure for this benchmark - see defs.h
+ **/
+ Graph G;
+
+ /**
+ *
+ */
+ ComputeGraph computeGraphArgs;
+
+ /**
+ * thread id
+ **/
+ int threadid;
+
+ /**
+ * Total number of threads
+ **/
+ int numThread;
+
+ /**
+ * Global Arguments
+ **/
+ Globals glb;
+
+
+ /**
+ * Gen scalable data
+ **/
+ GenScalData gsd;
+
+ /**
+ **
+ **/
+ GetStartLists getStartListsArg;
+
+
+ Alg_Radix_Smp radixsort;
+
+ public SSCA2(int myId, int numThread, Globals glb, ComputeGraph computeGraphArgs,
+ GenScalData gsd, GetStartLists getStartListsArg, Alg_Radix_Smp radixsort) {
+ this.threadid = myId;
+ this.numThread = numThread;
+ this.glb = glb;
+ this.computeGraphArgs = computeGraphArgs;
+ this.G = computeGraphArgs.GPtr;
+ this.SDGdata = computeGraphArgs.SDGdataPtr;
+ this.gsd = gsd;
+ this. getStartListsArg = getStartListsArg;
+ this.radixsort = radixsort;
+ }
+
+ public void run() {
+
+#ifdef ENABLE_KERNEL1
+ /* Generate Scaldata */
+ Barrier.enterBarrier();
+ GenScalData.genScalData(threadid, numThread, glb, SDGdata, gsd, radixsort);
+ Barrier.enterBarrier();
+
+ /* Kernel 1 */
+ Barrier.enterBarrier();
+ ComputeGraph.computeGraph(threadid, numThread, glb, computeGraphArgs);
+ Barrier.enterBarrier();
+#endif /* Enable Kernel1 */
+
+#ifdef ENABLE_KERNEL2
+ /* Kernel 2 */
+ Barrier.enterBarrier();
+ GetStartLists.getStartLists(threadid, numThread, glb, getStartListsArg);
+ Barrier.enterBarrier();
+#endif /* Enable Kernel2 */
+ }
+
+ /* =============================================================================
+ * main
+ * =============================================================================
+ */
+ public static void main(String[] args) {
+ /*
+ * Tuple for Scalable Data Generation
+ * stores startVertex, endVertex, long weight and other info
+ */
+ GraphSDG SDGdata = new GraphSDG();
+
+ /*
+ * The graph data structure for this benchmark - see defs.h
+ */
+ Graph G = new Graph();
+
+ /*
+ * The Global arguments
+ */
+ ComputeGraph computeGraphArgs = new ComputeGraph();
+
+ computeGraphArgs.GPtr = G;
+ computeGraphArgs.SDGdataPtr = SDGdata;
+ /* -------------------------------------------------------------------------
+ * Preamble
+ * -------------------------------------------------------------------------
+ */
+
+ /*
+ * User Interface: Configurable parameters, and global program control
+ */
+
+ System.out.println("\nHPCS SSCA #2 Graph Analysis Executable Specification:");
+ System.out.println("\nRunning...\n\n");
+
+ Globals glb = new Globals();
+
+ GetUserParameters gup = new GetUserParameters(glb);
+ gup.getUserParameters(args, glb);
+
+ System.out.println("Number of processors: " + glb.THREADS);
+ System.out.println("Problem Scale: " + glb.SCALE);
+ System.out.println("Max parallel edges: " + glb.MAX_PARAL_EDGES);
+ System.out.println("Percent int weights: " + glb.PERC_INT_WEIGHTS);
+ System.out.println("Probability unidirectional: " + glb.PROB_UNIDIRECTIONAL);
+ System.out.println("Probability inter-clique: " + glb.PROB_INTERCL_EDGES);
+ System.out.println("Subgraph edge length: " + glb.SUBGR_EDGE_LENGTH);
+ System.out.println("Kernel 3 data structure: " + glb.K3_DS);
+
+ /* Initiate Barriers */
+ Barrier.setBarrier(glb.THREADS);
+
+ SSCA2[] ssca = new SSCA2[glb.THREADS];
+ int nthreads = glb.THREADS;
+
+ GenScalData gsd = new GenScalData();
+
+ Alg_Radix_Smp radixsort = new Alg_Radix_Smp();
+
+ GetStartLists getStartListsArg = new GetStartLists();
+ getStartListsArg.GPtr = G;
+
+ /* Create and Start Threads */
+ for(int i = 1; i<nthreads; i++) {
+ ssca[i] = new SSCA2(i, nthreads, glb, computeGraphArgs, gsd, getStartListsArg, radixsort);
+ }
+
+ for(int i = 1; i<nthreads; i++) {
+ ssca[i].start();
+ }
+
+
+#ifdef ENABLE_KERNEL1
+
+ /*
+ * Scalable Data Generator
+ */
+ System.out.println("\nScalable Data Generator - genScalData() beginning execution...\n");
+ parallel_work_genScalData(nthreads, glb, SDGdata, gsd, radixsort);
+ System.out.println("\n\tgenScalData() completed execution.");
+
+ /* -------------------------------------------------------------------------
+ * Kernel 1 - Graph Construction
+ *
+ * From the input edges, construct the graph 'G'
+ * -------------------------------------------------------------------------
+ */
+ System.out.println("\nKernel 1 - computeGraph() beginning execution...");
+ parallel_work_computeGraph(nthreads, glb, computeGraphArgs);
+ System.out.println("\n\tcomputeGraph() completed execution.\n");
+
+#endif
+
+
+#ifdef ENABLE_KERNEL2
+
+ /* -------------------------------------------------------------------------
+ * Kernel 2 - Find Max weight and sought string
+ * -------------------------------------------------------------------------
+ */
+
+ System.out.println("\nKernel 2 - getStartLists() beginning execution...\n");
+ parallel_work_getStartLists(nthreads, glb, getStartListsArg);
+ System.out.println("\n\tgetStartLists() completed execution.\n");
+
+#endif // ENABLE_KERNEL2
+
+#ifdef ENABLE_KERNEL3
+
+# ifndef ENABLE_KERNEL2
+# error KERNEL3 requires KERNEL2
+# endif
+#endif
+
+#ifdef ENABLE_KERNEL3
+
+ /* -------------------------------------------------------------------------
+ * Kernel 3 - Graph Extraction
+ * -------------------------------------------------------------------------
+ */
+ VList[] intWtVList = null;
+ VList[] strWtVList = null;
+
+ System.out.println("\nKernel 3 - FindSubGraphs() beginning execution...\n");
+
+ if (glb.K3_DS == 0) {
+ intWtVList = new VList[G.numVertices * getStartListsArg.maxIntWtListSize];
+ strWtVList = new VList[G.numVertices * getStartListsArg.soughtStrWtListSize];
+
+ FindSubGraphs0_arg_t findSubGraphs0Arg;
+ findSubGraphs0Arg.GPtr = G;
+ findSubGraphs0Arg.intWtVList = intWtVList;
+ findSubGraphs0Arg.strWtVList = strWtVList;
+ findSubGraphs0Arg.maxIntWtList = getStartListsArg.maxIntWtList;
+ findSubGraphs0Arg.maxIntWtListSize = getStartListsArg.maxIntWtListSize;
+ findSubGraphs0Arg.soughtStrWtList = getStartListsArg.soughtStrWtList;
+ findSubGraphs0Arg.soughtStrWtListSize = getStartListsArg.soughtStrWtListSize;
+
+ parallel_work_FindSubGraphs0(findSubGraphs0Arg);
+
+ } else if (K3_DS == 1) {
+
+ intWtVList = new VL[getStartListsArg.maxIntWtListSize];
+ strWtVList = new VL[getStartListsArg.soughtStrWtListSize];
+
+ FindSubGraphs1_arg_t findSubGraphs1Arg;
+ findSubGraphs1Arg.GPtr = G;
+ findSubGraphs1Arg.intWtVLList = intWtVLList;
+ findSubGraphs1Arg.strWtVLList = strWtVLList;
+ findSubGraphs1Arg.maxIntWtList = maxIntWtList;
+ findSubGraphs1Arg.maxIntWtListSize = maxIntWtListSize;
+ findSubGraphs1Arg.soughtStrWtList = soughtStrWtList;
+ findSubGraphs1Arg.soughtStrWtListSize = soughtStrWtListSize;
+
+ parallel_work_FindSubGraphs1(findSubGraphs1Arg);
+
+ } else if (K3_DS == 2) {
+
+ intWtVList = new VL[getStartListsArg.maxIntWtListSize];
+ strWtVList = new VL[getStartListsArg.soughtStrWtListSize];
+
+ FindSubGraphs2_arg_t findSubGraphs2Arg;
+ findSubGraphs2Arg.GPtr = G;
+ findSubGraphs2Arg.intWtVDList = intWtVDList;
+ findSubGraphs2Arg.strWtVDList = strWtVDList;
+ findSubGraphs2Arg.maxIntWtList = maxIntWtList;
+ findSubGraphs2Arg.maxIntWtListSize = maxIntWtListSize;
+ findSubGraphs2Arg.soughtStrWtList = soughtStrWtList;
+ findSubGraphs2Arg.soughtStrWtListSize = soughtStrWtListSize;
+
+ parallel_work_FindSubGraphs2(findSubGraphs2Arg);
+
+ } else {
+ ;
+ }
+
+ System.out.println("\n\tFindSubGraphs() completed execution.\n");
+ System.out.println("\nTime taken for kernel 3 is %9.6f sec.\n\n", time);
+
+#endif /* ENABLE_KERNEL3 */
+
+#ifdef ENABLE_KERNEL4
+
+ /* -------------------------------------------------------------------------
+ * Kernel 4 - Graph Clustering
+ * -------------------------------------------------------------------------
+ */
+
+ System.out.println("\nKernel 4 - cutClusters() beginning execution...\n");
+ parallel_work_cutClusters(G);
+ System.out.println("\n\tcutClusters() completed execution.\n");
+
+#endif /* ENABLE_KERNEL4 */
+
+ System.exit(0);
+ }
+
+ /**
+ * Work done by primary thread in parallel with other threads
+ **/
+#ifdef ENABLE_KERNEL1
+
+ public static void parallel_work_genScalData(int numThread, Globals glb, GraphSDG SDGdata, GenScalData gsd, Alg_Radix_Smp radixsort) {
+ Barrier.enterBarrier();
+ GenScalData.genScalData(0, numThread, glb, SDGdata, gsd, radixsort); // threadId = 0 because primary thread
+ Barrier.enterBarrier();
+ }
+
+ public static void parallel_work_computeGraph(int numThread, Globals glb, ComputeGraph computeGraphArgs) {
+ Barrier.enterBarrier();
+ ComputeGraph.computeGraph(0, numThread, glb, computeGraphArgs);
+ Barrier.enterBarrier();
+ }
+
+#endif
+
+#ifdef ENABLE_KERNEL2
+
+ public static void parallel_work_getStartLists(int numThread, Globals glb, GetStartLists getStartListsArg) {
+ Barrier.enterBarrier();
+ GetStartLists.getStartLists(0, numThread, glb, getStartListsArg);
+ Barrier.enterBarrier();
+ }
+
+#endif
+
+#ifdef ENABLE_KERNEL3
+
+ public static void parallel_work_FindSubGraphs0(FindSubGraphs0_arg_t findSubGraphs0Arg) {
+ Barrier.enterBarrier();
+ Barrier.enterBarrier();
+ }
+
+ public static void parallel_work_FindSubGraphs1(FindSubGraphs1_arg_t findSubGraphs1Arg) {
+ Barrier.enterBarrier();
+ Barrier.enterBarrier();
+ }
+
+ public static void parallel_work_FindSubGraphs2(FindSubGraphs2_arg_t findSubGraphs2Arg) {
+ Barrier.enterBarrier();
+ Barrier.enterBarrier();
+ }
+
+#endif
+
+#ifdef ENABLE_KERNEL4
+
+ public static void parallel_work_cutClusters(Graph G) {
+ Barrier.enterBarrier();
+ Barrier.enterBarrier();
+ }
+
+#endif
+
+}
+
+/* =============================================================================
+ *
+ * End of ssca2.java
+ *
+ * =============================================================================
+ */
/* Vertex list returned by Kernel 3 */
public class VList {
- public long num;
- public long depth;
+ public int num;
+ public int depth;
public VList() {
}
-
}
--- /dev/null
+public class Random {
+ long[] mt;
+ int mti;
+ long RANDOM_DEFAULT_SEED;
+ /* period parameter */
+ int N;
+ int M;
+ long MATRIX_A;
+ long UPPER_MASK;
+ long LOWER_MASK;
+
+ public Random() {
+ RANDOM_DEFAULT_SEED = 0L;
+ N = 624;
+ M = 397;
+ mt = new long[N];
+ mti = N;
+ MATRIX_A = 0x9908b0dfL; /* constant vector a */
+ UPPER_MASK = 0x80000000L; /* most significant w-r bits */
+ LOWER_MASK = 0x7fffffffL; /* least significant r bits */
+ }
+
+ public void random_alloc() {
+ init_genrand(this.RANDOM_DEFAULT_SEED);
+ }
+
+ /* initializes mt[N] with a seed */
+ public void init_genrand(long s) {
+ int mti;
+ mt[0]= s & 0xFFFFFFFFL;
+ for (mti=1; mti<N; mti++) {
+ mt[mti] = (1812433253L * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
+ /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
+ /* In the previous versions, MSBs of the seed affect */
+ /* only MSBs of the array mt[]. */
+ /* 2002/01/09 modified by Makoto Matsumoto */
+ mt[mti] &= 0xFFFFFFFFL;
+ /* for >32 bit machines */
+ }
+ this.mti=mti;
+ }
+
+ public void random_seed(long seed) {
+ init_genrand(seed);
+ }
+
+ public long random_generate() {
+ return genrand_int32();
+ }
+
+ public long genrand_int32() {
+ long y;
+ long[] mag01= new long[2];
+ mag01[0] = 0x0L;
+ mag01[1] = MATRIX_A;
+ int mti = this.mti;
+
+ /* mag01[x] = x * MATRIX_A for x=0,1 */
+
+ if (mti >= N) { /* generate N words at one time */
+ int kk;
+
+ if (mti == N+1) /* if init_genrand() has not been called, */
+ init_genrand(5489L); /* a default initial seed is used */
+
+ for (kk=0;kk<N-M;kk++) {
+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
+ mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[(int)(y & 0x1L)];
+ }
+ for (;kk<N-1;kk++) {
+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
+ mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[(int)(y & 0x1L)];
+ }
+ y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
+ mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[(int)(y & 0x1L)];
+
+ mti = 0;
+ }
+
+ y = mt[mti++];
+
+ /* Tempering */
+ y ^= (y >> 11);
+ y ^= (y << 7) & 0x9d2c5680L;
+ y ^= (y << 15) & 0xefc60000L;
+ y ^= (y >> 18);
+
+ this.mti = mti;
+
+ return y;
+ }
+}
return (double)value;
}
+ public float floatValue() {
+ return (float)value;
+ }
+
public byte[] intToByteArray() {
byte[] b = new byte[4];
for (int i = 0; i < 4; i++) {
FlatSESEExitNode stop,
PrintWriter output) {
- System.out.println( "generating code, stop="+stop );
+ //System.out.println( "generating code, stop="+stop );
/* Assign labels to FlatNode's if necessary.*/
Hashtable<FlatNode, Integer> nodetolabel=assignLabels(first, stop);
visited.add(current_node);
if (nodetolabel.containsKey(current_node)) {
- System.out.println( " *"+current_node+" preceeded with label "+nodetolabel.get(current_node) );
+ //System.out.println( " *"+current_node+" preceeded with label "+nodetolabel.get(current_node) );
output.println("L"+nodetolabel.get(current_node)+":");
}
}
+ /*
if( nodetolabel.get(nn) != null ) {
System.out.println( " "+nn+" has label "+nodetolabel.get(nn) );
}
+ */
}
}