Skip to content

Commit e48adf4

Browse files
author
Kent Knox
committed
Merge pull request #179 from kvaragan/clsparseIdx_t
32/64 bit container support, uses clsparseIdx_t as the data type 👍
2 parents 42e7a10 + bd3e6ec commit e48adf4

76 files changed

Lines changed: 1378 additions & 810 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

beta2graphs/CSR2COO.png

36.9 KB
Loading

beta2graphs/CSR2Dense.png

20.7 KB
Loading

beta2graphs/Coo2Csr.png

28.6 KB
Loading

beta2graphs/Dense2Csr.png

36.4 KB
Loading

beta2graphs/SpGemm.png

40.5 KB
Loading

beta2graphs/SpMdV_Double.png

39.1 KB
Loading

cmake/ExternalBoost.cmake

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ include( ExternalProject )
2424
# ExternalProject
2525

2626
# Change this one line to upgrade to newer versions of boost
27-
set( ext.Boost_VERSION "1.58.0" CACHE STRING "Boost version to download/use" )
27+
set( ext.Boost_VERSION "1.59.0" CACHE STRING "Boost version to download/use" )
2828
mark_as_advanced( ext.Boost_VERSION )
2929
string( REPLACE "." "_" ext.Boost_Version_Underscore ${ext.Boost_VERSION} )
3030

@@ -41,7 +41,11 @@ else( )
4141
set( Boost_Ext "tar.bz2" )
4242
endif( )
4343

44-
set( Boost.Command ./b2 --prefix=<INSTALL_DIR>/package )
44+
if( WIN32 )
45+
set( Boost.Command b2 --prefix=<INSTALL_DIR>/package )
46+
else( )
47+
set( Boost.Command ./b2 --prefix=<INSTALL_DIR>/package )
48+
endif( )
4549

4650
if( CMAKE_COMPILER_IS_GNUCXX )
4751
list( APPEND Boost.Command cxxflags=-fPIC -std=c++11 )
@@ -67,6 +71,8 @@ else( )
6771
endif( )
6872

6973
message( STATUS "ExternalBoost using ( " ${Cores} " ) cores to build with" )
74+
message( STATUS "ExternalBoost building [ program_options, serialization, filesystem, system, regex ] components" )
75+
7076
list( APPEND Boost.Command -j ${Cores} --with-program_options --with-serialization --with-filesystem --with-system --with-regex )
7177

7278
if( BUILD64 )
@@ -141,20 +147,20 @@ mark_as_advanced( ext.Boost_URL )
141147
set( Boost.Bootstrap "" )
142148
set( ext.MD5_HASH "" )
143149
if( WIN32 )
144-
set( Boost.Bootstrap ".\\bootstrap.bat" )
150+
set( Boost.Bootstrap "bootstrap.bat" )
145151

146152
if( CMAKE_VERSION VERSION_LESS "3.1.0" )
147153
# .zip file
148-
set( ext.MD5_HASH "b0605a9323f1e960f7434dbbd95a7a5c" )
154+
set( ext.MD5_HASH "08d29a2d85db3ebc8c6fdfa3a1f2b83c" )
149155
else( )
150156
# .7z file
151-
set( ext.MD5_HASH "f7255aeb692c1c38fe761c32fb0d3ecd" )
157+
set( ext.MD5_HASH "0a2e512844f3e30a6240f8139ee983f3" )
152158
endif( )
153159
else( )
154160
set( Boost.Bootstrap "./bootstrap.sh" )
155161

156162
# .tar.bz2
157-
set( ext.MD5_HASH "b8839650e61e9c1c0a89f371dd475546" )
163+
set( ext.MD5_HASH "6aa9a5c6a4ca1016edd0ed1178e3cb87" )
158164

159165
if( XCODE_VERSION )
160166
list( APPEND Boost.Bootstrap --with-toolset=clang )

samples/sample-cg.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int main (int argc, char* argv[])
166166

