How to use magma_*customspmv in the program?

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)

How to use magma_*customspmv in the program?

Postby mikemike10212003 » Tue Nov 07, 2017 2:47 am

Dear all,
magma_*customspmv give me to use a custom function to calculate spmv.
Do I need to edit the file "magma_*customspmv.cpp" to implement the function and recompile magma library?
Is there any more convenient method to achieve it?
Can I use two different custom spmv methods in one program?

Thanks,
Mike
mikemike10212003
 
Posts: 9
Joined: Mon Oct 10, 2016 4:47 am

Re: How to use magma_*customspmv in the program?

Postby hartwig anzt » Tue Nov 07, 2017 3:22 am

Dear Mike,
magma_*customspmv.cpp currently does nothing. The idea is that there you call your function.
Assume you have you awesome spmv library. Then, you add in this file:

#include awesome_spmv.h
...
awesome_spmv( alpha, A x, beta, b, );

Does this make sense?
Thanks, Hartwig
hartwig anzt
 
Posts: 79
Joined: Tue Sep 02, 2014 5:44 pm

Re: How to use magma_*customspmv in the program?

Postby mikemike10212003 » Tue Nov 07, 2017 5:21 am

Dear Hartwig,

Sorry about the unclear declaration.
The wrapper of BLAS will use the magma_*customspmv when the storage_type is Magma_SPMVFUNCTION.
I also want to use the CG solver of MAGMA on the custom spmv function.
Thus, I think I can not just build a new function.

Thanks,
Mike
mikemike10212003
 
Posts: 9
Joined: Mon Oct 10, 2016 4:47 am

Re: How to use magma_*customspmv in the program?

Postby hartwig anzt » Tue Nov 07, 2017 5:41 am

Mike,
I am not sure I understand correctly. You can use any SpMV inside the CG solver, the solver does not imply any restrictions on the matrix storage format or SpMV kernel.
Please specify.
Thanks!
hartwig anzt
 
Posts: 79
Joined: Tue Sep 02, 2014 5:44 pm

Re: How to use magma_*customspmv in the program?

Postby mikemike10212003 » Tue Nov 07, 2017 7:52 am

Dear Hartwig,
According to your first reply, I need to add awesome_spmv into magma_*customspmv.cpp.
And set magma_*_matrix type as the Magma_SPMVFUNCTION.
And I can use some routine like CG as I did before.
By doing so, I can not use two different spmv methods at the same time.
Is that correct?

Thanks,
Mike
mikemike10212003
 
Posts: 9
Joined: Mon Oct 10, 2016 4:47 am

Re: How to use magma_*customspmv in the program?

Postby hartwig anzt » Sun Nov 12, 2017 11:15 am

Mike,
sorry for late reply!
I think I do know what you mean now: you have two spmv kernels: spmv1 and spmv2, and you want to use them inside CG, time it, quickly switch between them. This would require recompiling magma-sparse.
So, yes, unfortunately it is currently not possible to use multiple SpMV at a time.
The only workaround I currently see is to define a second CUSTOMSPMV, but you would then have to introduce this into the magma_z_blaswrapper.cpp.
I will make sure we provide this possibility in future!
Thanks, Hartwig
hartwig anzt
 
Posts: 79
Joined: Tue Sep 02, 2014 5:44 pm

Re: How to use magma_*customspmv in the program?

Postby mikemike10212003 » Sun Nov 12, 2017 1:56 pm

Dear Hartwig,
Thanks a lot!
Mike
mikemike10212003
 
Posts: 9
Joined: Mon Oct 10, 2016 4:47 am


Return to User discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron