Skip to content

Commit 9045ff0

Browse files
author
Adachi Daiki
committed
Merge branch '753-tensor_coo' into 'master'
Resolve "tensor_COOの実装漏れ関数の実装" Closes #753 See merge request ricos/monolish!514
2 parents 82f520a + bb6ea0e commit 9045ff0

File tree

91 files changed

+11573
-718
lines changed

Some content is hidden

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

91 files changed

+11573
-718
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Unreleased
5353
- Add view1D of tensor_Dense <https://gitlab.ritc.jp/ricos/monolish/-/merge_requests/496> <https://github.com/ricosjp/monolish/issues/728>
5454
- Add times/adds/axpy tests for view1D of matrix/tensor <https://gitlab.ritc.jp/ricos/monolish/-/merge_requests/498> <https://github.com/ricosjp/monolish/issues/729>
5555
- Add variadic templates for reshape tensor <https://gitlab.ritc.jp/ricos/monolish/-/merge_requests/499> <https://github.com/ricosjp/monolish/issues/730>
56+
- Add tensor_CRS <https://gitlab.ritc.jp/ricos/monolish/-/merge_requests/514> <https://github.com/ricosjp/monolish/issues/753>
5657

5758
### Changed
5859
- Start developing 0.17.1 <https://gitlab.ritc.jp/ricos/monolish/-/merge_requests/487>

include/monolish/blas/gen_matvec_blas.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,32 @@ for prec in double float; do
398398
done
399399
echo "/**@}*/"
400400

401+
echo "
402+
/**
403+
* \defgroup matvec_dense monolish::blas::matvec (Dense)
404+
* @brief Dense matrix and vector multiplication: y = aAx + by
405+
* @{
406+
*/
407+
/**
408+
* @brief Dense matrix and vector multiplication: y = aAx + by
409+
* @param A Dense matrix (size M x N)
410+
* @param x monolish vector (size M)
411+
* @param y monolish vector (size M)
412+
* @note
413+
* - # of computation: MN
414+
* - Multi-threading: true
415+
* - GPU acceleration: true
416+
* - # of data transfer: 0
417+
*/ "
418+
for prec in double float; do
419+
for arg1 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
420+
for arg2 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
421+
echo "void matvec(const $prec &a, const matrix::Dense<$prec> &A, const $arg1 &x, const $prec &b, $arg2 &y);"
422+
done
423+
done
424+
done
425+
echo "/**@}*/"
426+
401427
## matvec_* Dense
402428
for trans in N T; do
403429
echo "
@@ -427,6 +453,34 @@ for trans in N T; do
427453
echo "/**@}*/"
428454
done
429455

456+
for trans in N T; do
457+
echo "
458+
/**
459+
* \defgroup matvec_dense_$trans monolish::blas::matvec_$trans (Dense)
460+
* @brief Dense matrix and vector multiplication: y = aA^$trans x + by
461+
* @{
462+
*/
463+
/**
464+
* @brief Dense matrix and vector multiplication: y = aA^$trans x + by
465+
* @param A Dense matrix (size M x N)
466+
* @param x monolish vector (size M)
467+
* @param y monolish vector (size M)
468+
* @note
469+
* - # of computation: MN
470+
* - Multi-threading: true
471+
* - GPU acceleration: true
472+
* - # of data transfer: 0
473+
*/ "
474+
for prec in double float; do
475+
for arg1 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
476+
for arg2 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
477+
echo "void matvec_$trans(const $prec &a, const matrix::Dense<$prec> &A, const $arg1 &x, const $prec &b, $arg2 &y);"
478+
done
479+
done
480+
done
481+
echo "/**@}*/"
482+
done
483+
430484
## matvec CRS
431485
echo "
432486
/**
@@ -454,6 +508,32 @@ for prec in double float; do
454508
done
455509
echo "/**@}*/"
456510

511+
echo "
512+
/**
513+
* \defgroup matvec_crs monolish::blas::matvec (CRS)
514+
* @brief CRS format sparse matrix and vector multiplication: y = aAx + by
515+
* @{
516+
*/
517+
/**
518+
* @brief CRS format sparse matrix and vector multiplication: y = aAx + by
519+
* @param A CRS matrix (size M x N)
520+
* @param x monolish vector (size M)
521+
* @param y monolish vector (size M)
522+
* @note
523+
* - # of computation: 2nnz
524+
* - Multi-threading: true
525+
* - GPU acceleration: true
526+
* - # of data transfer: 0
527+
*/ "
528+
for prec in double float; do
529+
for arg1 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
530+
for arg2 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
531+
echo "void matvec(const $prec &a, const matrix::CRS<$prec> &A, const $arg1 &x, const $prec &b, $arg2 &y);"
532+
done
533+
done
534+
done
535+
echo "/**@}*/"
536+
457537
## matvec_* CRS
458538
for trans in N T; do
459539
echo "
@@ -483,6 +563,34 @@ for trans in N T; do
483563
echo "/**@}*/"
484564
done
485565

