Skip to content

Commit aeea5d0

Browse files
committed
Merge pull request #114 from kknox/benchCoo2Csr-squash
Bench coo 2 csr
2 parents e525e05 + 8780430 commit aeea5d0

12 files changed

Lines changed: 394 additions & 219 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
coo2csr,,
2+
,,
3+
OpenCL runtime:,1642.5 (VM),
4+
OpenCL Device:,w9100,
5+
,,Gi-Elements/s
6+
cant,,0.221
7+
consph,,0.278
8+
cop20k_A,,0.232
9+
mac_econ_fwd500,,0.173
10+
mc2depi,,0.209
11+
pdb1HYS,,0.261
12+
pwtk,,0.304
13+
rail4284,,0.305
14+
rma10,,0.230
15+
scircuit,,0.146
16+
shipsec1,,0.551
17+
webbase_1M,,0.234
Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
#!/bin/bash
22

33
#Executable
4-
clsparse_bench=~/code/github/clMathLibraries/bin/clSPARSE/release/clSPARSE-build/staging/clsparse-bench
4+
bench_root_dir=~/code/github/kknox/bin/clSPARSE/release/clSPARSE-build/staging
5+
clsparse_bench=${bench_root_dir}/clsparse-bench
6+
function=spmdv
57

68
#Data directories
7-
mtx_cant=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/cant
8-
mtx_consph=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/consph
9-
mtx_cop20k_A=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/cop20k_A
10-
mtx_mac_econ_fwd500=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/mac_econ_fwd500
11-
mtx_mc2depi=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/mc2depi
12-
mtx_pdb1HYS=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/pdb1HYS
13-
mtx_pwtk=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/pwtk
14-
mtx_rail4284=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/rail4284
15-
mtx_rma10=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/rma10
16-
mtx_scircuit=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/scircuit
17-
mtx_shipsec1=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/shipsec1
18-
mtx_webbase_1M=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/webbase-1M
9+
data_root_dir=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland
10+
mtx_cant=${data_root_dir}/cant
11+
mtx_consph=${data_root_dir}/consph
12+
mtx_cop20k_A=${data_root_dir}/cop20k_A
13+
mtx_mac_econ_fwd500=${data_root_dir}/mac_econ_fwd500
14+
mtx_mc2depi=${data_root_dir}/mc2depi
15+
mtx_pdb1HYS=${data_root_dir}/pdb1HYS
16+
mtx_pwtk=${data_root_dir}/pwtk
17+
mtx_rail4284=${data_root_dir}/rail4284
18+
mtx_rma10=${data_root_dir}/rma10
19+
mtx_scircuit=${data_root_dir}/scircuit
20+
mtx_shipsec1=${data_root_dir}/shipsec1
21+
mtx_webbase_1M=${data_root_dir}/webbase-1M
1922

20-
clsparse_timing_dir=timings/spm-dv/14.301
23+
clsparse_timing_dir=timings/${function}/14.301
2124
mkdir -p ${clsparse_timing_dir}
22-
${clsparse_bench} -f spmdv -d ${mtx_cant} > ${clsparse_timing_dir}/cant.txt
23-
${clsparse_bench} -f spmdv -d ${mtx_consph} > ${clsparse_timing_dir}/consph.txt
24-
${clsparse_bench} -f spmdv -d ${mtx_cop20k_A} > ${clsparse_timing_dir}/cop20k_A.txt
25-
${clsparse_bench} -f spmdv -d ${mtx_mac_econ_fwd500} > ${clsparse_timing_dir}/mac_econ_fwd500.txt
26-
${clsparse_bench} -f spmdv -d ${mtx_mc2depi} > ${clsparse_timing_dir}/mc2depi.txt
27-
${clsparse_bench} -f spmdv -d ${mtx_pdb1HYS} > ${clsparse_timing_dir}/pdb1HYS.txt
28-
${clsparse_bench} -f spmdv -d ${mtx_pwtk} > ${clsparse_timing_dir}/pwtk.txt
29-
${clsparse_bench} -f spmdv -d ${mtx_rail4284} > ${clsparse_timing_dir}/rail4284.txt
30-
${clsparse_bench} -f spmdv -d ${mtx_rma10} > ${clsparse_timing_dir}/rma10.txt
31-
${clsparse_bench} -f spmdv -d ${mtx_scircuit} > ${clsparse_timing_dir}/scircuit.txt
32-
${clsparse_bench} -f spmdv -d ${mtx_shipsec1} > ${clsparse_timing_dir}/shipsec1.txt
33-
${clsparse_bench} -f spmdv -d ${mtx_webbase_1M} > ${clsparse_timing_dir}/webbase_1M.txt
25+
26+
${clsparse_bench} -f ${function} -d ${mtx_cant} > ${clsparse_timing_dir}/cant.txt
27+
${clsparse_bench} -f ${function} -d ${mtx_consph} > ${clsparse_timing_dir}/consph.txt
28+
${clsparse_bench} -f ${function} -d ${mtx_cop20k_A} > ${clsparse_timing_dir}/cop20k_A.txt
29+
${clsparse_bench} -f ${function} -d ${mtx_mac_econ_fwd500} > ${clsparse_timing_dir}/mac_econ_fwd500.txt
30+
${clsparse_bench} -f ${function} -d ${mtx_mc2depi} > ${clsparse_timing_dir}/mc2depi.txt
31+
${clsparse_bench} -f ${function} -d ${mtx_pdb1HYS} > ${clsparse_timing_dir}/pdb1HYS.txt
32+
${clsparse_bench} -f ${function} -d ${mtx_pwtk} > ${clsparse_timing_dir}/pwtk.txt
33+
${clsparse_bench} -f ${function} -d ${mtx_rail4284} > ${clsparse_timing_dir}/rail4284.txt
34+
${clsparse_bench} -f ${function} -d ${mtx_rma10} > ${clsparse_timing_dir}/rma10.txt
35+
${clsparse_bench} -f ${function} -d ${mtx_scircuit} > ${clsparse_timing_dir}/scircuit.txt
36+
${clsparse_bench} -f ${function} -d ${mtx_shipsec1} > ${clsparse_timing_dir}/shipsec1.txt
37+
${clsparse_bench} -f ${function} -d ${mtx_webbase_1M} > ${clsparse_timing_dir}/webbase_1M.txt
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Coo2Csr,,
2+
,,
3+
CUDA driver:,346.47,
4+
OpenCL Device:,k40c,
5+
,,Gi-Elements/s
6+
cant,,0.312
7+
consph,,0.032
8+
cop20k_A,,0.001
9+
mac_econ_fwd500,,0.152
10+
mc2depi,,0.233
11+
pdb1HYS,,0.062
12+
pwtk,,0.016
13+
rail4284,,0.071
14+
rma10,,0.020
15+
scircuit,,0.002
16+
shipsec1,,0.052
17+
webbase_1M,,0.001
Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
#!/bin/bash
22

33
#Executable
4-
cusparse_bench=~/code/github/clMathLibraries/bin/clSPARSE/release/clSPARSE-build/staging/cusparse-bench
4+
bench_root_dir=~/code/github/kknox/bin/clsparse/release/clSPARSE-build/staging
5+
cusparse_bench=${bench_root_dir}/cusparse-bench
6+
function=spmdv
57

68
#Data directories
7-
mtx_cant=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/cant
8-
mtx_consph=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/consph
9-
mtx_cop20k_A=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/cop20k_A
10-
mtx_mac_econ_fwd500=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/mac_econ_fwd500
11-
mtx_mc2depi=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/mc2depi
12-
mtx_pdb1HYS=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/pdb1HYS
13-
mtx_pwtk=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/pwtk
14-
mtx_rail4284=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/rail4284
15-
mtx_rma10=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/rma10
16-
mtx_scircuit=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/scircuit
17-
mtx_shipsec1=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/shipsec1
18-
mtx_webbase_1M=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland/webbase-1M
9+
data_root_dir=~/code/github/clMathLibraries/bin/deps/release/Externals/MTX/Bell_Garland
10+
mtx_cant=${data_root_dir}/cant
11+
mtx_consph=${data_root_dir}/consph
12+
mtx_cop20k_A=${data_root_dir}/cop20k_A
13+
mtx_mac_econ_fwd500=${data_root_dir}/mac_econ_fwd500
14+
mtx_mc2depi=${data_root_dir}/mc2depi
15+
mtx_pdb1HYS=${data_root_dir}/pdb1HYS
16+
mtx_pwtk=${data_root_dir}/pwtk
17+
mtx_rail4284=${data_root_dir}/rail4284
18+
mtx_rma10=${data_root_dir}/rma10
19+
mtx_scircuit=${data_root_dir}/scircuit
20+
mtx_shipsec1=${data_root_dir}/shipsec1
21+
mtx_webbase_1M=${data_root_dir}/webbase-1M
1922

