Page 1 of 1
Matrix Vector multiplication
Posted: Fri Jun 29, 2018 3:05 pm
by Volodimir
Hello,
I am new to MAGMA, have a couple of questions regarding availability of functions:
1. in CUDA there is a
function allowing to perform element-wise matrix-matrix multiplication
2. Likewise, there is a function
allowing to extract subarray from array.
Question - how I can implement these using MAGMA?
Thanks,
Volodimir
Re: Matrix Vector multiplication
Posted: Fri Jun 29, 2018 3:29 pm
by mgates3
1) MAGMA doesn't have an element-wise multiply. However, you can still call the cublas function while using MAGMA.
2) MAGMA has:
magma_*setmatrix
magma_*getmatrix
magma_*setmatrix_async
magma_*getmatrix_async
where * is one of s, d, c, z, or i for single, double, single-complex, double-complex, or integer, respectively. See
http://icl.cs.utk.edu/projectsfiles/mag ... _comm.html
for all communication-related routines.
Unlike cublasGetMatrix, the MAGMA routines do not require passing sizeof the elements.
-mark
Re: Matrix Vector multiplication
Posted: Fri Jun 29, 2018 3:53 pm
by Volodimir
Mark,
thanks for your feedback.
I am having difficulties in calling cublas functions while using MAGMA, as I am using complex arrays, and there is no straightforward conversion between MAGMA complex types magmaFloatComplex (or magmaDoubleComplex) and cuComplex (or cuDoubleComplex) in CUDA. Or did I miss something?
Thanks,
Volodimir
Re: Matrix Vector multiplication
Posted: Fri Jun 29, 2018 4:19 pm
by mgates3
magmaFloatComplex is a typedef of cuFloatComplex. It shouldn't need a conversion. See include/magma_types.h:
Code: Select all
typedef cuDoubleComplex magmaDoubleComplex;
typedef cuFloatComplex magmaFloatComplex;
Nonetheless, if you need a conversion, just do a cast using a pointer. E.g., to convert between std::complex and magmaComplex:
Code: Select all
std::complex<float> alpha;
std::complex<float> *A;
magmaFloatComplex alpha2 = *((magmaFloatComplex*) &alpha);
magmaFloatComplex *A2 = (magmaFloatComplex*) A;
-mark