-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShyLU and Ifpack2 : Add FastILU and TriSolve to Trilinos #197
Comments
@brian-kelley AdditiveSchwarz has a parameter which is a sublist, which it passes directly to the subdomain solver. AdditiveSchwarz should not take any subdomain solver parameters directly; they should all go into the sublist. |
@brian-kelley : All three are useful preconditioner optiions. To your question on #1476 , please feel free to change the template parameters to to be consistent with other Ifpack2 preconditioners. |
@srajama1 Shouldn't FastLDL be renamed FastILDL for consistency? |
@egboman I can do that. The class is called LDL even though the shylu files are "shylu_fastildl", so I'll change the class name. |
Thanks, @brian-kelley It is a small thing but a bit annoying. |
@brian-kelley Do the omega and shift need to be general? In other solvers, I've found such generality often isn't required. If this is the case here, then you can just hard code it to |
@jhux2 Ah, I just saw that the existing fast * tests do read them from argv as double, so really the parameters shouldn't be Scalar at all. |
@brian-kelley wrote:
It depends on whether they could ever be complex valued. If so, then best practice would be to test first Scalar, then
|
@brian-kelley : I need to think a little bit about this. You can hard code it to double for making progress, but note that we want to do Block version of FastILU soon, which might require block version (or we could use the same shift for an entire block). This needs some thinking. BTW, I am not getting all updates from github. For example, I didn't get your update but got Jonathan's update. |
@srajama1 : I think a global shift by shift*identity should be the default behavior, but doing some kind kind of block matrix shift might be useful, too. |
@srajama1 If we need a shift vector instead of just a scalar, we could have another parameter of type "Array(double)" - that's a common pattern in param lists. Above I was concerned about was dealing with many different possible Scalar types, but for now I will just expect double. |
@brian-kelley : Let us go with shift as double. We don't have strong use case for variable shifting within blocks. I am not able to find anything in the literature about its usefulness too. Let us just keep it as double for now. |
@srajama1 Does "nTriSol" mean "number of triangular solves"? I would like a more verbose name to use as the Ifpack2 parameter name. I used "sweeps" for "nFact", to be consistent with other Ifpack2 classes. |
@jhux2 What would a sensible default shift parameter be? The proceedings paper example shows values in the range 0 to about 0.2, and says that a higher value can help convergence issues, but also somewhat increases the number of CG iterations. I was thinking of just using 0.2. |
@srajama1 @egboman Can either of you two advise @brian-kelley on the values for the defaults? |
Is the shift absolute or relative? In the latter case, it would automatically be scaled according to the diagonal entries but I guess both approaches are valid. |
The default should be zero. The user needs to turn this on explicitly. |
I see the shift is relative in the source, so no need for vector valued shifts. |
@brian-kelley : The sweeps here are slightly different in their behavior than the traditional sense, but I am fine with calling it the sweeps. nTriSol is number of iteration in triangular solve. |
@srajama1 @jhux2 I have everything set up in Ifpack2 except I can't get cmake to give me a "HAVE_IFPACK2_FASTILU" define. I have "ShyLUFastILU" as an optional dependency in ifpack2/cmake/Dependencies, and I added this to ifpack2/CMakesLists.txt:
which I think should define "HAVE_IFPACK2_FASTILU" whenever I configure with FastILU enabled. There's no configure error, I just don't get the define. |
@brian-kelley : I sent you an e-mail. This is easier explained in person. |
@brian-kelley Could it be as simple as ${PACKAGE_NAME} is "Ifpack2", and that ${PACKAGE_NAME_UC} is "IFPACK2"? |
@jhux2 If the FastILU preconditioners are going to be used with AdditiveSchwarz, they need to take A as a Tpetra::RowMatrix instead of a Tpetra::CrsMatrix (the underlying matrix from AdditiveSchwarz could be a LocalFilter, an OverlappingRowMatrix, or something else). If I changed Fic/Filu/Fildl to take RowMatrix, I would need to extract values/rowptrs/colinds one row at a time from the RowMatrix before passing them to the FastILU::Fast*Prec constructor (which just takes raw Kokkos Views). Does this sound like it would be too slow, and is there some better alternative? |
@brian-kelley One option is to dynamic_cast to see if the actual matrix type is one that supports getting raw pointers. But if it is a matrix that doesn't provides the pointers, I don't see another option other than using getrow(). |
@brian-kelley It could also be a LocalFilter of a CrsMatrix. You may want to test if that could actually occur in practice. If so, there's a faster way to get the entries out. |
@mhoemmen Are you referring to LocalFilter::getUnderlyingMatrix()? |
@brian-kelley : There are some advantages in keeping the implementation as CrsMatrix specific ones. I would rather not modify FastILU to support row matrix. Instead let the Ifpack2 wrapper use get row when getting the pointers is not possible. Can we also add a timer for this portion, so we understand the overhead in not having CrsMatrices ? Also, this needs to be careful separated between initialize and compute. All the allocations, pointer initialization, column index copies for the new arrays can happen in initialize and the compute is an embarrassingly parallel (row wise) copy of the values array (assuming getrow can be called inside a functor). |
@srajama1 So in other words, copy the matrix into a CRS format if necessary? |
@jhux2 Yes, they will be copied to three (vals, rowptr, indices) locally owned, device space Kokkos Views which are passed directly to the ShyLU class that actually implements the solver. I'll do this in initialize() and it seems straightforward. Thanks! |
@jhux2: Yes, while taking into account symbolic and numeric steps. @brian-kelley : The values array cannot be copied in initialize(). Users can call compute() if just the values change, but the structure remains change. We will copy values and call FastILU again in compute for that case. |
The matrix that Ifpack2::AdditiveSchwarz passes to the subdomain solver is always an Ifpack2::LocalFilter of something. You may want to consider writing either a fast "copy the local matrix out of LocalFilter" function, or changing the factorization so it can take 4-array CSR (which is more or less how LocalFilter works). You could also try changing how AdditiveSchwarz works, if you don't like the previous options. The LocalFilter design was inherited from Ifpack. |
@mhoemmen I think the best way to do this is to write a function that deep copies the 3-array CRS out of a LocalFilter. What is the fast way to get data out of a LocalFilter that you were referring to? I would like to use getLocalRowView() (or something equivalent) inside a functor but it's not a KOKKOS_INLINE_FUNCTION. |
@brian-kelley Best thing would be to imitate LocalFilter's implementation. It works more or less like 4-array CSR. You could exploit the "row view" idea that |
@brian-kelley Sure, please do! |
@brian-kelley Just curious what the status of this is, and PR #1509. |
@brian-kelley Great, thanks for the update! |
@brian-kelley : I started reviewing it and got distracted. I will get to it. |
@srajama1 I'm not in any rush because I'm optimizing and profiling matrix addition right now :) |
@srajama1 Would you have a chance to look at this soon? |
@jhux2 : Done one more review. Looks ready to be pushed. |
@brian-kelley : Can we close this ? |
@srajama1 Yes, I've merged this with the checkin script, so I'm closing. |
@srajama1 @trilinos/shylu @trilinos/ifpack2
The text was updated successfully, but these errors were encountered: