*/
public class Alg_Radix_Smp {
- long[] global_myHisto;
- long[] global_psHisto;
- long[] global_lTemp;
- long[] global_lTemp2;
+ int[] global_myHisto;
+ int[] global_psHisto;
+ int[] global_lTemp;
+ int[] global_lTemp2;
int myId;
int numThread;
}
public int BITS(x, k, j) {
- int retval = (int) ((x>>k) & ~(~0<<j));
+ int retval = ((x>>k) & ~(~0<<j));
return retval;
}
* =============================================================================
*/
void
- all_countsort_node (long q,
- long[] lKey,
- long[] lSorted,
- long R,
- long bitOff,
- long m,
+ all_countsort_node (int q,
+ int[] lKey,
+ int[] lSorted,
+ int R,
+ int bitOff,
+ int m,
)
{
- long[] myHisto = null;
- long[] psHisto = null;
+ int[] myHisto = null;
+ int[] psHisto = null;
if (myId == 0) {
- myHisto = new long[numThread*R];
+ myHisto = new int[numThread*R];
global_myHisto = myHisto;
- psHisto = new long[numThread*R];
+ psHisto = new int[numThread*R];
global_psHisto = psHisto;
}
myHisto = global_myHisto;
psHisto = global_psHisto;
- long index = myId * R;
+ int index = myId * R;
- for (int k = (int) index; k < index+R; k++) {
+ for (int k = index; k < index+R; k++) {
myHisto[k] = 0;
}
LocalStartStop lss = new LocalStartStop();
- CreatePartition.createPartition(0, (int) q, myId, numThread, lss);
+ CreatePartition.createPartition(0, q, myId, numThread, lss);
for (int k = lss.i_start; k < i_stop; k++) {
- myHisto[(int) (myId * R) + BITS(lKey[k],bitOff,m)]++;
+ myHisto[(myId * R) + BITS(lKey[k],bitOff,m)]++;
}
Barrier.enterBarrier();
- CreatePartition.createPartition(0, (int) R, myId, numThread, lss);
+ CreatePartition.createPartition(0, R, myId, numThread, lss);
- long last;
+ int last;
for (int k = lss.i_start; k < lss.i_stop; k++) {
last = psHisto[k] = myHisto[k];
for (int j = 1; j < numThread; j++) {
- long temp = psHisto[(int)(j*R) + k] = last + myHisto[(int)(j*R) + k];
+ int temp = psHisto[(j*R) + k] = last + myHisto[(j*R) + k];
last = temp;
}
}
Barrier.enterBarrier();
- long offset = 0;
+ int offset = 0;
for (k = 0; k < R; k++) {
- myHisto[(int)(myId * R) + k] = (psHisto[(int)(myId * R) + k] - myHisto[(int)(myId * R) + k]) + offset;
- offset += psHisto[(int)((numThread - 1) * R) + k];
+ myHisto[(myId * R) + k] = (psHisto[(myId * R) + k] - myHisto[(myId * R) + k]) + offset;
+ offset += psHisto[((numThread - 1) * R) + k];
}
Barrier.enterBarrier();
for (int k = lss.i_start; k < lss.i_stop; k++) {
int j = BITS(lKey[k],bitOff,m);
- lSorted[myHisto[(int)(myId * R) + j]] = lKey[k];
- myHisto[(int)(myId * R) + j]++;
+ lSorted[myHisto[(myId * R) + j]] = lKey[k];
+ myHisto[(myId * R) + j]++;
}
Barrier.enterBarrier();
* =============================================================================
*/
void
- all_countsort_node_aux_seq (long q,
- long[] lKey,
- long[] lSorted,
- long[] auxKey,
- long[] auxSorted,
- long R,
- long bitOff,
- long m)
+ all_countsort_node_aux_seq (int q,
+ int[] lKey,
+ int[] lSorted,
+ int[] auxKey,
+ int[] auxSorted,
+ int R,
+ int bitOff,
+ int m)
{
- long[] myHisto = new long[(int) R];
- long[] psHisto = new long[(int) R];
+ int[] myHisto = new int[ R];
+ int[] psHisto = new int[ R];
for (int k = 0; k < R; k++) {
myHisto[k] = 0;
myHisto[BITS(lKey[k],bitOff,m)]++;
}
- long last;
- for (int k = 0; k < (int)R; k++) {
+ int last;
+ for (int k = 0; k < R; k++) {
last = psHisto[k] = myHisto[k];
}
- long offset = 0;
+ int offset = 0;
- for (int k = 0; k < (int)R; k++) {
+ for (int k = 0; k < R; k++) {
myHisto[k] = (psHisto[k] - myHisto[k]) + offset;
offset += psHisto[k];
}
- for (int k = 0; k < (int) q; k++) {
+ for (int k = 0; k < q; k++) {
int j = BITS(lKey[k], bitOff, m);
lSorted[myHisto[j]] = lKey[k];
auxSorted[myHisto[j]] = lKey[k];
* =============================================================================
*/
void
- all_countsort_node_aux (long q,
- long[] lKey,
- long[] lSorted,
- long[] auxKey,
- long[] auxSorted,
- long R,
- long bitOff,
- long m)
+ all_countsort_node_aux (int q,
+ int[] lKey,
+ int[] lSorted,
+ int[] auxKey,
+ int[] auxSorted,
+ int R,
+ int bitOff,
+ int m)
{
- long[] myHisto = null;
- long[] psHisto = null;
+ int[] myHisto = null;
+ int[] psHisto = null;
if (myId == 0) {
- myHisto = new long[numThread * R];
+ myHisto = new int[numThread * R];
global_myHisto = myHisto;
- psHisto = new long[numThread * R];
+ psHisto = new int[numThread * R];
global_psHisto = psHisto;
}
myHisto = global_myHisto;
psHisto = global_psHisto;
- for (int k = 0; k < (int) R; k++) {
- myHisto[(int)((myId*R) + k)] = 0;
+ for (int k = 0; k < R; k++) {
+ myHisto[((myId*R) + k)] = 0;
}
LocalStartStop lss = new LocalStartStop();
CreatePartition.createPartition(0, q, myId, numThread, lss);
for (int k = lss.i_start; k < lss.i_stop; k++) {
- myHisto[(int)(myId*R) + BITS(lKey[k],bitOff,m)]++;
+ myHisto[(myId*R) + BITS(lKey[k],bitOff,m)]++;
}
Barrier.enterBarrier();
CreatePartition.createPartition(0, R, myId, numThread, lss);
- long last;
+ int last;
for (int k = lss.i_start; k < lss.i_stop; k++) {
last = psHisto[k] = myHisto[k];
for (int j = 1; j < numThread; j++) {
- long temp = psHisto[(int)(j*R + k)] = last + myHisto[(int) (j*R + k)];
+ int temp = psHisto[(j*R + k)] = last + myHisto[ (j*R + k)];
last = temp;
}
}
Barrier.enterBarrier();
- long offset = 0;
+ int offset = 0;
- for (int k = 0; k < (int)R; k++) {
- myHisto[(int)(myId*R) +k] = (psHisto[(int) ((myId*R) + k)] - myHisto[(int) ((myId*R) +k])) + offset;
- offset += psHisto[(int)((numThread -1) * 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];
}
Barrier.enterBarrier();
for (int k = lss.i_start; k < lss.i_stop; k++) {
int j = BITS(lKey[k], bitOff, m);
- lSorted[myHisto[(int)(myId*R) +j]] = lKey[k];
- auxSorted[myHisto[(int)(myId*R) +j]] = auxKey[k];
- myHisto[(int)(myId*R) +j]++;
+ lSorted[myHisto[(myId*R) +j]] = lKey[k];
+ auxSorted[myHisto[(myId*R) +j]] = auxKey[k];
+ myHisto[(myId*R) +j]++;
}
Barrier.enterBarrier();
* =============================================================================
*/
void
- all_radixsort_node_s3 (long q,
- long[] lKeys,
- long[] lSorted)
+ all_radixsort_node_s3 (int q,
+ int[] lKeys,
+ int[] lSorted)
{
- long[] lTemp = null;
+ int[] lTemp = null;
if (myId == 0) {
- lTemp = new long[(int) q];
+ lTemp = new int[ q];
global_lTemp = lTemp;
}
* =============================================================================
*/
void
- all_radixsort_node_s2 (long q,
- long[] lKeys,
- long[] lSorted)
+ all_radixsort_node_s2 (int q,
+ int[] lKeys,
+ int[] lSorted)
{
- long[] lTemp = null;
+ int[] lTemp = null;
if (myId == 0) {
- lTemp = new long[(int) q];
+ lTemp = new int[ q];
global_lTemp = lTemp;
}
* =============================================================================
*/
void
- all_radixsort_node_aux_s3_seq (long q,
- long[] lKeys,
- long[] lSorted,
- long[] auxKey,
- long[] auxSorted)
+ all_radixsort_node_aux_s3_seq (int q,
+ int[] lKeys,
+ int[] lSorted,
+ int[] auxKey,
+ int[] auxSorted)
{
- long[] lTemp = null;
- long[] lTemp2 = null;
+ int[] lTemp = null;
+ int[] lTemp2 = null;
- lTemp = new long[(int) q];
- lTemp2 = new long[(int) q];
+ lTemp = new int[ q];
+ lTemp2 = new int[ q];
all_countsort_node_aux_seq(q, lKeys, lSorted, auxKey, auxSorted, (1<<11), 0, 11);
all_countsort_node_aux_seq(q, lSorted, lTemp, auxSorted, lTemp2, (1<<11), 11, 11);
* =============================================================================
*/
public static void
- all_radixsort_node_aux_s3 (long q,
- long[] lKeys,
- long[] lSorted,
- long[] auxKey,
- long[] auxSorted)
+ all_radixsort_node_aux_s3 (int q,
+ int[] lKeys,
+ int[] lSorted,
+ int[] auxKey,
+ int[] auxSorted)
{
- long[] lTemp = null;
- long[] lTemp2 = null;
+ int[] lTemp = null;
+ int[] lTemp2 = null;
if (myId == 0) {
- lTemp = new long[(int) q];
+ lTemp = new int[ q];
global_lTemp = lTemp;
- lTemp2 = new long[(int) q];
+ lTemp2 = new int[ q];
global_lTemp2 = lTemp2;
}
public Graph GPtr;
public GraphSDG SDGdataPtr;
- public long[] global_p;
- public long global_maxNumVertices;
- public long global_outVertexListSize;
- public long[] global_impliedEdgeList;
- public long[][] global_auxArr;
+ public int[] global_p;
+ public int global_maxNumVertices;
+ public int global_outVertexListSize;
+ public int[] global_impliedEdgeList;
+ public int[][] global_auxArr;
public ComputeGraph() {
global_p = null;
* =============================================================================
*/
public void
- prefix_sums (int myId, int numThread, long[] result, long[] input, int arraySize)
+ prefix_sums (int myId, int numThread, int[] result, int[] input, int arraySize)
{
- long[] p;
+ int[] p;
if (myId == 0) {
- p = new long[NOSHARE(numThread)];
+ p = new int[NOSHARE(numThread)];
global_p = p;
}
p = global_p;
- long start;
- long end;
+ int start;
+ int end;
- long r = arraySize / numThread;
+ int r = arraySize / numThread;
start = myId * r + 1;
end = (myId + 1) * r;
if (myId == (numThread - 1)) {
end = arraySize;
}
- for (int j = (int) start; j < (int) end; j++) {
+ for (int j = start; j < end; j++) {
result[j] = input[j-1] + result[j-1];
}
Barrier.enterBarrier();
if (myId > 0) {
- long add_value = p[NOSHARE(myId-1)];
+ int add_value = p[NOSHARE(myId-1)];
for (j = start-1; j < end; j++) {
result[j] += add_value;
}
* =============================================================================
*/
public static void
- computeGraph (int myId, int numThread, Graph GPtr, GraphSDG SDGdataPtrGlobals glb)
+ computeGraph (int myId, int numThread, Globals glb, ComputeGraph computeGraphArgs)
+
{
Barrier.enterBarrier();
+ //Graph GPtr = computeGraphArgs.GPtr;
+ //GraphSDG SDGdataPtr = computeGraphArgs.SDGdata;
+
int j;
- long maxNumVertices = 0;
- int numEdgesPlaced = SDGdataPtr.numEdgesPlaced;
+ int maxNumVertices = 0;
+ int numEdgesPlaced = computeGraphArgs.SDGdataPtr.numEdgesPlaced;
/*
* First determine the number of vertices by scanning the tuple
CreatePartition.createPartition(0, numEdgesPlaced, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
- if (SDGdataPtr.startVertex[i] > maxNumVertices) {
- maxNumVertices = SDGdataPtr.startVertex[i];
+ if (computeGraphArgs.SDGdataPtr.startVertex[i] > maxNumVertices) {
+ maxNumVertices = computeGraphArgs.SDGdataPtr.startVertex[i];
}
}
atomic {
- long tmp_maxNumVertices = global_maxNumVertices;
- long new_maxNumVertices = CreatePartition.MAX((int) tmp_maxNumVertices, maxNumVertices) + 1;
+ int tmp_maxNumVertices = global_maxNumVertices;
+ int new_maxNumVertices = CreatePartition.MAX( tmp_maxNumVertices, maxNumVertices) + 1;
global_maxNumVertices = new_maxNumVertices;
- /*
- long tmp_maxNumVertices = (long)TM_SHARED_READ(global_maxNumVertices);
- long new_maxNumVertices = MAX(tmp_maxNumVertices, maxNumVertices) + 1;
- TM_SHARED_WRITE(global_maxNumVertices, new_maxNumVertices);
- */
}
Barrier.enterBarrier();
if (myId == 0) {
- GPtr.numVertices = maxNumVertices;
- GPtr.numEdges = numEdgesPlaced;
- GPtr.intWeight = SDGdataPtr.intWeight;
- GPtr.strWeight = SDGdataPtr.strWeight;
+ computeGraphArgs.GPtr.numVertices = maxNumVertices;
+ computeGraphArgs.GPtr.numEdges = numEdgesPlaced;
+ computeGraphArgs.GPtr.intWeight = computeGraphArgs.SDGdataPtr.intWeight;
+ computeGraphArgs.GPtr.strWeight = computeGraphArgs.SDGdataPtr.strWeight;
for (int i = 0; i < numEdgesPlaced; i++) {
- if (GPtr.intWeight[numEdgesPlaced-i-1] < 0) {
- GPtr.numStrEdges = -(GPtr.intWeight[numEdgesPlaced-i-1]) + 1;
- GPtr.numIntEdges = numEdgesPlaced - GPtr.numStrEdges;
+ if (computeGraphArgs.GPtr.intWeight[numEdgesPlaced-i-1] < 0) {
+ computeGraphArgs.GPtr.numStrEdges = -(computeGraphArgs.GPtr.intWeight[numEdgesPlaced-i-1]) + 1;
+ computeGraphArgs.GPtr.numIntEdges = numEdgesPlaced - computeGraphArgs.GPtr.numStrEdges;
break;
}
}
- GPtr.outDegree = new long[GPtr.numVertices];
+ computeGraphArgs.GPtr.outDegree = new int[computeGraphArgs.GPtr.numVertices];
- GPtr.outVertexIndex = new long[GPtr.numVertices];
+ computeGraphArgs.GPtr.outVertexIndex = new int[computeGraphArgs.GPtr.numVertices];
}
Barrier.enterBarrier();
- CreatePartition.createPartition(0, GPtr.numVertices, myId, numThread, lss);
+ CreatePartition.createPartition(0, computeGraphArgs.GPtr.numVertices, myId, numThread, lss);
for (i = lss.i_start; i < lss.i_stop; i++) {
- GPtr.outDegree[i] = 0;
- GPtr.outVertexIndex[i] = 0;
+ computeGraphArgs.GPtr.outDegree[i] = 0;
+ computeGraphArgs.GPtr.outVertexIndex[i] = 0;
}
int outVertexListSize = 0;
int i0 = -1;
for (int i = lss.i_start; i < lss.i_stop; i++) {
- long k = i;
+ int k = i;
if ((outVertexListSize == 0) && (k != 0)) {
while (i0 == -1) {
for (int j = 0; j < numEdgesPlaced; j++) {
- if (k == SDGdataPtr.startVertex[j]) {
+ if (k == computeGraphArgs.SDGdataPtr.startVertex[j]) {
i0 = j;
break;
}
}
for (int j = i0; j < numEdgesPlaced; j++) {
- if (i == GPtr.numVertices-1) {
+ if (i == computeGraphArgs.GPtr.numVertices-1) {
break;
}
- if ((i != SDGdataPtr.startVertex[j])) {
- if ((j > 0) && (i == SDGdataPtr.startVertex[j-1])) {
+ if ((i != computeGraphArgs.SDGdataPtr.startVertex[j])) {
+ if ((j > 0) && (i == computeGraphArgs.SDGdataPtr.startVertex[j-1])) {
if (j-i0 >= 1) {
outVertexListSize++;
- GPtr.outDegree[i]++;
+ computeGraphArgs.GPtr.outDegree[i]++;
for (int t = (i0+1); t < j; t++) {
- if (SDGdataPtr.endVertex[t] !=
- SDGdataPtr.endVertex[t-1])
+ if (computeGraphArgs.SDGdataPtr.endVertex[t] !=
+ computeGraphArgs.SDGdataPtr.endVertex[t-1])
{
outVertexListSize++;
- GPtr.outDegree[i] = GPtr.outDegree[i]+1;
+ computeGraphArgs.GPtr.outDegree[i] = computeGraphArgs.GPtr.outDegree[i]+1;
}
}
}
}
}
- if (i == GPtr.numVertices-1) {
+ if (i == computeGraphArgs.GPtr.numVertices-1) {
if (numEdgesPlaced-i0 >= 0) {
outVertexListSize++;
- GPtr.outDegree[i]++;
- for (int t = (int) (i0+1); t < numEdgesPlaced; t++) {
- if (SDGdataPtr.endVertex[t] != SDGdataPtr.endVertex[t-1]) {
+ computeGraphArgs.GPtr.outDegree[i]++;
+ for (int t = (i0+1); t < numEdgesPlaced; t++) {
+ if (computeGraphArgs.SDGdataPtr.endVertex[t] != computeGraphArgs.SDGdataPtr.endVertex[t-1]) {
outVertexListSize++;
- GPtr.outDegree[i]++;
+ computeGraphArgs.GPtr.outDegree[i]++;
}
}
}
Barrier.enterBarrier();
- prefix_sums(myId, numThread, GPtr.outVertexIndex, GPtr.outDegree, GPtr.numVertices);
+ prefix_sums(myId, numThread, computeGraphArgs.GPtr.outVertexIndex, computeGraphArgs.GPtr.outDegree, computeGraphArgs.GPtr.numVertices);
Barrier.enterBarrier();
outVertexListSize = global_outVertexListSize;
if (myId == 0) {
- GPtr.numDirectedEdges = outVertexListSize;
- GPtr.outVertexList = new long[outVertexListSize];
- GPtr.paralEdgeIndex = new long[outVertexListSize];
- GPtr.outVertexList[0] = SDGdataPtr.endVertex[0];
+ computeGraphArgs.GPtr.numDirectedEdges = outVertexListSize;
+ computeGraphArgs.GPtr.outVertexList = new int[outVertexListSize];
+ computeGraphArgs.GPtr.paralEdgeIndex = new int[outVertexListSize];
+ computeGraphArgs.GPtr.outVertexList[0] = computeGraphArgs.SDGdataPtr.endVertex[0];
}
Barrier.enterBarrier();
for (int i = lss.i_start; i < lss.i_stop; i++) {
- long k = (long) i;
+ int k = i;
while ((i0 == -1) && (k != 0)) {
for (int j = 0; j < numEdgesPlaced; j++) {
- if (k == SDGdataPtr.startVertex[j]) {
+ if (k == computeGraphArgs.SDGdataPtr.startVertex[j]) {
i0 = j;
break;
}
}
for (int j = i0; j < numEdgesPlaced; j++) {
- if (i == GPtr.numVertices-1) {
+ if (i == computeGraphArgs.GPtr.numVertices-1) {
break;
}
- if (i != SDGdataPtr.startVertex[j]) {
- if ((j > 0) && (i == SDGdataPtr.startVertex[j-1])) {
+ if (i != computeGraphArgs.SDGdataPtr.startVertex[j]) {
+ if ((j > 0) && (i == computeGraphArgs.SDGdataPtr.startVertex[j-1])) {
if (j-i0 >= 1) {
- int ii = (int) (GPtr.outVertexIndex[i]);
+ int ii = (computeGraphArgs.GPtr.outVertexIndex[i]);
int r = 0;
- GPtr.paralEdgeIndex[ii] = i0;
- GPtr.outVertexList[ii] = SDGdataPtr.endVertex[(int) i0];
+ computeGraphArgs.GPtr.paralEdgeIndex[ii] = i0;
+ computeGraphArgs.GPtr.outVertexList[ii] = computeGraphArgs.SDGdataPtr.endVertex[ i0];
r++;
- for (int t = (int) (i0+1); t < j; t++) {
- if (SDGdataPtr.endVertex[t] !=
- SDGdataPtr.endVertex[t-1])
+ for (int t = (i0+1); t < j; t++) {
+ if (computeGraphArgs.SDGdataPtr.endVertex[t] !=
+ computeGraphArgs.SDGdataPtr.endVertex[t-1])
{
- GPtr.paralEdgeIndex[ii+r] = t;
- GPtr.outVertexList[ii+r] = SDGdataPtr.endVertex[t];
+ computeGraphArgs.GPtr.paralEdgeIndex[ii+r] = t;
+ computeGraphArgs.GPtr.outVertexList[ii+r] = computeGraphArgs.SDGdataPtr.endVertex[t];
r++;
}
}
}
} /* for j */
- if (i == GPtr.numVertices-1) {
+ if (i == computeGraphArgs.GPtr.numVertices-1) {
int r = 0;
if (numEdgesPlaced-i0 >= 0) {
- int ii = GPtr.outVertexIndex[i];
- GPtr.paralEdgeIndex[ii+r] = i0;
- GPtr.outVertexList[ii+r] = SDGdataPtr.endVertex[i0];
+ int ii = computeGraphArgs.GPtr.outVertexIndex[i];
+ computeGraphArgs.GPtr.paralEdgeIndex[ii+r] = i0;
+ computeGraphArgs.GPtr.outVertexList[ii+r] = computeGraphArgs.SDGdataPtr.endVertex[i0];
r++;
for (int t = i0+1; t < numEdgesPlaced; t++) {
- if (SDGdataPtr.endVertex[t] != SDGdataPtr.endVertex[t-1]) {
- GPtr.paralEdgeIndex[ii+r] = t;
- GPtr.outVertexList[ii+r] = SDGdataPtr.endVertex[t];
+ if (computeGraphArgs.SDGdataPtr.endVertex[t] != computeGraphArgs.SDGdataPtr.endVertex[t-1]) {
+ computeGraphArgs.GPtr.paralEdgeIndex[ii+r] = t;
+ computeGraphArgs.GPtr.outVertexList[ii+r] = computeGraphArgs.SDGdataPtr.endVertex[t];
r++;
}
}
Barrier.enterBarrier();
if (myId == 0) {
- SDGdataPtr.startVertex = null;
- SDGdataPtr.endVertex = null;
- GPtr.inDegree = new long[GPtr.numVertices];
- GPtr.inVertexIndex = new long[GPtr.numVertices];
+ computeGraphArgs.SDGdataPtr.startVertex = null;
+ computeGraphArgs.SDGdataPtr.endVertex = null;
+ computeGraphArgs.GPtr.inDegree = new int[computeGraphArgs.GPtr.numVertices];
+ computeGraphArgs.GPtr.inVertexIndex = new int[computeGraphArgs.GPtr.numVertices];
}
Barrier.enterBarrier();
for (int i = lss.i_start; i < lss.i_stop; i++) {
- GPtr.inDegree[i] = 0;
- GPtr.inVertexIndex[i] = 0;
+ computeGraphArgs.GPtr.inDegree[i] = 0;
+ computeGraphArgs.GPtr.inVertexIndex[i] = 0;
}
/* A temp. array to store the inplied edges */
- long[] impliedEdgeList;
+ int[] impliedEdgeList;
if (myId == 0) {
- impliedEdgeList = new long[GPtr.numVertices * glb.MAX_CLUSTER_SIZE];
+ impliedEdgeList = new int[computeGraphArgs.GPtr.numVertices * glb.MAX_CLUSTER_SIZE];
global_impliedEdgeList = impliedEdgeList;
}
impliedEdgeList = global_impliedEdgeList;
CreatePartition.createPartition(0,
- (GPtr.numVertices * glb.MAX_CLUSTER_SIZE),
+ (computeGraphArgs.GPtr.numVertices * glb.MAX_CLUSTER_SIZE),
myId,
numThread,
lss);
* MAX_CLUSTER_SIZE
*/
- long[][] auxArr;
+ int[][] auxArr;
if (myId == 0) {
- auxArr = new long[GPtr.numVertices][glb.MAX_CLUSTER_SIZE];
+ auxArr = new int[computeGraphArgs.GPtr.numVertices][glb.MAX_CLUSTER_SIZE];
global_auxArr = auxArr;
}
auxArr = global_auxArr;
- CreatePartition.createPartition(0, GPtr.numVertices, myId, numThread, lss);
+ 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 = GPtr.outVertexIndex[i];
- j < (GPtr.outVertexIndex[i] + GPtr.outDegree[i]);
+ for (j = computeGraphArgs.GPtr.outVertexIndex[i];
+ j < (computeGraphArgs.GPtr.outVertexIndex[i] + computeGraphArgs.GPtr.outDegree[i]);
j++)
{
- int v = (int) (GPtr.outVertexList[j]);
+ int v = (computeGraphArgs.GPtr.outVertexList[j]);
int k;
- for (k = GPtr.outVertexIndex[v];
- k < (GPtr.outVertexIndex[v] + GPtr.outDegree[v]);
+ for (k = computeGraphArgs.GPtr.outVertexIndex[v];
+ k < (computeGraphArgs.GPtr.outVertexIndex[v] + computeGraphArgs.GPtr.outDegree[v]);
k++)
{
- if (GPtr.outVertexList[k] == i) {
+ if (computeGraphArgs.GPtr.outVertexList[k] == i) {
break;
}
}
- if (k == GPtr.outVertexIndex[v]+GPtr.outDegree[v]) {
+ if (k == computeGraphArgs.GPtr.outVertexIndex[v]+computeGraphArgs.GPtr.outDegree[v]) {
atomic {
/* Add i to the impliedEdgeList of v */
- long inDegree = GPtr.inDegree[v];
- GPtr.inDegree[v] = (inDegree + 1);
- if ((int) inDegree < glb.MAX_CLUSTER_SIZE) {
+ 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
} else {
/* Use auxiliary array to store the implied edge */
/* Create an array if it's not present already */
- long[] a = null;
- if (((int)inDegree % glb.MAX_CLUSTER_SIZE) == 0) {
- a = new long[glb.MAX_CLUSTER_SIZE];
+ int[] a = null;
+ if ((inDegree % glb.MAX_CLUSTER_SIZE) == 0) {
+ a = new int[glb.MAX_CLUSTER_SIZE];
auxArr[v] = a;
} else {
a = auxArr[v];
Barrier.enterBarrier();
- prefix_sums(myId, numThread, GPtr.inVertexIndex, GPtr.inDegree, GPtr.numVertices);
+ prefix_sums(myId, numThread, computeGraphArgs.GPtr.inVertexIndex, computeGraphArgs.GPtr.inDegree, computeGraphArgs.GPtr.numVertices);
if (myId == 0) {
- GPtr.numUndirectedEdges = GPtr.inVertexIndex[GPtr.numVertices-1]
- + GPtr.inDegree[GPtr.numVertices-1];
- GPtr.inVertexList = new long[GPtr.numUndirectedEdges];
+ computeGraphArgs.GPtr.numUndirectedEdges = computeGraphArgs.GPtr.inVertexIndex[computeGraphArgs.GPtr.numVertices-1]
+ + computeGraphArgs.GPtr.inDegree[computeGraphArgs.GPtr.numVertices-1];
+ computeGraphArgs.GPtr.inVertexList = new int[computeGraphArgs.GPtr.numUndirectedEdges];
}
Barrier.enterBarrier();
*/
for (int i = lss.i_start; i < lss.i_stop; i++) {
- for (int j = GPtr.inVertexIndex[i];
- j < (GPtr.inVertexIndex[i] + GPtr.inDegree[i]);
+ for (int j = computeGraphArgs.GPtr.inVertexIndex[i];
+ j < (computeGraphArgs.GPtr.inVertexIndex[i] + computeGraphArgs.GPtr.inDegree[i]);
j++)
{
- if ((j - GPtr.inVertexIndex[i]) < glb.MAX_CLUSTER_SIZE) {
- GPtr.inVertexList[j] =
- impliedEdgeList[i*glb.MAX_CLUSTER_SIZE+j-GPtr.inVertexIndex[i]];
+ if ((j - computeGraphArgs.GPtr.inVertexIndex[i]) < glb.MAX_CLUSTER_SIZE) {
+ computeGraphArgs.GPtr.inVertexList[j] =
+ impliedEdgeList[i*glb.MAX_CLUSTER_SIZE+j-computeGraphArgs.GPtr.inVertexIndex[i]];
} else {
- GPtr.inVertexList[j] =
- auxArr[i][(j-GPtr.inVertexIndex[i]) % glb.MAX_CLUSTER_SIZE];
+ computeGraphArgs.GPtr.inVertexList[j] =
+ auxArr[i][(j-computeGraphArgs.GPtr.inVertexIndex[i]) % glb.MAX_CLUSTER_SIZE];
}
}
}
}
for (i = i_start; i < i_stop; i++) {
- if (GPtr.inDegree[i] > MAX_CLUSTER_SIZE) {
+ if (computeGraphArgs.GPtr.inDegree[i] > MAX_CLUSTER_SIZE) {
auxArr[i] = null;
}
}
public class Edge {
- public long startVertex;
- public long endVertex;
- public long edgeNum;
+ public int startVertex;
+ public int endVertex;
+ public int edgeNum;
public Edge() {
}
public class GenScalData {
- public long[] global_permV;
- public long[] global_cliqueSizes;
+ public int[] global_permV;
+ public int[] global_cliqueSizes;
public int global_totCliques;
- public long[] global_firstVsInCliques;
- public long[] global_lastVsInCliques;
- public long[] global_i_edgeStartCounter;
- public long[] global_i_edgeEndCounter;
- public long global_edgeNum;
- public long global_numStrWtEdges;
- public long[] global_startVertex;
- public long[] global_endVertex;
- public long[] global_tempIndex;
+ public int[] global_firstVsInCliques;
+ public int[] global_lastVsInCliques;
+ public int[] global_i_edgeStartCounter;
+ public int[] global_i_edgeEndCounter;
+ public int global_edgeNum;
+ public int global_numStrWtEdges;
+ public int[] global_startVertex;
+ public int[] global_endVertex;
+ public int[] global_tempIndex;
/**
* Constructor
global_lastVsInCliques = null;
global_i_edgeStartCounter = null;
global_i_edgeEndCounter = null;
- global_edgeNum = 0L;
- global_numStrWtEdges = 0L;
+ global_edgeNum = 0;
+ global_numStrWtEdges = 0;
global_startVertex = null;
global_endVertex = null;
global_tempIndex = null;
* =============================================================================
**/
void
- genScalData_seq (graphSDG* SDGdataPtr)
+ genScalData_seq (GraphSDG SDGdataPtr)
{
System.out.println("Call to genScalData_seq(), Unimplemented: TODO\n");
System.exit(0);
*/
Random randomPtr = new Random();
- randomPtr = randomPtr.random_alloc(randomPtr);
- randomPtr.random_seed(randomPtr, myId);
+ randomPtr = randomPtr.random_alloc();
+ randomPtr.random_seed(myId);
- long[] permV;
+ int[] permV;
if (myId == 0) {
- permV = new long[glb.TOT_VERTICES];
+ permV = new int[glb.TOT_VERTICES];
global_permV = permV;
}
Barrier.enterBarrier();
for (int i = i_start; i < i_stop; i++) {
- int t1 = (int) (randomPtr.random_generate(randomPtr));
+ int t1 = randomPtr.random_generate();
int t = i + t1 % (glb.TOT_VERTICES - i);
if (t != i) {
atomic {
- long t2 = permV[t];
+ int t2 = permV[t];
permV[t] = permV[i];
permV[i] = t2;
}
* STEP 1: Create Cliques
*/
- long[] cliqueSizes;
+ int[] cliqueSizes;
int estTotCliques = (int)(Math.ceil(1.5d * glb.TOT_VERTICES / ((1+glb.MAX_CLIQUE_SIZE)/2)));
* Estimate number of clique required and pad by 50%
*/
if (myId == 0) {
- cliqueSizes = new long[estTotCliques];
+ cliqueSizes = new int[estTotCliques];
global_cliqueSizes = cliqueSizes;
}
/* Generate random clique sizes. */
for (int i = lss.i_start; i < lss.i_stop; i++) {
- cliqueSizes[i] = 1 + (randomPtr.random_generate(randomPtr) % MAX_CLIQUE_SIZE);
+ cliqueSizes[i] = 1 + (randomPtr.random_generate() % glb.MAX_CLIQUE_SIZE);
}
Barrier.enterBarrier();
* Allocate memory for cliqueList
*/
- long[] firstVsInCliques;
- long[] firstVsInCliques;
+ int[] firstVsInCliques;
+ int[] firstVsInCliques;
if (myId == 0) {
- lastVsInCliques = new long[estTotCliques];
+ lastVsInCliques = new int[estTotCliques];
global_lastVsInCliques = lastVsInCliques;
- firstVsInCliques = new long[estTotCliques];
+ firstVsInCliques = new int[estTotCliques];
global_firstVsInCliques = firstVsInCliques;
/*
*/
lastVsInCliques[0] = cliqueSizes[0] - 1;
- for (int i = 1; i < estTotCliques; i++) {
+ int i;
+ for (i = 1; i < estTotCliques; i++) {
lastVsInCliques[i] = cliqueSizes[i] + lastVsInCliques[i-1];
if (lastVsInCliques[i] >= glb.TOT_VERTICES-1) {
break;
/*
* Fix the size of the last clique
*/
- cliqueSizes[totCliques-1] =
- glb.TOT_VERTICES - lastVsInCliques[totCliques-2] - 1;
+ cliqueSizes[(totCliques-1)] =
+ glb.TOT_VERTICES - lastVsInCliques[(totCliques-2)] - 1;
lastVsInCliques[totCliques-1] = glb.TOT_VERTICES - 1;
firstVsInCliques[0] = 0;
totCliques = global_totCliques;
/* Compute start Vertices in cliques. */
- createPartition(1, totCliques, myId, numThread, lss);
- for (i = i_start; i < i_stop; i++) {
+ cp.createPartition(1, totCliques, myId, numThread, lss);
+ for (int i = i_start; i < i_stop; i++) {
firstVsInCliques[i] = lastVsInCliques[i-1] + 1;
}
// Write the generated cliques to file for comparison with Kernel 4
if (myId == 0) {
FILE* outfp = fopen("cliques.txt", "w");
- fprintf(outfp, "No. of cliques - %lu\n", totCliques);
+ fSystem.out.println(outfp, "No. of cliques - %lu\n", totCliques);
for (i = 0; i < totCliques; i++) {
- fprintf(outfp, "Clq %lu - ", i);
- long j;
+ fSystem.out.println(outfp, "Clq %lu - ", i);
+ int j;
for (j = firstVsInCliques[i]; j <= lastVsInCliques[i]; j++) {
- fprintf(outfp, "%lu ", permV[j]);
+ fSystem.out.println(outfp, "%lu ", permV[j]);
}
- fprintf(outfp, "\n");
+ fSystem.out.println(outfp, "\n");
}
fclose(outfp);
}
/*
* Estimate number of edges - using an empirical measure
*/
- long estTotEdges;
+ int estTotEdges;
if (glb.SCALE >= 12) {
- estTotEdges = (long) (Math.ceil(1.0d *((glb.MAX_CLIQUE_SIZE-1) * glb.TOT_VERTICES)));
+ estTotEdges = (int) (Math.ceil(1.0d *((glb.MAX_CLIQUE_SIZE-1) * glb.TOT_VERTICES)));
} else {
- estTotEdges = (long) (Math.ceil(1.2d * (((glb.MAX_CLIQUE_SIZE-1)*glb.TOT_VERTICES)
+ estTotEdges = (int) (Math.ceil(1.2d * (((glb.MAX_CLIQUE_SIZE-1)*glb.TOT_VERTICES)
* ((1 + glb.MAX_PARAL_EDGES)/2) + glb.TOT_VERTICES*2)));
}
* Initialize edge counter
*/
int i_edgePtr = 0;
+ float p = glb.PROB_UNIDIRECTIONAL;
/*
* Partial edgeLists
*/
- long[] startV;
- long[] endV;
+ int[] startV;
+ int[] endV;
if (numThread > 3) {
int numByte = 1.5 * (estTotEdges/numThread);
- startV = new long[numByte];
- endV = new long[numByte];
+ startV = new int[numByte];
+ endV = new int[numByte];
} else {
int numByte = (estTotEdges/numThread);
- startV = new long[numByte];
- endV = new long[numByte];
+ startV = new int[numByte];
+ endV = new int[numByte];
}
/*
* Tmp array to keep track of the no. of parallel edges in each direction
*/
- long[][] tmpEdgeCounter = new long[glb.MAX_CLIQUE_SIZE][glb.MAX_CLIQUE_SIZE];
+ int[][] tmpEdgeCounter = new int[glb.MAX_CLIQUE_SIZE][glb.MAX_CLIQUE_SIZE];
/*
* Create edges in parallel
*/
- int i_clique;
+ //int i_clique;
cp.createPartition(0, totCliques, myId, numThread, lss);
- double p = glb.PROB_UNIDIRECTIONAL;
- for (i_clique = lss.i_start; i_clique < lss.i_stop; i_clique++) {
+ for (int i_clique = lss.i_start; i_clique < lss.i_stop; i_clique++) {
/*
* Get current clique parameters
*/
- long i_cliqueSize = cliqueSizes[i_clique];
- long i_firstVsInClique = firstVsInCliques[i_clique];
+ int i_cliqueSize = cliqueSizes[i_clique];
+ int i_firstVsInClique = firstVsInCliques[i_clique];
/*
* First create at least one edge between two vetices in a clique
*/
- int i;
- int j;
- for (i = 0; i < (int) i_cliqueSize; i++) {
- for (j = 0; j < i; j++) {
- double r = (double)(randomPtr.random_generate(randomPtr) % 1000) / (double)1000;
+ for (int i = 0; i < i_cliqueSize; i++) {
+ for (int j = 0; j < i; j++) {
+ float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if (r >= p) {
startV[i_edgePtr] = i + i_firstVsInClique;
} /* for i */
if (i_cliqueSize != 1) {
- long randNumEdges = (long)(randomPtr.random_generate(randomPtr)
- % (2*i_cliqueSize*glb.MAX_PARAL_EDGES));
- int i_paralEdge;
- for (i_paralEdge = 0; i_paralEdge < (int) randNumEdges; i_paralEdge++) {
- i = (int) (randomPtr.random_generate(randomPtr) % i_cliqueSize);
- int j = (int) (randomPtr.random_generate(randomPtr) % i_cliqueSize);
+ int randNumEdges = randomPtr.random_generate() % (2*i_cliqueSize*glb.MAX_PARAL_EDGES);
+ //int i_paralEdge;
+ for (int i_paralEdge = 0; i_paralEdge < randNumEdges; i_paralEdge++) {
+ int i = (int) (randomPtr.random_generate() % i_cliqueSize);
+ int j = (int) (randomPtr.random_generate() % i_cliqueSize);
if ((i != j) && (tmpEdgeCounter[i][j] < glb.MAX_PARAL_EDGES)) {
- double r = (double)(randomPtr.random_generate(randomPtr) % 1000) / (double)1000;
+ float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if (r >= p) {
/* Copy to edge structure. */
startV[i_edgePtr] = i + i_firstVsInClique;
} /* for i_clique */
+ tmpEdgeCounter = null;
+
/*
* Merge partial edge lists
*/
- long[] i_edgeStartCounter;
- long[] i_edgeEndCounter;
+ int[] i_edgeStartCounter;
+ int[] i_edgeEndCounter;
if (myId == 0) {
- i_edgeStartCounter = new long[numThread];
+ i_edgeStartCounter = new int[ numThread];
global_i_edgeStartCounter = i_edgeStartCounter;
- i_edgeEndCounter = new long[numThread];
+ i_edgeEndCounter = new int[numThread];
global_i_edgeEndCounter = i_edgeEndCounter;
}
Barrier.enterBarrier();
if (myId == 0) {
- for (i = 1; i < numThread; i++) {
+ for (int i = 1; i < numThread; i++) {
i_edgeEndCounter[i] = i_edgeEndCounter[i-1] + i_edgeEndCounter[i];
i_edgeStartCounter[i] = i_edgeEndCounter[i-1];
}
}
atomic {
- global_edgeNum = (long) (global_edgeNum + i_edgePtr);
+ global_edgeNum = global_edgeNum + i_edgePtr;
}
Barrier.enterBarrier();
- long edgeNum = global_edgeNum;
+ int edgeNum = global_edgeNum;
/*
* Initialize edge list arrays
*/
- long[] startVertex;
- long[] endVertex;
+ int[] startVertex;
+ int[] endVertex;
if (myId == 0) {
if (glb.SCALE < 10) {
int numByte = 2 * edgeNum;
- startVertex = new long[numByte];
- endVertex = new long[numByte];
+ startVertex = new int[numByte];
+ endVertex = new int[numByte];
} else {
int numByte = (edgeNum + glb.MAX_PARAL_EDGES * glb.TOT_VERTICES);
- startVertex = new long[numByte];
- endVertex = new long[numByte];
+ startVertex = new int[numByte];
+ endVertex = new int[numByte];
}
global_startVertex = startVertex;
global_endVertex = endVertex;
startVertex = global_startVertex;
endVertex = global_endVertex;
- for (int i = (int) i_edgeStartCounter[myId]; i < (int) i_edgeEndCounter[myId]; i++) {
+ for (int i = i_edgeStartCounter[myId]; i < i_edgeEndCounter[myId]; i++) {
startVertex[i] = startV[i-i_edgeStartCounter[myId]];
endVertex[i] = endV[i-i_edgeStartCounter[myId]];
}
cp.createPartition(0, glb.TOT_VERTICES, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
- long tempVertex1 = (long) i;
- long h = totCliques;
- long l = 0;
- long t = -1;
+ int tempVertex1 = i;
+ int h = totCliques;
+ int l = 0;
+ int t = -1;
while (h - l > 1) {
- int m = (int) ((h + l) / 2);
+ int m = ((h + l) / 2);
if (tempVertex1 >= firstVsInCliques[m]) {
l = m;
} else {
t = m-1;
}
- long t1 = firstVsInCliques[t];
+ int t1 = firstVsInCliques[t];
- int d;
- for (d = 1, p = glb.PROB_INTERCL_EDGES; d < glb.TOT_VERTICES; d *= 2, p /= 2) {
+ //int d;
+ for (int d = 1, p = glb.PROB_INTERCL_EDGES; d < glb.TOT_VERTICES; d *= 2, p /= 2) {
- double r = (double)(randomPtr.random_generate(randomPtr) % 1000) / (double)1000;
+ float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if (r <= p) {
- long tempVertex2 = (long) ((i+d) % glb.TOT_VERTICES);
+ int tempVertex2 = ((i+d) % glb.TOT_VERTICES);
h = totCliques;
l = 0;
t = -1;
while (h - l > 1) {
- int m = (int) ((h + l) / 2);
+ int m = (((h + l) / 2);
if (tempVertex2 >= firstVsInCliques[m]) {
l = m;
} else {
}
if (t == -1) {
- //long m;
+ //int m;
int m;
for (m = (l + 1); m < h; m++) {
if (tempVertex2 < firstVsInCliques[m]) {
t = m - 1;
}
- long t2 = firstVsInCliques[t];
+ int t2 = firstVsInCliques[t];
if (t1 != t2) {
- long randNumEdges =
- randomPtr.random_generate(randomPtr) % glb.MAX_PARAL_EDGES + 1;
- int j;
- for (j = 0; j < randNumEdges; j++) {
+ int randNumEdges =
+ randomPtr.random_generate() % glb.MAX_PARAL_EDGES + 1;
+ //int j;
+ for (int j = 0; j < randNumEdges; j++) {
startV[i_edgePtr] = tempVertex1;
endV[i_edgePtr] = tempVertex2;
i_edgePtr++;
} /* r <= p */
- double r0 = (double)(randomPtr.random_generate(randomPtr) % 1000) / (double)1000;
+ float r0 = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if ((r0 <= p) && (i-d>=0)) {
- long tempVertex2 = (i - d) % glb.TOT_VERTICES;
+ int tempVertex2 = (i - d) % glb.TOT_VERTICES;
h = totCliques;
l = 0;
t = -1;
while (h - l > 1) {
- int m = (int)((h + l) / 2);
+ int m = ((h + l) / 2);
if (tempVertex2 >= firstVsInCliques[m]) {
l = m;
} else {
if (t == -1) {
int m;
- for (m = (int) (l + 1); m < (int) h; m++) {
+ for (m = (l + 1); m < h; m++) {
if (tempVertex2 < firstVsInCliques[m]) {
break;
}
t = m - 1;
}
- long t2 = firstVsInCliques[t];
+ int t2 = firstVsInCliques[t];
if (t1 != t2) {
- long randNumEdges =
- randomPtr.random_generate(randomPtr) % glb.MAX_PARAL_EDGES + 1;
- int j;
- for (j = 0; j < (int) randNumEdges; j++) {
+ int randNumEdges =
+ randomPtr.random_generate() % glb.MAX_PARAL_EDGES + 1;
+ for (int j = 0; j < randNumEdges; j++) {
startV[i_edgePtr] = tempVertex1;
endV[i_edgePtr] = tempVertex2;
i_edgePtr++;
Barrier.enterBarrier();
if (myId == 0) {
- for (int i = 1; i < numThread; i++) {
+ for (int i = 1; i < numThread; i++) {
i_edgeEndCounter[i] = i_edgeEndCounter[i-1] + i_edgeEndCounter[i];
i_edgeStartCounter[i] = i_edgeEndCounter[i-1];
}
Barrier.enterBarrier();
edgeNum = global_edgeNum;
- long numEdgesPlacedOutside = global_edgeNum;
+ int numEdgesPlacedOutside = global_edgeNum;
- for (int i = (int) i_edgeStartCounter[myId]; i < (int) 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]];
}
Barrier.enterBarrier();
- long numEdgesPlaced = numEdgesPlacedInCliques + numEdgesPlacedOutside;
+ int numEdgesPlaced = numEdgesPlacedInCliques + numEdgesPlacedOutside;
if (myId == 0) {
+ SDGdataPtr.numEdgesPlaced = numEdgesPlaced;
- SDGdataPtr.numEdgesPlaced = (int) numEdgesPlaced;
-
- printf("Finished generating edges\n");
- printf("No. of intra-clique edges - %lu\n", numEdgesPlacedInCliques);
- printf("No. of inter-clique edges - %lu\n", numEdgesPlacedOutside);
- printf("Total no. of edges - %lu\n", numEdgesPlaced);
+ System.out.println("Finished generating edges");
+ System.out.println("No. of intra-clique edges - " + numEdgesPlacedInCliques);
+ System.out.println("No. of inter-clique edges - " + numEdgesPlacedOutside);
+ System.out.println("Total no. of edges - " + numEdgesPlaced);
}
Barrier.enterBarrier();
*/
if (myId == 0) {
- SDGdataPtr.intWeight = new long[(int) numEdgesPlaced];
+ SDGdataPtr.intWeight = new int[numEdgesPlaced];
}
Barrier.enterBarrier();
p = glb.PERC_INT_WEIGHTS;
- long numStrWtEdges = 0;
+ int numStrWtEdges = 0;
- cp.createPartition(0, (int) numEdgesPlaced, myId, numThread, lss);
+ cp.createPartition(0, numEdgesPlaced, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
- double r = (double)(randomPtr.random_generate(randomPtr) % 1000) / (double)1000;
+ float r = (float)(randomPtr.random_generate() % 1000) / (float)1000;
if (r <= p) {
SDGdataPtr.intWeight[i] =
- 1 + (randomPtr.random_generate(randomPtr) % (MAX_INT_WEIGHT-1));
+ 1 + (randomPtr.random_generate() % (MAX_INT_WEIGHT-1));
} else {
SDGdataPtr.intWeight[i] = -1;
numStrWtEdges++;
if (myId == 0) {
int t = 0;
- for (int i = 0; i < (int) numEdgesPlaced; i++) {
+ for (int i = 0; i < numEdgesPlaced; i++) {
if (SDGdataPtr.intWeight[i] < 0) {
SDGdataPtr.intWeight[i] = -t;
t++;
Barrier.enterBarrier();
- cp.createPartition(0, (int) numEdgesPlaced, myId, numThread, lss);
+ cp.createPartition(0, numEdgesPlaced, myId, numThread, lss);
for (int i = lss.i_start; i < lss.i_stop; i++) {
if (SDGdataPtr.intWeight[i] <= 0) {
for (int j = 0; j < glb.MAX_STRLEN; j++) {
- SDGdataPtr.strWeight[(-(int) SDGdataPtr.intWeight[i])*glb.MAX_STRLEN+j] =
+ SDGdataPtr.strWeight[(-SDGdataPtr.intWeight[i])*glb.MAX_STRLEN+j] =
// (char) (1 + PRANDOM_GENERATE(stream) % 127);
//FIXME
- (char) (1 + (randomPtr.random_generate(randomPtr) % 127));
+ (char) (1 + (randomPtr.random_generate() % 127));
}
}
}
glb.SOUGHT_STRING = new char[MAX_STRLEN];
}
- long t = randomPtr.random_generate(randomPtr) % numStrWtEdges;
+ int t = randomPtr.random_generate() % numStrWtEdges;
for (int j = 0; j < glb.MAX_STRLEN; j++) {
//FIXME
SOUGHT_STRING[j] =
- (char) ((long) SDGdataPtr.strWeight[(int) (t*glb.MAX_STRLEN+j)]);
+ (char) (SDGdataPtr.strWeight[(t*glb.MAX_STRLEN+j)]);
}
}
*/
if (myId == 0) {
- int numByte = (int) numEdgesPlaced;
- SDGdataPtr.startVertex = new long[numByte];
- SDGdataPtr.endVertex = new long[numByte];
+ int numByte = numEdgesPlaced;
+ SDGdataPtr.startVertex = new int[numByte];
+ SDGdataPtr.endVertex = new int[numByte];
}
Barrier.enterBarrier();
int i1 = 0;
int i = 0;
- while (i < (int) numEdgesPlaced) {
+ while (i < numEdgesPlaced) {
- for (i = i0; i < (int) numEdgesPlaced; i++) {
+ for (i = i0; i < numEdgesPlaced; i++) {
if (SDGdataPtr.startVertex[i] !=
SDGdataPtr.startVertex[i1])
{
}
}
- int j;
- for (j = i0; j < i1; j++) {
- int k;
- for (k = j+1; k < i1; k++) {
+ //int j;
+ for (int j = i0; j < i1; j++) {
+ //int k;
+ for (int k = j+1; k < i1; k++) {
if (SDGdataPtr.endVertex[k] <
SDGdataPtr.endVertex[j])
{
- long t = SDGdataPtr.endVertex[j];
+ int t = SDGdataPtr.endVertex[j];
SDGdataPtr.endVertex[j] = SDGdataPtr.endVertex[k];
SDGdataPtr.endVertex[k] = t;
}
}
}
- if (SDGdataPtr.startVertex[i0] != (long) glb.TOT_VERTICES-1) {
+ if (SDGdataPtr.startVertex[i0] != glb.TOT_VERTICES-1) {
i0 = i1;
} else {
- int j;
- for (j=i0; j<(int)numEdgesPlaced; j++) {
- int k;
- for (k=j+1; k<(int)numEdgesPlaced; k++) {
+ //int j;
+ for (int j=i0; j<numEdgesPlaced; j++) {
+ //int k;
+ for (int k=j+1; k<numEdgesPlaced; k++) {
if (SDGdataPtr.endVertex[k] <
SDGdataPtr.endVertex[j])
{
- long t = SDGdataPtr.endVertex[j];
+ int t = SDGdataPtr.endVertex[j];
SDGdataPtr.endVertex[j] = SDGdataPtr.endVertex[k];
SDGdataPtr.endVertex[k] = t;
}
} else {
- long[] tempIndex;
+ int[] tempIndex;
if (myId == 0) {
- tempIndex = new long[glb.TOT_VERTICES + 1];
+ tempIndex = new int[glb.TOT_VERTICES + 1];
global_tempIndex = tempIndex;
/*
for (int i=0; i < glb.TOT_VERTICES; i++) {
tempIndex[i+1] = tempIndex[i];
- int j;
- for (j = i0; j < (int) numEdgesPlaced; j++) {
+ //int j;
+ for (int j = i0; j < numEdgesPlaced; j++) {
if (SDGdataPtr.startVertex[j] !=
SDGdataPtr.startVertex[i0])
{
if (myId == 0) {
for (int i = 0; i < glb.TOT_VERTICES; i++) {
- for (int j = (int) tempIndex[i]; j < (int) tempIndex[i+1]; j++) {
+ for (int j = tempIndex[i]; j < tempIndex[i+1]; j++) {
for (int k = (j + 1); k < tempIndex[i+1]; k++) {
if (SDGdataPtr.endVertex[k] <
SDGdataPtr.endVertex[j])
{
- long t = SDGdataPtr.endVertex[j];
+ int t = SDGdataPtr.endVertex[j];
SDGdataPtr.endVertex[j] = SDGdataPtr.endVertex[k];
SDGdataPtr.endVertex[k] = t;
}
public int MAX_INT_WEIGHT;
public char[] SOUGHT_STRING;
public int MAX_STRLEN;
- public double PERC_INT_WEIGHTS;
- public double PROB_UNIDIRECTIONAL;
- public double PROB_INTERCL_EDGES;
+ public float PERC_INT_WEIGHTS;
+ public float PROB_UNIDIRECTIONAL;
+ public float PROB_INTERCL_EDGES;
public int SUBGR_EDGE_LENGTH;
public int MAX_CLUSTER_SIZE;
public int MAX_STRLEN;
-/*the graph data structure*/
+/* Graph data structure*/
public class Graph {
public int numVertices;
public int numEdges;
public int numIntEdges;
public int numStrEdges;
- public long[] outDegree;
- public long[] outVertexIndex;
- public long[] outVertexList;
- public long[] paralEdgeIndex;
+ public int[] outDegree;
+ public int[] outVertexIndex;
+ public int[] outVertexList;
+ public int[] paralEdgeIndex;
- public long inDegree;
- public long inVertexIndex;
- public long inVertexList;
+ public int inDegree;
+ public int inVertexIndex;
+ public int inVertexList;
- public long[] intWeight;
+ public int[] intWeight;
public char[] strWeight;
public Graph() {
public class GraphSDG {
- public long[] startVertex;
- public long[] endVertex;
- public long[] intWeight;
+ public int[] startVertex;
+ public int[] endVertex;
+ public int[] intWeight;
/* The idea is to store the index of the string weights (as a negative value)
- * in the long Weight array. A negative value because we need to sort on
- * the intWeights in Kernel 2. Hence the long long
+ * in the int Weight array. A negative value because we need to sort on
+ * the intWeights in Kernel 2. Hence the int int
*/
public char[] strWeight;
public int numEdgesPlaced;
int i_stop;
public LocalStartStop() {
- i_start = 0;
- i_stop = 0;
+ i_start = 0L;
+ i_stop = 0L;
}
public static void init() {
- i_start = 0;
- i_stop = 0;
+ i_start = 0L;
+ i_stop = 0L;
}
}