Skip to content

Commit afb0337

Browse files
committed
eliminated some dead code
1 parent f849612 commit afb0337

File tree

6 files changed

+62669
-65
lines changed

6 files changed

+62669
-65
lines changed

Diff for: Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ifneq ($(cc), not-set)
5151
CONFIG_FLAGS += -DCMAKE_C_COMPILER=$(cc)
5252
endif
5353

54-
PKGNAME=gktc
54+
CONFIG_FLAGS += -DPKGNAME=gktc
5555

5656
define run-config
5757
mkdir -p $(BUILDDIR)
@@ -77,7 +77,4 @@ distclean:
7777
remake:
7878
find . -name CMakeLists.txt -exec touch {} ';'
7979

80-
dist:
81-
utils/mkdist.sh $(PKGNAME)
82-
83-
.PHONY: config distclean all clean install uninstall remake dist
80+
.PHONY: config distclean all clean install uninstall remake

Diff for: README.md

+64-33
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OpenMP-based parallel program for counting the number of triangles in a sparse g
66
- CMake 2.8, found at http://www.cmake.org/, as well as GNU make.
77
- Download, build, and install [GKlib](https://github.com/KarypisLab/GKlib).
88

9-
Assumming that the above are available, two commands should suffice to
9+
Assuming that the above are available, two commands should suffice to
1010
build the software:
1111
```
1212
make config
@@ -26,6 +26,7 @@ Configuration options are:
2626
cc=[compiler] - The C compiler to use [default: gcc]
2727
prefix=[PATH] - Set the installation prefix [default: ~/local]
2828
gklib_path=[PATH] - Where GKlib was installed [default: ~/local]
29+
openmp=not-set - To build a serial version
2930
```
3031

3132

@@ -41,6 +42,29 @@ For usage information just type
4142
```
4243
gktc -help
4344
```
45+
and here is a sample run:
46+
```
47+
gktc -nthreads=4 test/p2p-Gnutella31.metis
48+
Reading graph test/p2p-Gnutella31.metis...
49+
50+
-----------------
51+
infile: test/p2p-Gnutella31.metis
52+
#nvtxs: 62586
53+
#nedges: 295784
54+
nthreads: 4
55+
56+
& compatible maxhmsize: 255, startv: 23
57+
58+
Results...
59+
#probes: 209251; rate: 249.98 MP/sec
60+
61+
Timings...
62+
preprocessing: 0.002s
63+
triangle counting: 0.001s
64+
total (/x i/o): 0.003s
65+
-----------------
66+
```
67+
4468

4569
## Other make commands
4670
make uninstall
@@ -54,54 +78,61 @@ gktc -help
5478

5579

5680
## Performance
57-
The following shows a sample of gktc's performance on Intel's KnightsLanding
81+
The following shows a sample of gktc's performance on Intel's Knights Landing
5882
processor:
5983

6084
```
85+
total: total time excluding I/O
86+
ppt: pre-processing time
87+
tct: triangle counting time
88+
speedup: relative to p=1
89+
6190
rmat scale25
6291
----------------------------------------
63-
#p total ppt tct speedup
64-
1 767.4 141.9 625.5
65-
5 154.4 29.1 125.2 5.0x
66-
10 77.2 14.5 62.6 9.9x
67-
20 38.6 7.3 31.2 19.9x
68-
40 19.6 3.7 16.1 39.2x
69-
68 12.2 2.2 9.9 62.9x
70-
136 9.3 1.7 7.6 82.5x
71-
272 10.1 1.5 8.6 76.0x
92+
#p total ppt tct speedup
93+
1 767.4s 141.9s 625.5s
94+
5 154.4s 29.1s 125.2s 5.0x
95+
10 77.2s 14.5s 62.6s 9.9x
96+
20 38.6s 7.3s 31.2s 19.9x
97+
40 19.6s 3.7s 16.1s 39.2x
98+
68 12.2s 2.2s 9.9s 62.9x
99+
136 9.3s 1.7s 7.6s 82.5x
100+
272 10.1s 1.5s 8.6s 76.0x
72101
73102
twitter
74103
----------------------------------------
75-
#p total ppt tct speedup
76-
1 1422.6 307.7 1114.9
77-
5 285.7 62.3 223.2 5.0x
78-
10 143.4 31.2 112.1 9.9x
79-
20 71.4 15.6 55.8 19.9x
80-
40 37.1 7.9 29.1 38.4x
81-
68 23.1 4.8 18.3 61.6x
82-
136 17.1 3.4 13.6 83.2x
83-
272 19.3 3.2 16.0 73.7x
104+
#p total ppt tct speedup
105+
1 1422.6s 307.7s 1114.9s
106+
5 285.7s 62.3s 223.2s 5.0x
107+
10 143.4s 31.2s 112.1s 9.9x
108+
20 71.4s 15.6s 55.8s 19.9x
109+
40 37.1s 7.9s 29.1s 38.4x
110+
68 23.1s 4.8s 18.3s 61.6x
111+
136 17.1s 3.4s 13.6s 83.2x
112+
272 19.3s 3.2s 16.0s 73.7x
84113
85114
friendster
86115
----------------------------------------
87-
#p total ppt tct speedup
88-
1 1618.5 421.3 1196.7
89-
5 316.8 84.8 231.5 5.1x
90-
10 159.0 42.5 116.1 10.2x
91-
20 79.5 21.3 57.8 20.4x
92-
40 40.6 10.7 29.4 39.9x
93-
68 25.5 6.5 18.4 63.5x
94-
136 16.9 4.5 11.7 95.8x
95-
272 13.5 3.6 8.9 119.9x
116+
#p total ppt tct speedup
117+
1 1618.5s 421.3s 1196.7s
118+
5 316.8s 84.8s 231.5s 5.1x
119+
10 159.0s 42.5s 116.1s 10.2x
120+
20 79.5s 21.3s 57.8s 20.4x
121+
40 40.6s 10.7s 29.4s 39.9x
122+
68 25.5s 6.5s 18.4s 63.5x
123+
136 16.9s 4.5s 11.7s 95.8x
124+
272 13.5s 3.6s 8.9s 119.9x
96125
```
97126

98127
## Citing
99128
The parallel algorithm implemented is based on the one described in
100129

101-
["Exploring Optimizations on Shared-memory Platforms for Parallel Triangle Counting
102-
Algorithms". Ancy Sarah Tom, Narayanan Sundaram, Nesreen K. Ahmed, Shaden Smith,
130+
[__"Exploring Optimizations on Shared-memory Platforms for Parallel Triangle Counting
131+
Algorithms."__ Ancy Sarah Tom, Narayanan Sundaram, Nesreen K. Ahmed, Shaden Smith,
103132
Stijn Eyerman, Midhunchandra Kodiyath, Ibrahim Hur, Fabrizio Petrini, and George
104133
Karypis. IEEE High Performance Extreme Computing Conference (HPEC),
105-
2017](http://glaros.dtc.umn.edu/gkhome/node/1214), which was one of the finalists for
106-
the [GraphChallenge 2017 competition](http://graphchallenge.mit.edu/).
134+
2017](http://glaros.dtc.umn.edu/gkhome/node/1214)
135+
136+
This was one of the finalists for the [GraphChallenge 2017
137+
competition](http://graphchallenge.mit.edu/).
107138

Diff for: main.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,12 @@ int main(int argc, char *argv[])
4545
gk_stopwctimer(vault->timer_global);
4646

4747
printf("\nResults...\n");
48-
/*
49-
printf(" #triangles: %12"PRId64"; rate: %10.2lf MT/sec\n", ntriangles,
50-
((double)ntriangles)/((double)1e6*gk_getwctimer(vault->tctimer)));
51-
*/
5248
printf(" #probes: %12"PRIu64"; rate: %10.2lf MP/sec\n", vault->nprobes,
53-
((double)vault->nprobes)/((double)1e6*gk_getwctimer(vault->tctimer)));
49+
((double)vault->nprobes)/((double)1e6*gk_getwctimer(vault->timer_tc)));
5450

5551
printf("\nTimings...\n");
56-
printf(" preprocessing: %9.3lfs\n", gk_getwctimer(vault->pptimer));
57-
printf(" triangle counting: %9.3lfs\n", gk_getwctimer(vault->tctimer));
52+
printf(" preprocessing: %9.3lfs\n", gk_getwctimer(vault->timer_pp));
53+
printf(" triangle counting: %9.3lfs\n", gk_getwctimer(vault->timer_tc));
5854
printf(" total (/x i/o): %9.3lfs\n", gk_getwctimer(vault->timer_global));
5955
printf("-----------------\n");
6056

Diff for: ptc.c

+11-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
\file
3-
\brief The various OpenMP triangle counting routines
3+
\brief The OpenMP triangle counting routine
44
\date Started 1/14/2018
55
\author George
66
\version\verbatim $Id: cmdline.c 20946 2017-05-10 23:12:48Z karypis $ \endverbatim
@@ -52,8 +52,6 @@ gk_graph_t *ptc_Preprocess(params_t *params, vault_t *vault)
5252
csrange = 16*((csrange+15)/16); /* get the per thread arrays to be alligned
5353
at the start of the cache line */
5454

55-
gk_startwctimer(vault->timer_6);
56-
5755
gcounts = gk_i32malloc(nthreads*csrange, "gcounts");
5856
psums = gk_zmalloc(nthreads, "psums");
5957

@@ -65,7 +63,11 @@ gk_graph_t *ptc_Preprocess(params_t *params, vault_t *vault)
6563
int32_t ti, di, ci, dstart, dend;
6664
int32_t *counts, *buffer;
6765
ssize_t ej, ejend, psum, chunksize;
66+
#if defined(_OPENMP)
6867
int mytid = omp_get_thread_num();
68+
#else
69+
int mytid = 0;
70+
#endif
6971

7072
vistart = mytid*((nvtxs+nthreads-1)/nthreads);
7173
viend = gk_min(nvtxs, (mytid+1)*((nvtxs+nthreads-1)/nthreads));
@@ -154,17 +156,13 @@ gk_graph_t *ptc_Preprocess(params_t *params, vault_t *vault)
154156
}
155157
}
156158
psums[mytid] = nchunks+1;
157-
//printf("mytid: %d, nchunks: %d [%zd]\n", mytid, nchunks+1, (nxadj[viend]-nxadj[vistart])/chunksize);
158159

159160
#pragma omp barrier
160161
#pragma omp single
161162
for (ti=1; ti<nthreads; ti++)
162163
psums[ti] += psums[ti-1];
163164
#pragma omp barrier
164165

165-
//#pragma omp single
166-
//printf("bsize: %d, total #chunks: %zd, chunksize: %zd\n", bsize, psums[nthreads-1], chunksize);
167-
168166
#pragma omp single
169167
chunkptr = gk_i32malloc(psums[nthreads-1]+1, "chunkptr");
170168
#pragma omp barrier
@@ -193,12 +191,7 @@ gk_graph_t *ptc_Preprocess(params_t *params, vault_t *vault)
193191
#pragma omp barrier
194192
*/
195193

196-
/* create the reordered/sorted graph */
197-
#pragma omp single
198-
gk_startwctimer(vault->timer_7);
199-
200-
201-
/* process the chunks in parallel */
194+
/* create the reordered/sorted graph by processing the chunks in parallel */
202195
#pragma omp for schedule(dynamic, 1) nowait
203196
for (ci=nchunks-1; ci>=0; ci--) {
204197
for (vi=chunkptr[ci]; vi<chunkptr[ci+1]; vi++) {
@@ -213,11 +206,7 @@ gk_graph_t *ptc_Preprocess(params_t *params, vault_t *vault)
213206
}
214207
}
215208

216-
#pragma omp single
217-
gk_stopwctimer(vault->timer_7);
218-
219209
}
220-
gk_stopwctimer(vault->timer_6);
221210

222211
gk_free((void **)&perm, &iperm, &gcounts, &psums, &chunkptr, LTERM);
223212

@@ -295,7 +284,11 @@ int64_t ptc_MapJIK(params_t *params, vault_t *vault)
295284
ssize_t ei, eiend, eistart, ej, ejend, ejstart;
296285
int32_t l, nc;
297286
int32_t l2=1, hmsize=(1<<(l2+4))-1, *hmap;
298-
int32_t mytid = omp_get_thread_num();
287+
#if defined(_OPENMP)
288+
int mytid = omp_get_thread_num();
289+
#else
290+
int mytid = 0;
291+
#endif
299292

300293
hmap = gk_i32smalloc(maxhmsize+1, 0, "hmap");
301294

Diff for: struct.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ typedef struct {
2020

2121
/* timers */
2222
double timer_global;
23-
double pptimer;
24-
double tctimer;
23+
double timer_pp;
24+
double timer_tc;
2525
} vault_t;
2626

2727

0 commit comments

Comments
 (0)