gunrock / graphblast

High-Performance Linear Algebra-based Graph Primitives on GPUs
Apache License 2.0
209 stars 27 forks source link

Cannot reproduce PR number on socLiveJournal data #12

Closed dkoutsou closed 4 years ago

dkoutsou commented 4 years ago

Hey,

I am trying to reproduce your Page Rank number on the socLiveJournal-1. I installed CUDA-9.1 and gcc-5.4.0. I downloaded the data from here. I remove the first comment lines and added the required ones to convert the data to an .mtx file:

%%MatrixMarket matrix coordinate pattern general
4847571 4847571 68993773

I compiled the Page Rank example (using the Makefile with make gpr). Here is my output after running it:

 -> % ./run_pr.sh
bin/gpr --timing 1 --mxvmode 0 --niter 100 --max_niter 1000 data/topc-datasets/soc-LiveJournal1.mtx
Undirected due to mtx: 0
Undirected due to cmd: 0
Undirected: 0
Remove self-loop: 1
Reading data/topc-datasets/.soc-LiveJournal1.mtx.d.nosl.bin
Allocate 4847572
Allocate 82170360
Allocate 82170360
Do not allocate 4847571 0x7f92c5367010
Do not allocate 68475300 0x7f92b19f2010
Do not allocate 68475300 0x7f929e07d010
Do not allocate 4847571 0x7f92c5367010
Do not allocate 68475300 0x7f92b19f2010
Do not allocate 68475300 0x7f929e07d010
output:
[0]:4.39931e-06 [1]:2.28478e-06 [2]:1.69434e-06 [3]:1.92988e-06 [4]:1.22651e-06 [5]:2.72542e-06 [6]:1.1593e-06 [7]:6.15954e-07 [8]:1.37225e-06 [9]:7.86397e-07 [10]:1.81577e-06 [11]:1.33162e-06 [12]:9.23166e-06 [13]:1.69406e-06 [14]:3.96623e-07 [15]:1.44772e-06 [16]:1.2477e-06 [17]:3.52301e-07 [18]:9.64398e-06 [19]:1.0859e-06 [20]:1.2196e-06 [21]:3.94725e-07 [22]:5.35532e-07 [23]:5.91095e-07 [24]:2.39766e-07 [25]:1.27003e-06 [26]:4.75216e-07 [27]:1.35969e-06 [28]:4.24832e-07 [29]:2.08527e-07 [30]:1.8405e-06 [31]:1.94205e-06 [32]:5.78724e-07 [33]:7.93741e-07 [34]:7.44357e-08 [35]:6.85211e-07 [36]:2.066e-07 [37]:8.49346e-07 [38]:1.00569e-06 [39]:6.59399e-07
CPU PR finished in 935.825134 msec. Search depth is: 3. Resultant: 0.000000

CORRECT
cpu, 957.859,
warmup, 294.753, 0
tight, 264.629
vxm, 290.707

CORRECT 

If I interpret the numbers correctly one GPU iteration does 290ms whereas in the paper you mention that an iteration does 21ms. Also my GPU is a Tesla P100, which I believe is better than the one that you have used in your experiments. What am I doing wrong? I would appreciate any help!

Thank you for your time in advance.

ctcyang commented 4 years ago

Thank you for your interest.

