viennacl / viennacl-dev

Developer repository for ViennaCL. Visit http://viennacl.sourceforge.net/ for the latest releases.
Other
281 stars 89 forks source link

Question about compute SPAI #281

Open RENJIEYM opened 5 years ago

RENJIEYM commented 5 years ago

Hello developer, i use viennacl to compute SAPI and i have some problems , the fllowing are steps:

  1. read a matrix from matrix market including real general and real symmetric matrix. Question1:can i use my own method to read the matrix into CSR( rowPtr, colIndex, val),then use vcl_matrix.set() to fill the viennacl compressed matrix.if not allowed,how should i do, or use the viennacl::io:::read_matrix_market_file?

  2. use the viennacl_compressed matrix to compute SPAI. Question1: when i use viennacl::linalg::spai_precond, what kind of method i uesd, static or dynamic, or i set the is_static in spai_tag as true to denote the method is static, if i don't set it, the default is dynamic. Question2: if i want see the result of preconditioner , how should i do?can i use the CSR to denote the preconditioner including rowPtr, colIndex, val.

  3. use solver to solve equation including iteration time.

karlrupp commented 4 years ago

Hello,

  1. yes, you can just read the CSR file yourself and then use .set(). Or, more conveniently, just use viennacl::io:::read_matrix_market_file()

  2. If I remember correctly, the default is a static SPAI (i.e. the pattern of the SPAI matrix is the same as the system matrix) which can fully benefit from GPU acceleration. The dynamic version requires more work to be done on the CPU. It depends on your system which variant is faster. In order to view the SPAI matrix, you would have to modify the code. Make the private matrix spaim in struct spai_precond public and then print it like other compressed matrices, cf. https://github.com/viennacl/viennacl-dev/blob/master/viennacl/linalg/spai.hpp#L115

  3. Have a look at https://github.com/viennacl/viennacl-dev/blob/master/examples/tutorial/spai.cpp for a SPAI example.