Sparse matrix reader with incorrect nnz
shyhuai opened this issue · comments
Dear authors,
I run some simple benchmarks after I successfully compiled the codes on a Titan X GPU. But from the output log, it seems that the sparse matrix was read incorrectly. For example, I tried the command with a sparse matrix from here: c-42:
$./bin/gbspmm --iter=100 --tb=32 --nt=128 --max_ncols=10471 c-42.mtx
The output gives:
c-42.mtx, 10471, 10471, **99815**, 0, 4013, 0, 940, 10, 1000, 332, 1208, 128, 128, 0, 36, 712, 448, 40, 256, 9, 128, 0, 20, 64, 0, 264, 192, 8, 0, 128, 0, 8, 80, 40, 0, 279, 0, 9.53252, 41.339, 4.33663, 23.2004, merge path, 9.50961, 219.812, 92.3251,
The matrix was read by the program as a 10471x10471 with 99815 non zero elements, while the original file says 110285. Is there any particular process in the file reading? Thanks!
The reason is our processing is used for graphs as well. That is why in our preprocessing, we remove what are known in graphs as self-loops (diagonal elements of the adjacency matrix):
Line 220 in 5b84296
For example, if I run it as is, it will produce:
bin/gbspmm --iter=100 --tb=32 --nt=128 --max_ncols=10471 /data/ctcyang/GraphBLAS/dataset/large/c-42/c-42.mtx
Remove self-loops: 1
/data/ctcyang/GraphBLAS/dataset/large/c-42/c-42.mtx, 10471, 10471, 99815, 0, 4013, 0, 940, 10, 1000, 332, 1208, 128, 128, 0, 36, 712, 448, 40, 256, 9, 128, 0, 20, 64, 0, 264, 192, 8, 0, 128, 0, 8, 80, 40, 0, 279, 0, 9.53252, 41.339, 4.33663, 23.2004, cusparse, 6.45728, 323.716, 135.967, cusparse2, 6.70205, 311.893, 131.001, row split, 4.90441, 426.213, 179.017, row split2, 6.52659, 320.278, 134.523, row split3, 4.25479, 491.287, 206.35, row split4, 6.03471, 346.384, 145.488, merge path, 3.75097, 557.276, 234.066,
However if I set this argument to false:
bin/gbspmm --iter=100 --tb=32 --nt=128 --max_ncols=10471 /data/ctcyang/GraphBLAS/dataset/large/c-42/c-42.mtx
Remove self-loops: 0
/data/ctcyang/GraphBLAS/dataset/large/c-42/c-42.mtx, 10471, 10471, 110285, 0, 0, 4013, 0, 940, 10, 1000, 332, 1208, 128, 128, 0, 36, 712, 448, 40, 256, 9, 128, 0, 20, 64, 0, 264, 192, 8, 0, 128, 0, 8, 80, 40, 279, 0, 10.5324, 41.3385, 3.92488, 23.2011, cusparse, 6.60607, 349.616, 132.917, cusparse2, 7.99349, 288.934, 109.847, row split, 5.51876, 418.498, 159.104, row split2, 6.68275, 345.605, 131.392, row split3, 4.26773, 541.175, 205.744, row split4, 6.08959, 379.268, 144.19, merge path, 4.59626e-43, inf, inf,
This is where your missing nonzeroes have gone.
Noted with many thanks!