Skip to content

Commit

Permalink
changed function name as written in the paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourav Pati committed Aug 22, 2018
1 parent 0c538ff commit 953f573
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 266 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# README #


###Contributors ###
Sourav Pati, Kartik Lakhotia

### Prerequisites ###

Expand Down
2 changes: 1 addition & 1 deletion appr/makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CC = g++
CPPFLAGS= -O3 -c -std=c++11 -fopenmp -mavx -w
LDFLAGS = -fopenmp -m64 -lpthread
SOURCES = nibble.cpp ../src/partition.cpp ../src/gas.cpp ../src/graph.cpp ../src/sort.cpp
SOURCES = nibble.cpp ../src/sort.cpp
OBJECTS = $(SOURCES:.cpp=.o)

all: $(SOURCES) nibble
Expand Down
6 changes: 3 additions & 3 deletions appr/nibble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct PR_F{
{
return pageRankScat[node];
}
inline bool reInit(unsigned int node)
inline bool initFunc(unsigned int node)
{
pageRank[node]=pageRank[node]/2;
pageRankScat[node] = 0;
Expand All @@ -43,7 +43,7 @@ struct PR_F{
pageRank[destId] += updateVal;
return (updateVal > 0);
}
inline bool apply(unsigned int node)
inline bool filterFunc(unsigned int node)
{
bool cond = (pageRank[node] >= threshold*deg[node]);
if (!cond)
Expand Down Expand Up @@ -98,7 +98,7 @@ int main(int argc, char** argv)

while(numIter < MAX_ITER)
{
pcpm<float>(&G, PR_F(pcurr, pscat, G.outDeg));
scatter_and_gather<float>(&G, PR_F(pcurr, pscat, G.outDeg));
numIter++;
}

Expand Down
10 changes: 5 additions & 5 deletions bfs/bfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct BFS_F{
return (((!visited[node])<<31) | node);
}

inline bool reInit(unsigned int node)
inline bool initFunc(unsigned int node)
{
return false;
}
Expand All @@ -48,7 +48,7 @@ struct BFS_F{
return false;
}

inline bool apply(unsigned int node)
inline bool filterFunc(unsigned int node)
{
return true;
}
Expand All @@ -63,7 +63,7 @@ struct BFS_F2{
return ((parent[node] & MAX_NEG)| node);
}

inline bool reInit(unsigned int node)
inline bool initFunc(unsigned int node)
{
return false;
}
Expand All @@ -78,7 +78,7 @@ struct BFS_F2{
return false;
}

inline bool apply(unsigned int node)
inline bool filterFunc(unsigned int node)
{
return true;
}
Expand Down Expand Up @@ -123,7 +123,7 @@ int main(int argc, char** argv)
numIter=0;
while((G.frontierSize > 0))
{
pcpm<unsigned int>(&G, BFS_F(parent, visited));
scatter_and_gather<unsigned int>(&G, BFS_F(parent, visited));
// pcpm<unsigned int>(&G, BFS_F2(parent));
numIter++;
}
Expand Down
2 changes: 1 addition & 1 deletion bfs/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CC = g++
#LDFLAGS = -fopenmp -m64 -lpthread -L ../../../pcm/cpucounters.o ../../../pcm/pci.o ../../../pcm/msr.o ../../../pcm/client_bw.o ../../../pcm/cpucounters.o
CPPFLAGS= -O3 -c -std=c++11 -fopenmp -mavx -w
LDFLAGS = -fopenmp -m64 -lpthread
SOURCES = bfs.cpp ../src/partition.cpp ../src/gas.cpp ../src/graph.cpp ../src/sort.cpp
SOURCES = bfs.cpp ../src/sort.cpp
OBJECTS = $(SOURCES:.cpp=.o)

all: $(SOURCES) bfs
Expand Down
8 changes: 4 additions & 4 deletions cc/cc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct CC_F{
return label[node];
}

inline bool reInit(unsigned int node)
inline bool initFunc(unsigned int node)
{
return false;
}
Expand All @@ -37,7 +37,7 @@ struct CC_F{
return cond;
}

inline bool apply(unsigned int node)
inline bool filterFunc(unsigned int node)
{
return true;
}
Expand All @@ -62,7 +62,7 @@ int main(int argc, char** argv)

while((G.frontierSize > 0))
{
pcpm<unsigned int>(&G, CC_F(label));
scatter_and_gather<unsigned int>(&G, CC_F(label));
numIter++;
}
numIter = 0;
Expand All @@ -76,7 +76,7 @@ int main(int argc, char** argv)

while((G.frontierSize > 0))
{
pcpm<unsigned int>(&G, CC_F(label));
scatter_and_gather<unsigned int>(&G, CC_F(label));
numIter++;
}

Expand Down
2 changes: 1 addition & 1 deletion cc/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CC = g++
#LDFLAGS = -fopenmp -m64 -lpthread -L ../../../pcm/cpucounters.o ../../../pcm/pci.o ../../../pcm/msr.o ../../../pcm/client_bw.o ../../../pcm/cpucounters.o
CPPFLAGS= -O3 -c -std=c++11 -fopenmp -mavx -w
LDFLAGS = -fopenmp -m64 -lpthread
SOURCES = cc.cpp ../src/partition.cpp ../src/gas.cpp ../src/graph.cpp ../src/sort.cpp
SOURCES = cc.cpp ../src/sort.cpp
OBJECTS = $(SOURCES:.cpp=.o)

all: $(SOURCES) cc
Expand Down
8 changes: 4 additions & 4 deletions include/gas.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void reInitializeSparseFrontier(graph* G, partitionData* TD, userArg UA)
unsigned int trueSize = 0;
for (unsigned int i=0; i<TD->frontierSize; i++)
{
G->inFrontier[TD->frontier[i]] = UA.reInit(TD->frontier[i]);
G->inFrontier[TD->frontier[i]] = UA.initFunc(TD->frontier[i]);
if (G->inFrontier[TD->frontier[i]])
{
TD->frontier[trueSize++] = TD->frontier[i];
Expand All @@ -138,7 +138,7 @@ void reInitializeDenseFrontier(graph* G, partitionData* TD, userArg UA)
{
for (unsigned int i=TD->startVertex; i<TD->endVertex; i++)
{
UA.reInit(i);
UA.initFunc(i);
}
}

Expand All @@ -148,7 +148,7 @@ void filterFrontier(graph*G, partitionData* TD, userArg UA)
unsigned int trueSize = 0;
for (unsigned int i=0; i<TD->frontierSize; i++)
{
G->inFrontier[TD->frontier[i]] = UA.apply(TD->frontier[i]);
G->inFrontier[TD->frontier[i]] = UA.filterFunc(TD->frontier[i]);
if (G->inFrontier[TD->frontier[i]])
{
TD->activeEdges += G->outDeg[TD->frontier[i]];
Expand Down Expand Up @@ -419,7 +419,7 @@ void gather(graph* G, partitionData* TD, type*** updateBins, unsigned int*** den
filterFrontier(G, TD, UA);
#else
for (unsigned int i=TD->startVertex; i<TD->endVertex; i++)
UA.apply(i);
UA.filterFunc(i);
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions include/pcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ unsigned int edgesPerIteration;
#define ITERTIME
#undef ITERTIME

int NUM_THREADS = 16;
int NUM_THREADS = std::max(atoi(std::getenv("OMP_NUM_THREADS")), 1);
int MAX_THREADS = 36;
int MAX_ITER = 1000000;

Expand Down Expand Up @@ -106,7 +106,7 @@ void initialize(graph* G, int argc, char** argv)
}

omp_set_num_threads(NUM_THREADS);

printf("omp_get_num_threads(): %d\n",omp_get_max_threads());
//////////////////////////////////////////
// read csr file
//////////////////////////////////////////
Expand Down Expand Up @@ -237,7 +237,7 @@ void initBin(graph* G)


template<class type, class graph, class userArg>
void pcpm(graph* G, userArg UA)
void scatter_and_gather(graph* G, userArg UA)
{
#ifdef ITERTIME
float time;
Expand Down
2 changes: 1 addition & 1 deletion pr/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CC = g++
#LDFLAGS = -fopenmp -m64 -lpthread -L ../../../pcm/cpucounters.o ../../../pcm/pci.o ../../../pcm/msr.o ../../../pcm/client_bw.o ../../../pcm/cpucounters.o
CPPFLAGS= -O3 -c -std=c++11 -fopenmp -mavx -w
LDFLAGS = -fopenmp -m64 -lpthread
SOURCES = pr.cpp ../src/partition.cpp ../src/gas.cpp ../src/graph.cpp ../src/sort.cpp
SOURCES = pr.cpp ../src/sort.cpp
OBJECTS = $(SOURCES:.cpp=.o)

all: $(SOURCES) pr
Expand Down
10 changes: 5 additions & 5 deletions pr/pr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct PR_F{
return pageRank[node];
}
#ifndef DENSE
inline bool reInit(unsigned int node)
inline bool initFunc(unsigned int node)
{
pageRank[node]=0;
return true;
Expand All @@ -38,23 +38,23 @@ struct PR_F{
pageRank[destId] += updateVal;
return true;
}
inline bool apply(unsigned int node)
inline bool filterFunc(unsigned int node)
{
pageRank[node] = ((damping) + (1-damping)*pageRank[node]);
if (deg[node]>0)
pageRank[node] = pageRank[node]/deg[node];
return true;
}
#else
inline void reInit(unsigned int node)
inline void initFunc(unsigned int node)
{
pageRank[node]=0;
}
inline void gatherFunc (float updateVal, unsigned int destId)
{
pageRank[destId] += updateVal;
}
inline void apply(unsigned int node)
inline void filterFunc(unsigned int node)
{
pageRank[node] = ((damping) + (1-damping)*pageRank[node]);
if (deg[node]>0)
Expand Down Expand Up @@ -105,7 +105,7 @@ int main(int argc, char** argv)

while(numIter < MAX_ITER)
{
pcpm<float>(&G, PR_F(pcurr, G.outDeg));
scatter_and_gather<float>(&G, PR_F(pcurr, G.outDeg));
numIter++;
}

Expand Down
Loading

0 comments on commit 953f573

Please sign in to comment.