167167

168168
// Read matrix from file. Calculates the rowBlocks strucutres as well.
169-
int nnz, row, col;
169+
clsparseIdx_t nnz, row, col;
170170
// read MM header to get the size of the matrix;
171171
clsparseStatus fileError
172172
= clsparseHeaderfromFile( &nnz, &row, &col, matrix_path.c_str( ) );
@@ -186,10 +186,10 @@ int main (int argc, char* argv[])
186186
A.num_nonzeros * sizeof( float ), NULL, &cl_status );
187187

188188
A.colIndices = ::clCreateBuffer( context(), CL_MEM_READ_ONLY,
189-
A.num_nonzeros * sizeof( cl_int ), NULL, &cl_status );
189+
A.num_nonzeros * sizeof( clsparseIdx_t ), NULL, &cl_status );
190190

191191
A.rowOffsets = ::clCreateBuffer( context(), CL_MEM_READ_ONLY,
192-
( A.num_rows + 1 ) * sizeof( cl_int ), NULL, &cl_status );
192+
( A.num_rows + 1 ) * sizeof( clsparseIdx_t ), NULL, &cl_status );
193193

194194
A.rowBlocks = ::clCreateBuffer( context(), CL_MEM_READ_ONLY,
195195
A.rowBlockSize * sizeof( cl_ulong ), NULL, &cl_status );

samples/sample-spmv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int main (int argc, char* argv[])
198198

199199

200200
// Read matrix from file. Calculates the rowBlocks strucutres as well.
201-
int nnz, row, col;
201+
clsparseIdx_t nnz, row, col;
202202
// read MM header to get the size of the matrix;
203203
clsparseStatus fileError
204204
= clsparseHeaderfromFile( &nnz, &row, &col, matrix_path.c_str( ) );
@@ -218,10 +218,10 @@ int main (int argc, char* argv[])
218218
A.num_nonzeros * sizeof( float ), NULL, &cl_status );
219219

220220
A.colIndices = ::clCreateBuffer( context(), CL_MEM_READ_ONLY,
221-
A.num_nonzeros * sizeof( cl_int ), NULL, &cl_status );
221+
A.num_nonzeros * sizeof( clsparseIdx_t ), NULL, &cl_status );
222222

223223
A.rowOffsets = ::clCreateBuffer( context(), CL_MEM_READ_ONLY,
224-
( A.num_rows + 1 ) * sizeof( cl_int ), NULL, &cl_status );
224+
( A.num_rows + 1 ) * sizeof( clsparseIdx_t ), NULL, &cl_status );
225225

226226
A.rowBlocks = ::clCreateBuffer( context(), CL_MEM_READ_ONLY,
227227
A.rowBlockSize * sizeof( cl_ulong ), NULL, &cl_status );