20-
mkdir -p timings-cusparse-spmdv
21-
${cusparse_bench} -f spmdv -d ${mtx_cant} > timings-cusparse-spmdv/cant.txt
22-
${cusparse_bench} -f spmdv -d ${mtx_consph} > timings-cusparse-spmdv/consph.txt
23-
${cusparse_bench} -f spmdv -d ${mtx_cop20k_A} > timings-cusparse-spmdv/cop20k_A.txt
24-
${cusparse_bench} -f spmdv -d ${mtx_mac_econ_fwd500} > timings-cusparse-spmdv/mac_econ_fwd500.txt
25-
${cusparse_bench} -f spmdv -d ${mtx_mc2depi} > timings-cusparse-spmdv/mc2depi.txt
26-
${cusparse_bench} -f spmdv -d ${mtx_pdb1HYS} > timings-cusparse-spmdv/pdb1HYS.txt
27-
${cusparse_bench} -f spmdv -d ${mtx_pwtk} > timings-cusparse-spmdv/pwtk.txt
28-
${cusparse_bench} -f spmdv -d ${mtx_rail4284} > timings-cusparse-spmdv/rail4284.txt
29-
${cusparse_bench} -f spmdv -d ${mtx_rma10} > timings-cusparse-spmdv/rma10.txt
30-
${cusparse_bench} -f spmdv -d ${mtx_scircuit} > timings-cusparse-spmdv/scircuit.txt
31-
${cusparse_bench} -f spmdv -d ${mtx_shipsec1} > timings-cusparse-spmdv/shipsec1.txt
32-
${cusparse_bench} -f spmdv -d ${mtx_webbase_1M} > timings-cusparse-spmdv/webbase_1M.txt
23+
cusparse_timing_dir=timings/${function}/346.47
24+
mkdir -p ${cusparse_timing_dir}
25+
26+
${cusparse_bench} -f ${function} -d ${mtx_cant} > ${cusparse_timing_dir}/cant.txt
27+
${cusparse_bench} -f ${function} -d ${mtx_consph} > ${cusparse_timing_dir}/consph.txt
28+
${cusparse_bench} -f ${function} -d ${mtx_cop20k_A} > ${cusparse_timing_dir}/cop20k_A.txt
29+
${cusparse_bench} -f ${function} -d ${mtx_mac_econ_fwd500} > ${cusparse_timing_dir}/mac_econ_fwd500.txt
30+
${cusparse_bench} -f ${function} -d ${mtx_mc2depi} > ${cusparse_timing_dir}/mc2depi.txt
31+
${cusparse_bench} -f ${function} -d ${mtx_pdb1HYS} > ${cusparse_timing_dir}/pdb1HYS.txt
32+
${cusparse_bench} -f ${function} -d ${mtx_pwtk} > ${cusparse_timing_dir}/pwtk.txt
33+
${cusparse_bench} -f ${function} -d ${mtx_rail4284} > ${cusparse_timing_dir}/rail4284.txt
34+
${cusparse_bench} -f ${function} -d ${mtx_rma10} > ${cusparse_timing_dir}/rma10.txt
35+
${cusparse_bench} -f ${function} -d ${mtx_scircuit} > ${cusparse_timing_dir}/scircuit.txt
36+
${cusparse_bench} -f ${function} -d ${mtx_shipsec1} > ${cusparse_timing_dir}/shipsec1.txt
37+
${cusparse_bench} -f ${function} -d ${mtx_webbase_1M} > ${cusparse_timing_dir}/webbase_1M.txt

src/benchmarks/clsparse-bench/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ set( clsparse.bench.hdr
1616
functions/clfunc_xCG.hpp
1717
functions/clfunc_xBiCGStab.hpp
1818
functions/clfunc_xCoo2Csr.hpp
19+
functions/clfunc_xCsr2Coo.hpp
1920
functions/clfunc_xDense2Csr.hpp
21+
functions/clfunc_xCsr2Dense.hpp
2022
)
2123

