## user defined preconditioner

3 posts
• Page

**1**of**1**### user defined preconditioner

Hi,

We are going to purchase CULA Sparse, but before that, I would like to know

1. Is it possible to pass a "user defined preconditioner" to to the solver, instead of standard precoditioner that are available in the package? In our case, we can calculate a good preconditioner which can be a good approximation of the inverse of the coefficient and give it to the solver.

2. In our case, we solve several equations in several steps, but the imaginary part of the coefficient matrix is only on the diagonal and thus has a very low influence on the solution. On the other hand, the real part is unchanged in all iterations. Using CULA Sparse, would it be possible to calculate the preconditioner only once and reuse it each time the solver is invokes? This is a useful option in PETSc.

Thanks,

Dan

We are going to purchase CULA Sparse, but before that, I would like to know

1. Is it possible to pass a "user defined preconditioner" to to the solver, instead of standard precoditioner that are available in the package? In our case, we can calculate a good preconditioner which can be a good approximation of the inverse of the coefficient and give it to the solver.

2. In our case, we solve several equations in several steps, but the imaginary part of the coefficient matrix is only on the diagonal and thus has a very low influence on the solution. On the other hand, the real part is unchanged in all iterations. Using CULA Sparse, would it be possible to calculate the preconditioner only once and reuse it each time the solver is invokes? This is a useful option in PETSc.

Thanks,

Dan

- dandan
**Posts:**16**Joined:**Sat Feb 26, 2011 7:30 am

### Re: user defined preconditioner

These are good questions.

For #1, we presently do not expose this capability. The hybrid nature of our solvers makes creating a usable public interface tricky. For instance, some of our internal preconditioners perform their work using both the CPU and GPU. My follow-up would be phrased as two questions:

1) Would a generic sparse approximate inverse preconditioner solve your problems?

2) Do any of the other preconditioners that we presently provide converge your problems in competitive timeframes to your existing approximate inverse?

If the answer to those is no, then we can explore alternatives with you.

We have found the need to re-evaluate all solvers, options, preconditioners, data formats, etc as we have progressed from CPU code to GPU code due. I'm hoping that even though we don't have support for your preconditioner (yet) that we can at least offer you a competitive alternative for the time being.

For question #2, we have not considered this option but will do so. I can see a clear speedup available for this problem in terms of MVM throughput.

I would like to add as well that we have a public demo program available on the sparse downloads page which can run all of our current solvers, preconditioners, and options on Matrix Market formatted matrices.

If you have any matrix data and would like to provide it and the appropriate runtime parameters for our testing and development, it would help to steer future releases.

For #1, we presently do not expose this capability. The hybrid nature of our solvers makes creating a usable public interface tricky. For instance, some of our internal preconditioners perform their work using both the CPU and GPU. My follow-up would be phrased as two questions:

1) Would a generic sparse approximate inverse preconditioner solve your problems?

2) Do any of the other preconditioners that we presently provide converge your problems in competitive timeframes to your existing approximate inverse?

If the answer to those is no, then we can explore alternatives with you.

We have found the need to re-evaluate all solvers, options, preconditioners, data formats, etc as we have progressed from CPU code to GPU code due. I'm hoping that even though we don't have support for your preconditioner (yet) that we can at least offer you a competitive alternative for the time being.

For question #2, we have not considered this option but will do so. I can see a clear speedup available for this problem in terms of MVM throughput.

I would like to add as well that we have a public demo program available on the sparse downloads page which can run all of our current solvers, preconditioners, and options on Matrix Market formatted matrices.

If you have any matrix data and would like to provide it and the appropriate runtime parameters for our testing and development, it would help to steer future releases.

- john
- Administrator
**Posts:**587**Joined:**Thu Jul 23, 2009 2:31 pm

### Re: user defined preconditioner

I think making it possible to use user-defined preconditioner is very important. For my case, none of your preconditioners are useful, because:

1. I have a sparse coefficient matrix (complex double) but imaginary values are only on diagonal.

Therefore, the real part of the matrix has the most weight and hence will dominate. In this case, it would be enough if I approximate the inverse of "only" real part of the matrix.

2. I solve the equation "ax=b" in several iterations. In all iterations, only the imaginary part of the matrix which has very little wight will change and the rest will left unchanged.

According to (1) and (2), the best solution for me:

I. Approximate the inverse of the real part of the coefficient matrix (SAI or ILU, I prefer SAI) and then simply multiply it to both sides instead of solve equation in order to apply the preconditioner. This multiplication is not costly since I have written routines for "sparse" matrix multiplication which has considerably lower time complexity than O(n^3).

II. Solver the equation using GMRES or BiCG.

III. In next iteration, keep the previous coefficient matrix and apply preconditioner "only and only" on imaginary part which has recently changed. This will be multiplication between a sparse matrix and a diagonal matrix which is very cheap.

IV. Again, solve the equation iteratively, etc.

I have implemented this approach in MATLAB from an "almost" singular matrix, I get a very very well-conditioned matrix where the equation can be solved within few iterations.

Therefore, it would be great if CULA Sparse could provide the possibility to just calculate the preconditioner and return it to user for further manipulations or at least let the user create own preconditioner, no matter CULA Sparse will be asked to apply it or the user will apply it himself/herself.

Regards,

Dan

1. I have a sparse coefficient matrix (complex double) but imaginary values are only on diagonal.

Therefore, the real part of the matrix has the most weight and hence will dominate. In this case, it would be enough if I approximate the inverse of "only" real part of the matrix.

2. I solve the equation "ax=b" in several iterations. In all iterations, only the imaginary part of the matrix which has very little wight will change and the rest will left unchanged.

According to (1) and (2), the best solution for me:

I. Approximate the inverse of the real part of the coefficient matrix (SAI or ILU, I prefer SAI) and then simply multiply it to both sides instead of solve equation in order to apply the preconditioner. This multiplication is not costly since I have written routines for "sparse" matrix multiplication which has considerably lower time complexity than O(n^3).

II. Solver the equation using GMRES or BiCG.

III. In next iteration, keep the previous coefficient matrix and apply preconditioner "only and only" on imaginary part which has recently changed. This will be multiplication between a sparse matrix and a diagonal matrix which is very cheap.

IV. Again, solve the equation iteratively, etc.

I have implemented this approach in MATLAB from an "almost" singular matrix, I get a very very well-conditioned matrix where the equation can be solved within few iterations.

Therefore, it would be great if CULA Sparse could provide the possibility to just calculate the preconditioner and return it to user for further manipulations or at least let the user create own preconditioner, no matter CULA Sparse will be asked to apply it or the user will apply it himself/herself.

Regards,

Dan

- dandan
**Posts:**16**Joined:**Sat Feb 26, 2011 7:30 am

3 posts
• Page

**1**of**1**### Who is online

Users browsing this forum: No registered users and 1 guest