src/benchmarks/clsparse-bench/functions/clfunc-xSpMdM.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ template <typename T>
2525
class xSpMdM: public clsparseFunc
2626
{
2727
public:
28-
xSpMdM( PFCLSPARSETIMER sparseGetTimer, size_t profileCount, cl_device_type devType, size_t columns, cl_bool keep_explicit_zeroes = true ): clsparseFunc( devType, CL_QUEUE_PROFILING_ENABLE ), gpuTimer( nullptr ), cpuTimer( nullptr ), num_columns( columns )
28+
xSpMdM( PFCLSPARSETIMER sparseGetTimer, size_t profileCount, cl_device_type devType, clsparseIdx_t columns, cl_bool keep_explicit_zeroes = true ): clsparseFunc( devType, CL_QUEUE_PROFILING_ENABLE ), gpuTimer( nullptr ), cpuTimer( nullptr ), num_columns( columns )
2929
{
3030
// Create and initialize our timer class, if the external timer shared library loaded
3131
if( sparseGetTimer )
@@ -87,7 +87,7 @@ class xSpMdM: public clsparseFunc
8787
// There are NNZ float_types in the vals[ ] array
8888
// You read num_cols floats from the vector, afterwards they cache perfectly.
8989
// Finally, you write num_rows floats out to DRAM at the end of the kernel.
90-
return ( sizeof( cl_int )*( csrMtx.num_nonzeros + csrMtx.num_rows ) + sizeof( T ) * ( csrMtx.num_nonzeros + csrMtx.num_cols + csrMtx.num_rows ) ) / time_in_ns( );
90+
return (sizeof(clsparseIdx_t)*(csrMtx.num_nonzeros + csrMtx.num_rows) + sizeof(T) * (csrMtx.num_nonzeros + csrMtx.num_cols + csrMtx.num_rows)) / time_in_ns();
9191
}
9292

9393
std::string bandwidth_formula( )
@@ -104,7 +104,7 @@ class xSpMdM: public clsparseFunc
104104
beta = static_cast< T >( pBeta );
105105

106106
// Read sparse data from file and construct a CSR matrix from it
107-
int nnz, row, col;
107+
clsparseIdx_t nnz, row, col;
108108
clsparseStatus fileError = clsparseHeaderfromFile( &nnz, &row, &col, sparseFile.c_str( ) );
109109
if( fileError != clsparseSuccess )
110110
throw clsparse::io_exception( "Could not read matrix market header from disk: " + sparseFile );
@@ -119,10 +119,10 @@ class xSpMdM: public clsparseFunc
119119
csrMtx.values = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY, csrMtx.num_nonzeros * sizeof( T ), NULL, &status );
120120
CLSPARSE_V( status, "::clCreateBuffer csrMtx.values" );
121121

122-
csrMtx.colIndices = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY, csrMtx.num_nonzeros * sizeof( cl_int ), NULL, &status );
122+
csrMtx.colIndices = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, csrMtx.num_nonzeros * sizeof(clsparseIdx_t), NULL, &status);
123123
CLSPARSE_V( status, "::clCreateBuffer csrMtx.colIndices" );
124124

125-
csrMtx.rowOffsets = ::clCreateBuffer( ctx, CL_MEM_READ_ONLY, ( csrMtx.num_rows + 1 ) * sizeof( cl_int ), NULL, &status );
125+
csrMtx.rowOffsets = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, (csrMtx.num_rows + 1) * sizeof(clsparseIdx_t), NULL, &status);
126126
CLSPARSE_V( status, "::clCreateBuffer csrMtx.rowOffsets" );
127127

128128
fileError = clsparseSCsrMatrixfromFile( &csrMtx, sparseFile.c_str( ), control, explicit_zeroes );
@@ -204,7 +204,7 @@ class xSpMdM: public clsparseFunc
204204
if( gpuTimer && cpuTimer )
205205
{
206206
std::cout << "clSPARSE matrix: " << sparseFile << std::endl;
207-
size_t sparseBytes = sizeof( cl_int )*( csrMtx.num_nonzeros + csrMtx.num_rows ) + sizeof( T ) * ( csrMtx.num_nonzeros + csrMtx.num_cols + csrMtx.num_rows );
207+
clsparseIdx_t sparseBytes = sizeof(clsparseIdx_t)*(csrMtx.num_nonzeros + csrMtx.num_rows) + sizeof(T) * (csrMtx.num_nonzeros + csrMtx.num_cols + csrMtx.num_rows);
208208
cpuTimer->pruneOutliers( 3.0 );
209209
cpuTimer->Print( sparseBytes, "GiB/s" );
210210
cpuTimer->Reset( );
@@ -247,7 +247,7 @@ class xSpMdM: public clsparseFunc
247247
// host values
248248
T alpha;
249249
T beta;
250-
size_t num_columns;
250+
clsparseIdx_t num_columns;
251251
cl_bool explicit_zeroes;
252252

253253
// OpenCL state

0 commit comments

Comments
 (0)