Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
-
Volodimir
- Posts: 10
- Joined: Fri Jun 29, 2018 2:52 pm
Post
by Volodimir » Fri Jun 29, 2018 3:05 pm
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
-
mgates3
- Posts: 918
- Joined: Fri Jan 06, 2012 2:13 pm
Post
by mgates3 » Fri Jun 29, 2018 3:29 pm
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
-
Volodimir
- Posts: 10
- Joined: Fri Jun 29, 2018 2:52 pm
Post
by Volodimir » Fri Jun 29, 2018 3:53 pm
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
-
mgates3
- Posts: 918
- Joined: Fri Jan 06, 2012 2:13 pm
Post
by mgates3 » Fri Jun 29, 2018 4:19 pm
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