14 #include <cusp/gallery/poisson.h>
15 #include <cusp/csr_matrix.h>
24 template <
typename Orientation,
25 typename IndexType,
typename ValueType,
typename MemorySpace>
27 const cusp::csr_matrix<IndexType, ValueType, MemorySpace>&
A,
28 IndexType nrhs, IndexType max_its, ValueType tol) {
31 cusp::array2d<ValueType, MemorySpace, Orientation> x(A.num_rows, nrhs, 0);
32 cusp::array2d<ValueType, MemorySpace, Orientation> b(A.num_rows, nrhs, 1);
50 typedef int IndexType;
51 typedef double ValueType;
52 typedef cusp::device_memory MemorySpace;
61 CLP.
setDocString(
"This test performance of block multiply routines.\n");
63 CLP.
setOption(
"n", &n,
"Number of mesh points in the each direction");
64 IndexType nrhs_begin = 32;
66 "Staring number of right-hand-sides");
67 IndexType nrhs_end = 512;
69 "Ending number of right-hand-sides");
70 IndexType nrhs_step = 32;
72 "Increment in number of right-hand-sides");
73 IndexType max_its = 100;
75 "Maximum number of CG iterations");
77 CLP.
setOption(
"tolerance", &tol,
"Convergence tolerance");
79 CLP.
setOption(
"device", &device_id,
"CUDA device ID");
80 CLP.
parse( argc, argv );
83 cudaSetDevice(device_id);
84 cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte);
87 cusp::csr_matrix<IndexType, ValueType, MemorySpace>
A;
88 cusp::gallery::poisson27pt(A, n, n, n);
102 std::cout <<
"nrhs , num_rows , num_entries , "
103 <<
"row_cg , row_op , row_prec , row_prec_op , row_coarse , "
104 <<
"col_cg , col_op , col_prec , col_prec_op , col_coarse"
107 for (IndexType nrhs = nrhs_begin; nrhs <= nrhs_end; nrhs += nrhs_step) {
109 std::cout << nrhs <<
" , "
110 << A.num_rows <<
" , " << A.num_entries <<
" , ";
114 cusp_sa_block_cg<cusp::row_major>(A, nrhs, max_its, tol);
124 cusp_sa_block_cg<cusp::column_major>(A, nrhs, max_its, tol);
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
void blockcg(LinearOperator &A, Vector &x, Vector &b)
static RCP< Time > getNewTimer(const std::string &name)
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
void cusp_sa_block_cg(IndexType nx, IndexType ny, IndexType nz, IndexType nrhs, IndexType max_its, ValueType tol, bool verbose)
EParseCommandLineReturn parse(int argc, char *argv[], std::ostream *errout=&std::cerr) const
int main(int argc, char **argv)
void setDocString(const char doc_string[])
double totalElapsedTime(bool readCurrentTime=false) const
static void zeroOutTimers()