What --niter tells is how many times you want to compute PageRank to convergence _after warm-up. The default convergence criteria is whichever is first reached: 1) 1e-8 (see https://github.com/gunrock/graphblast/blob/1a052558a71f2cd67f5d6fe9db3b274c303ef8f6/example/gpr.cu#L68). 2) PageRank iteration count reaches max_niter (see https://github.com/gunrock/graphblast/blob/1a052558a71f2cd67f5d6fe9db3b274c303ef8f6/graphblas/algorithm/pr.hpp#L50).

If you set --timing 1 (error with the run_pr.sh script that only echoes --timing 1 but actually executes --timing 0), you should see a print out that looks as follows. Since my GPU is 1 generation older than yours, it took me 217.967ms to process 10 PageRank iterations. Then the per PageRank iteration would be 217.967ms / 10 iterations = ~21.8ms / iteration, which is close to the number in the paper.

$ bin/gpr --timing 1 --mxvmode 0 --niter 1 --max_niter 10 /mario-2TB/ctcyang/qe-dataset/soc-LiveJournal1/soc-LiveJournal1.mtx

Undirected due to mtx: 1
Undirected due to cmd: 0
Undirected: 1
Remove self-loop: 1
%%MatrixMarket matrix coordinate pattern symmetric
4847571 4847571 85702474
Allocate 4847572
Allocate 102842968
Allocate 102842968
Error: Unable to open file for writing!
Do not allocate 4847571 0x7fd188043010
Do not allocate 85702474 0x7fd08981e010
Do not allocate 85702474 0x7fd070fcd010
Do not allocate 4847571 0x7fd188043010
Do not allocate 85702474 0x7fd08981e010
Do not allocate 85702474 0x7fd070fcd010
output:
[0]:1.12354e-06 [1]:4.34784e-06 [2]:2.16458e-06 [3]:1.48264e-06 [4]:1.68473e-06 [5]:1.11411e-06 [6]:2.48564e-06 [7]:9.69221e-07 [8]:5.61167e-07 [9]:1.47378e-06 [10]:8.87791e-07 [11]:1.77316e-06 [12]:1.18192e-06 [13]:7.88482e-06 [14]:1.31274e-06 [15]:3.38896e-07 [16]:1.20574e-06 [17]:1.02075e-06 [18]:2.78271e-07 [19]:1.04159e-05 [20]:7.94688e-07 [21]:1.20331e-06 [22]:4.49042e-07 [23]:5.67421e-07 [24]:5.63578e-07 [25]:1.58316e-07 [26]:9.8955e-07 [27]:4.66949e-07 [28]:9.72953e-07 [29]:3.67839e-07 [30]:2.34166e-07 [31]:1.38741e-06 [32]:1.72217e-06 [33]:4.49905e-07 [34]:8.2128e-07 [35]:1.35088e-07 [36]:7.25688e-07 [37]:2.52794e-07 [38]:5.797e-07 [39]:9.27886e-07
CPU PR finished in 1873.186157 msec. Search depth is: 4. Resultant: 0.000000
1, 0.000985679/4847571, 4847570, pull, 22.6468
2, 0.000483457/4847571, 4847570, pull, 21.8343
3, 0.000184684/4847571, 4847570, pull, 21.8025
4, 0.00013746/4847571, 4847570, pull, 21.8063
5, 8.16702e-05/4847571, 4847570, pull, 21.7956
6, 6.52675e-05/4847571, 4847570, pull, 21.8284
7, 4.3504e-05/4847571, 4847570, pull, 21.8376
8, 3.55718e-05/4847571, 4847570, pull, 21.8678
9, 2.48263e-05/4847571, 4847570, pull, 21.8801
11, 2.05546e-05/4847571, 4847570, pull, 21.8526

CORRECT
1, 0.000985679/4847571, 4847570, pull, 21.8169
2, 0.000483457/4847571, 4847570, pull, 21.8275
3, 0.000184684/4847571, 4847570, pull, 21.8266
4, 0.00013746/4847571, 4847570, pull, 21.77
5, 8.16702e-05/4847571, 4847570, pull, 21.7376
6, 6.52675e-05/4847571, 4847570, pull, 21.7971
7, 4.3504e-05/4847571, 4847570, pull, 21.8248
8, 3.55718e-05/4847571, 4847570, pull, 21.8723
9, 2.48263e-05/4847571, 4847570, pull, 21.8034
11, 2.05546e-05/4847571, 4847570, pull, 21.8062
cpu, 1910.01,
warmup, 300.533, 0
tight, 217.967
vxm, 297.536

CORRECT

Another difference is I changed the header to make the graph be treated as a symmetric graph. In the paper, this is reflected Table 12 by an rs beside soc-LiveJournal1 (s for symmetric).

%%MatrixMarket matrix coordinate pattern symmetric
4847571 4847571 85702474

If you are a purist and want to treat the graph as directed, you can by passing in a --directed 1 flag. Running the graph as directed, runtime goes down to 18.8185ms / iteration.

dkoutsou commented 4 years ago

Thank you very much for your answer! Now one iteration on my GPU takes about 5ms. Makes much more sense!