2224
include_directories(

src/benchmarks/clsparse-bench/functions/clfunc_xCoo2Csr.hpp

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,13 @@ class xCoo2Csr: public clsparseFunc
6767

6868
double bandwidth( )
6969
{
70-
// Assuming that accesses to the vector always hit in the cache after the first access
71-
// There are NNZ integers in the cols[ ] array
72-
// You access each integer value in row_delimiters[ ] once.
73-
// There are NNZ float_types in the vals[ ] array
74-
// You read num_cols floats from the vector, afterwards they cache perfectly.
75-
// Finally, you write num_rows floats out to DRAM at the end of the kernel.
76-
return ( sizeof( cl_int )*( csrMtx.num_nonzeros + csrMtx.num_rows ) + sizeof( T ) * ( csrMtx.num_nonzeros + csrMtx.num_cols + csrMtx.num_rows ) ) / time_in_ns( );
70+
// Number of Elements converted in unit time
71+
return ( n_vals / time_in_ns( ) );
7772
}
7873

7974
std::string bandwidth_formula( )
8075
{
81-
return "GiB/s";
76+
return "Gi-Elements/s";
8277
}
8378

8479

@@ -88,15 +83,14 @@ class xCoo2Csr: public clsparseFunc
8883

8984
cl_int status;
9085

91-
int nnz1, row1, col1;
92-
clsparseStatus fileError = clsparseHeaderfromFile( &nnz1, &row1, &col1, path.c_str( ) );
86+
clsparseStatus fileError = clsparseHeaderfromFile( &n_vals, &n_rows, &n_cols, path.c_str( ) );
9387
if( fileError != clsparseSuccess )
9488
throw std::runtime_error( "Could not read matrix market header from disk" );
9589

9690
clsparseInitCooMatrix( &cooMatx );
97-
cooMatx.num_nonzeros = nnz1;
98-
cooMatx.num_rows = row1;
99-
cooMatx.num_cols = col1;
91+
cooMatx.num_nonzeros = n_vals;
92+
cooMatx.num_rows = n_rows;
93+
cooMatx.num_cols = n_cols;
10094

10195
cooMatx.values = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY,
10296
cooMatx.num_nonzeros * sizeof(T), NULL, &status );
@@ -105,8 +99,6 @@ class xCoo2Csr: public clsparseFunc
10599
cooMatx.rowIndices = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY,
106100
cooMatx.num_nonzeros * sizeof( cl_int ), NULL, &status );
107101

108-
//JPA: Bug fix: That will not work for double precision
109-
//clsparseCooMatrixfromFile( &cooMatx, path.c_str( ), control );
110102
if (typeid(T) == typeid(float))
111103
clsparseSCooMatrixfromFile(&cooMatx, path.c_str(), control);
112104
if (typeid(T) == typeid(double))
@@ -116,12 +108,12 @@ class xCoo2Csr: public clsparseFunc
116108
clsparseInitCsrMatrix( &csrMtx );
117109

118110
//JPA:: Shouldn't be CL_MEM_WRITE_ONLY since coo ---> csr???
119-
csrMtx.values = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY,
111+
csrMtx.values = ::clCreateBuffer( ctx, CL_MEM_READ_WRITE,
120112
cooMatx.num_nonzeros * sizeof( T ), NULL, &status );
121113

122-
csrMtx.colIndices = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY,
114+
csrMtx.colIndices = ::clCreateBuffer( ctx, CL_MEM_READ_WRITE,
123115
cooMatx.num_nonzeros * sizeof( cl_int ), NULL, &status );
124-
csrMtx.rowOffsets = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY,
116+
csrMtx.rowOffsets = ::clCreateBuffer( ctx, CL_MEM_READ_WRITE,
125117
( cooMatx.num_rows + 1 ) * sizeof( cl_int ), NULL, &status );
126118

127119
}
@@ -157,13 +149,13 @@ class xCoo2Csr: public clsparseFunc
157149
if( gpuTimer && cpuTimer )
158150
{
159151
std::cout << "clSPARSE matrix: " << sparseFile << std::endl;
160-
size_t sparseBytes = 0;
152+
size_t sparseElements = n_vals;
161153
cpuTimer->pruneOutliers( 3.0 );
162-
cpuTimer->Print( sparseBytes, "GiB/s" );
154+
cpuTimer->Print( sparseElements, "GiElements/s" );
163155
cpuTimer->Reset( );
164156

165157
gpuTimer->pruneOutliers( 3.0 );
166-
gpuTimer->Print( sparseBytes, "GiB/s" );
158+
gpuTimer->Print( sparseElements, "GiElements/s" );
167159
gpuTimer->Reset( );
168160
}
169161

@@ -193,9 +185,9 @@ class xCoo2Csr: public clsparseFunc
193185
clsparseCooMatrix cooMatx;
194186

195187
//matrix dimension
196-
int m;
197-
int n;
198-
int nnz;
188+
int n_rows;
189+
int n_cols;
190+
int n_vals;
199191

200192
// OpenCL state
201193
cl_command_queue_properties cqProp;

0 commit comments

Comments
 (0)