Boost logo

Boost :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2002-04-10 07:11:42


On Wednesday 10 April 2002 08:51, you wrote:
> P.S.: To give an impression, how the test integration works, I'll include a
> sample implementation and a cutout of the modified CLAPACK's blaswrap.h.

and I suppose gmm is implemented using ublas routines. So this also compares
the speed of ublas with BLAS (I'v always been thinking in the other
direction, that you made binding for BLAS to be able to call BLAS using ublas
matrices)

BTW, the matrix_adaptor type here is, I suppose, a template-type ?

>
> --- DGEMM
> int ublas_dgemm (char *ta, char *tb, integer *m, integer *n, integer
> *k, doublereal *alpha, doublereal *a, integer *lda, doublereal *b, integer
> *ldb,
> doublereal *beta, doublereal *c, integer *ldc) {
> ublas_assert (to_lower (*ta) == 'n' || to_lower (*ta) == 't' || to_lower
> (*ta) == 'c', "DGEMM ", 1);
> ublas_assert (to_lower (*tb) == 'n' || to_lower (*tb) == 't' || to_lower
> (*tb) == 'c', "DGEMM ", 2);
> ublas_assert (*m >= 0, "DGEMM ", 3);
> ublas_assert (*n >= 0, "DGEMM ", 4);
> ublas_assert (*k >= 0, "DGEMM ", 5);
> ublas_assert (*lda >= std::max (1, to_lower (*ta) == 'n' ? *m : *k),
> "DGEMM ", 8);
> ublas_assert (*ldb >= std::max (1, to_lower (*tb) == 'n' ? *k : *n),
> "DGEMM ", 10);
> ublas_assert (*ldc >= std::max (1, *m), "DGEMM ", 13);
> matrix_adaptor<doublereal> mac (*m, *n, c, *ldc);
> if (to_lower (*ta) == 'n') {
> matrix_adaptor<doublereal> maa (*m, *k, a, *lda);
> if (to_lower (*tb) == 'n') {
> matrix_adaptor<doublereal> mab (*k, *n, b, *ldb);
> gmm (to_lower (*ta), to_lower (*tb), mac (), *beta, *alpha, maa (), mab
> ());
> } else {
> matrix_adaptor<doublereal> mab (*n, *k, b, *ldb);
> gmm (to_lower (*ta), to_lower (*tb), mac (), *beta, *alpha, maa (), mab
> ());
> }
> } else {
> matrix_adaptor<doublereal> maa (*k, *m, a, *lda);
> if (to_lower (*tb) == 'n') {
> matrix_adaptor<doublereal> mab (*k, *n, b, *ldb);
> gmm (to_lower (*ta), to_lower (*tb), mac (), *beta, *alpha, maa (), mab
> ());
> } else {
> matrix_adaptor<doublereal> mab (*n, *k, b, *ldb);
> gmm (to_lower (*ta), to_lower (*tb), mac (), *beta, *alpha, maa (), mab
> ());
> }
> }
> return 0;
> }
> ---
>
> --- blaswrap.h
> /* BLAS1 routines */
> #define srotg_ srotg_
> #define drotg_ drotg_
> #define srotmg_ srotmg_
> #define drotmg_ drotmg_
> #define srot_ srot_
> #define drot_ drot_
> #define srotm_ srotm_
> #define drotm_ drotm_
> #define sswap_ ublas_sswap
> #define dswap_ ublas_dswap
> #define cswap_ ublas_cswap
> #define zswap_ ublas_zswap
> #define sscal_ ublas_sscal
> #define dscal_ ublas_dscal
> #define cscal_ ublas_cscal
> #define zscal_ ublas_zscal
> #define csscal_ csscal_
> #define zdscal_ zdscal_
> #define scopy_ ublas_scopy
> #define dcopy_ ublas_dcopy
> #define ccopy_ ublas_ccopy
> #define zcopy_ ublas_zcopy
> #define saxpy_ ublas_saxpy
> #define daxpy_ ublas_daxpy
> #define caxpy_ ublas_caxpy
> #define zaxpy_ ublas_zaxpy
> #define sdot_ ublas_sdot
> #define ddot_ ublas_ddot
> #define cdotu_ ublas_cdotu
> #define zdotu_ ublas_zdotu
> #define cdotc_ ublas_cdotc
> #define zdotc_ ublas_zdotc
> #define snrm2_ ublas_snrm2
> #define dnrm2_ ublas_dnrm2
> #define scnrm2_ ublas_scnrm2
> #define dznrm2_ ublas_dznrm2
> #define sasum_ ublas_sasum
> #define dasum_ ublas_dasum
> #define scasum_ ublas_scasum
> #define dzasum_ ublas_dzasum
> #define isamax_ isamax_
> #define idamax_ idamax_
> #define icamax_ icamax_
> #define izamax_ izamax_
>
> /* BLAS2 routines */
> #define sgemv_ ublas_sgemv
> #define dgemv_ ublas_dgemv
> #define cgemv_ ublas_cgemv
> #define zgemv_ ublas_zgemv
> #define sgbmv_ ublas_sgbmv
> #define dgbmv_ ublas_dgbmv
> #define cgbmv_ ublas_cgbmv
> #define zgbmv_ ublas_zgbmv
> #define chemv_ ublas_chemv
> #define zhemv_ ublas_zhemv
> #define chbmv_ chbmv_
> #define zhbmv_ zhbmv_
> #define chpmv_ ublas_chpmv
> #define zhpmv_ ublas_zhpmv
> #define ssymv_ ublas_ssymv
> #define dsymv_ ublas_dsymv
> #define ssbmv_ ssbmv_
> #define dsbmv_ dsbmv_
> #define sspmv_ ublas_sspmv
> #define dspmv_ ublas_dspmv
> #define strmv_ ublas_strmv
> #define dtrmv_ ublas_dtrmv
> #define ctrmv_ ublas_ctrmv
> #define ztrmv_ ublas_ztrmv
> #define stbmv_ stbmv_
> #define dtbmv_ dtbmv_
> #define ctbmv_ ctbmv_
> #define ztbmv_ ztbmv_
> #define stpmv_ ublas_stpmv
> #define dtpmv_ ublas_dtpmv
> #define ctpmv_ ublas_ctpmv
> #define ztpmv_ ublas_ztpmv
> #define strsv_ ublas_strsv
> #define dtrsv_ ublas_dtrsv
> #define ctrsv_ ublas_ctrsv
> #define ztrsv_ ublas_ztrsv
> #define stbsv_ stbsv_
> #define dtbsv_ dtbsv_
> #define ctbsv_ ctbsv_
> #define ztbsv_ ztbsv_
> #define stpsv_ ublas_stpsv
> #define dtpsv_ ublas_dtpsv
> #define ctpsv_ ublas_ctpsv
> #define ztpsv_ ublas_ztpsv
> #define sger_ ublas_sger
> #define dger_ ublas_dger
> #define cgeru_ ublas_cgeru
> #define zgeru_ ublas_zgeru
> #define cgerc_ ublas_cgerc
> #define zgerc_ ublas_zgerc
> #define cher_ ublas_cher
> #define zher_ ublas_zher
> #define chpr_ ublas_chpr
> #define zhpr_ ublas_zhpr
> #define cher2_ ublas_cher2
> #define zher2_ ublas_zher2
> #define chpr2_ ublas_chpr2
> #define zhpr2_ ublas_zhpr2
> #define ssyr_ ublas_ssyr
> #define dsyr_ ublas_dsyr
> #define sspr_ ublas_sspr
> #define dspr_ ublas_dspr
> #define ssyr2_ ublas_ssyr2
> #define dsyr2_ ublas_dsyr2
> #define sspr2_ ublas_sspr2
> #define dspr2_ ublas_dspr2
>
> /* BLAS3 routines */
> #define sgemm_ ublas_sgemm
> #define dgemm_ ublas_dgemm
> #define cgemm_ ublas_cgemm
> #define zgemm_ ublas_zgemm
> #define ssymm_ ublas_ssymm
> #define dsymm_ ublas_dsymm
> #define csymm_ ublas_csymm
> #define zsymm_ ublas_zsymm
> #define chemm_ ublas_chemm
> #define zhemm_ ublas_zhemm
> #define ssyrk_ ublas_ssyrk
> #define dsyrk_ ublas_dsyrk
> #define csyrk_ ublas_csyrk
> #define zsyrk_ ublas_zsyrk
> #define cherk_ ublas_cherk
> #define zherk_ ublas_zherk
> #define ssyr2k_ ublas_ssyr2k
> #define dsyr2k_ ublas_dsyr2k
> #define csyr2k_ ublas_csyr2k
> #define zsyr2k_ ublas_zsyr2k
> #define cher2k_ ublas_cher2k
> #define zher2k_ ublas_zher2k
> #define strmm_ ublas_strmm
> #define dtrmm_ ublas_dtrmm
> #define ctrmm_ ublas_ctrmm
> #define ztrmm_ ublas_ztrmm
> #define strsm_ ublas_strsm
> #define dtrsm_ ublas_dtrsm
> #define ctrsm_ ublas_ctrsm
> #define ztrsm_ ublas_ztrsm
> ---
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk