Why is Magma skipping calculation when using SELL-P format?

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
avgn
Posts: 7
Joined: Sun Jul 29, 2018 10:03 pm

Why is Magma skipping calculation when using SELL-P format?

Post by avgn » Mon Jul 30, 2018 12:55 pm

Please note that I am cross-posting this question from stackoverflow: https://stackoverflow.com/questions/515 ... l-p-format:

I have written a code to compute the product of a sparse matrix and dense matrix using Magma, which works fine in the CSR format:

magma_d_matrix hA={Magma_CSR},hA_sellp={Magma_CSR}; //host matrices
magma_d_matrix A={Magma_CSR},A_sellp={Magma_CSR}; //device matrices

//initialize CSR matrix on host and transfer it to device memory
hA.num_rows = myrows;
hA.num_cols = mycols;
hA.storage_type = Magma_CSR;
hA.memory_location = Magma_CPU;
hA.val = myvalptr;
hA.col = mycolptr;
hA.row = myrowptr;
hA.nnz = nnz;
magma_dmtransfer(hA, &A, Magma_CPU, Magma_DEV, queue );

//G and res are both dense magma_d_matrix on device memory
magma_d_spmv(1.0,A,G,0.0,res,queue);
//this returns the correct answer i.e. res=A*G;

But, when I try converting the matrix to SELL-P (as done here: viewtopic.php?f=2&t=1506&p=4263&hilit=SELLP#p4263 and in the example magma-2.2.0/sparse/testing/testing_dspmm) and repeat the same thing, it fails:

//convert CSR to SELLP
hgg_sellp.blocksize = 64;
hgg_sellp.alignment = 1;
magma_dmconvert( hA, &hA_sellp, Magma_CSR, Magma_SELLP, queue );
magma_dmtransfer( hA_sellp, &A_sellp, Magma_CPU, Magma_DEV, queue );

//the following returns the wrong answer. res is left unchanged.
magma_d_spmv(1.0,A_sellp,G,0.0,res,queue);

What am I doing wrong?

I also have a couple of less important questions:

1. Do the CSR, BSR, and SELL-P spmv routines use the diameter and max_nnz_row parameters? What are these parameters for?
How do I figure out what is a good blockSize and allignment for my problem when using the SELL-P format?

2. What other parameters should I tune to get maximum performance? How do I figure out what is a good blockSize and alignment for my problem when using the SELL-P format?

Thanks for your time and for developing this very useful software!

hartwig anzt
Posts: 90
Joined: Tue Sep 02, 2014 5:44 pm

Re: Why is Magma skipping calculation when using SELL-P form

Post by hartwig anzt » Tue Jul 31, 2018 1:19 pm

Dear Mohammed,

would you mind sharing the complete code along with the test matrices? Or is this difficult?

@hanzt@icl.utk.edu

Thanks, Hartwig

avgn
Posts: 7
Joined: Sun Jul 29, 2018 10:03 pm

Re: Why is Magma skipping calculation when using SELL-P form

Post by avgn » Tue Jul 31, 2018 11:16 pm

Thanks so much. Will do.

avgn
Posts: 7
Joined: Sun Jul 29, 2018 10:03 pm

Re: Why is Magma skipping calculation when using SELL-P form

Post by avgn » Sun Aug 05, 2018 4:47 pm

Thanks for taking the time to look into why the SELL-P format calculation is being skipped for me. I sincerely appreciate it. I am wondering if you have received my email last week? Thanks again for your time!

Post Reply