566+
for trans in N T; do
567+
echo "
568+
/**
569+
* \defgroup matvec_crs_$trans monolish::blas::matvec_$trans (CRS)
570+
* @brief CRS format sparse matrix and vector multiplication: y = aA^$trans x + by
571+
* @{
572+
*/
573+
/**
574+
* @brief CRS format sparse matrix and vector multiplication: y = aA^$trans x + by
575+
* @param A CRS matrix (size M x N)
576+
* @param x monolish vector (size M)
577+
* @param y monolish vector (size M)
578+
* @note
579+
* - # of computation: 2nnz
580+
* - Multi-threading: true
581+
* - GPU acceleration: true
582+
* - # of data transfer: 0
583+
*/ "
584+
for prec in double float; do
585+
for arg1 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
586+
for arg2 in vector\<$prec\> view1D\<vector\<$prec\>,$prec\> view1D\<matrix::Dense\<$prec\>,$prec\> view1D\<tensor::tensor_Dense\<$prec\>,$prec\>; do
587+
echo "void matvec_$trans(const $prec &a, const matrix::CRS<$prec> &A, const $arg1 &x, const $prec &b, $arg2 &y);"
588+
done
589+
done
590+
done
591+
echo "/**@}*/"
592+
done
593+
486594

487595
## matvec LinearOperator
488596
echo "

include/monolish/blas/gen_tensmat_blas.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,64 @@ for prec in double float; do
7676
done
7777
echo "/**@}*/"
7878

79+
80+
## tensmat tensor_CRS
81+
echo "
82+
/**
83+
* \defgroup tensmat_dense monolish::blas::tensmat (tensor_CRS)
84+
* @brief tensor_CRS tensor and matrix multiplication: y = Ax
85+
* @{
86+
*/
87+
/**
88+
* @brief tensor_CRS tensor and matrix multiplication: ex. y_{ijl} = A_{ijk} x_{kl}
89+
* @param A tensor_CRS tensor
90+
* @param x Dense matrix
91+
* @param y tensor_Dense tensor
92+
* @note
93+
* - # of computation: ?
94+
* - Multi-threading: true
95+
* - GPU acceleration: true
96+
* - # of data transfer: 0
97+
*/ "
98+
for prec in double float; do
99+
for arg1 in tensor::tensor_CRS\<$prec\>; do
100+
for arg2 in matrix::Dense\<$prec\> view_Dense\<vector\<$prec\>,$prec\> view_Dense\<matrix::Dense\<$prec\>,$prec\> view_Dense\<tensor::tensor_Dense\<$prec\>,$prec\>; do
101+
for arg3 in tensor::tensor_Dense\<$prec\> view_tensor_Dense\<vector\<$prec\>,$prec\> view_tensor_Dense\<matrix::Dense\<$prec\>,$prec\> view_tensor_Dense\<tensor::tensor_Dense\<$prec\>,$prec\>; do
102+
echo "void tensmat(const $arg1 &A, const $arg2 &x, $arg3 &y);"
103+
done
104+
done
105+
done
106+
done
107+
echo "/**@}*/"
108+
109+
echo "
110+
/**
111+
* \defgroup tensmat_dense monolish::blas::tensmat (tensor_CRS)
112+
* @brief tensor_CRS tensor and matrix multiplication: ex. y_{ijl} = a A_{ijk} x_{kl} + b y_{ijl}
113+
* @{
114+
*/
115+
/**
116+
* @brief tensor_CRS tensor and vector multiplication: y = Ax
117+
* @param A tensor_CRS tensor
118+
* @param x Dense matrix
119+
* @param y tensor_Dense tensor
120+
* @note
121+
* - # of computation: ?
122+
* - Multi-threading: true
123+
* - GPU acceleration: true
124+
* - # of data transfer: 0
125+
*/ "
126+
for prec in double float; do
127+
for arg1 in tensor::tensor_CRS\<$prec\>; do
128+
for arg2 in matrix::Dense\<$prec\> view_Dense\<vector\<$prec\>,$prec\> view_Dense\<matrix::Dense\<$prec\>,$prec\> view_Dense\<tensor::tensor_Dense\<$prec\>,$prec\>; do
129+
for arg3 in tensor::tensor_Dense\<$prec\> view_tensor_Dense\<vector\<$prec\>,$prec\> view_tensor_Dense\<matrix::Dense\<$prec\>,$prec\> view_tensor_Dense\<tensor::tensor_Dense\<$prec\>,$prec\>; do
130+
echo "void tensmat(const $prec &a, const $arg1 &A, const $arg2 &x, const $prec &b, $arg3 &y);"
131+
done
132+
done
133+
done
134+
done
135+
echo "/**@}*/"
136+
79137
echo "/**@}*/"
80138
echo "/**@}*/"
81139
echo "}"

0 commit comments

Comments
 (0)