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
Interfacing librsb into Epetra #431
Comments
@michelemartone Thanks so much for posting this here! How would you prefer to use RSB in Epetra? Would you prefer for it to happen "behind the scenes," invisibly to the user, if they enable the RSB option at configuration time? Would you prefer users to select it explicitly in their code via a run-time option (e.g., to FillComplete), or would you prefer a different class name ( There might be some advantage to exposing the RSB data structure to users, if they know how to fill into it efficiently. On the other hand, I think your intention in part is to hide the data structure, so that applications that fill into Epetra_CrsMatrix can get performance benefits in their solves. Is that right? |
I would suggest now having it behind Epetra_CrsMatrix just for testing purposes (e.g. correctness and performance of these operations) --- so "hiding" just for the time being, temporarily. After you give me the OK with this minimal patch (i.e. it passes a number of Trilinos tests), my next step can be sending you an explicit Epetra_RsbMatrix class implementation --- I have a prototype which will soon be testable by you as well. |
@michelemartone Before integrating these changes into Epetra for production, I think it would be better to have a complete patch that implements what you intend to implement. I'm not keen on temporary experimental code going into Epetra, even if it's disabled by default. That's why I was asking what your end goal is with these changes. Is your final intention to have a separate class, I'm being extra careful because many Trilinos packages and applications depend on Epetra and use it heavily. Furthermore, Epetra is not changing much (if at all), and will not change much for a long time. Thus, it's totally OK to spend some time refining this patch until it reaches a point at which you are satisfied and consider it safe for production use. |
@mhoemmen Having a minimal patch like the one I have provided, "hiding" RSB in Epetra_CrsMatrix, is what Michael has suggested in Munich as a preliminary first step for being able to test correctness and performance of RSB. So this is possible now with the three files I have provided to you. The end goal would be to obtain Epetra_RsbMatrix --- that I will provide you soon, in the way you suggest. Then I will also add the new files to this ticket, unless you suggest otherwise. |
@jwillenbring suggested that you could start a public topic branch. That would let everyone try out your modifications, without adding anything yet to the main Trilinos repository. Patches are OK, but it's nicer to use Github features -- that makes applying and modifying patches and adding comments much easier. |
I'm completely new to Github, could you please provide me a starting point or existing example of such a way of contributing ? |
You will want to fork the Trilinos repository https://help.github.com/articles/fork-a-repo/ You will then want to create a branch on your fork, and make the changes you want to make https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging When you are done making changes, you will want to issue a pull request against the Trilinos repository. Depending on a few things, it may make sense to create a copy of your feature branch on the main Trilinos repo to try things prior to applying the changes to the develop branch. |
…o host librsb. This still requires librsb and a file from ticket trilinos#431 to work.
Thanks for the links. I followed what you suggest. I've created my fork of Trilinos: Then I've branched it, and I issued a pull request: Please give a look to it --- instructions as in the original ticket: I'm waiting for your comments. |
@michelemartone Thanks for doing this! Thanks also to @jwillenbring for the instructions. I'll take a look. |
@michelemartone Comments on the changes, in order of decreasing importance:
It looks like the changes are not any more invasive than, say, those for CASK. That makes me feel better about including them in mainline Epetra. That leaves three things to do:
We can help with all of these, in particular (2) and (3). |
What you have seen is the "minimal librsb interfacing" proposed by Michael back in Munich at EUROTUG. His plan was that after a first OK on your side, I could pass you a further, 1.7KLOC file that I have ready on my disk, with an entire: "class Epetra_RsbMatrix: public Rsb_Matrix, Epetra_CrsMatrix" implementation inside, based on the Rsb_Matrix you have in rsb.hpp. The rsb.hpp file is intended to be part of librsb (yet unreleased, you have now this beta), but it is with the file with class Epetra_RsbMatrix that I aim to seriously contribute into Trilinos. Let me answer 1-5 limitedly to my Epetra_CrsMatrix:
The Epetra_RsbMatrix class file prototype is ready when you need it, I guess after testing the above. Sure, CMake logic in (2) and your testing in (3) are what is needed for Epetra_RsbMatrix ! |
@michelemartone I think you folks are the best judges of librsb performance. If it's significantly faster than the current implementation for your applications, then it's fast enough :-) Was your intention that we work on optimizing librsb performance together? If so, let's discuss that more over e-mail. |
If I understand correctly, your comment in the code suggests that your RSB implementation is incomplete. It does not correctly handle the cases where the matrix has an implicitly stored unit diagonal, or where it is upper triangular instead of lower triangular. Typical LU factorizations (including incomplete factorizations) store the L factor with an implicit unit diagonal, and U is upper triangular. The most common reason to need to do sparse triangular solves with Epetra_CrsMatrix is to apply the result of an incomplete LU factorization, and the next most common reason is to apply the result of a complete LU factorization. The Amesos and Ifpack packages will certainly want to exercise this capability. Thus, it is unlikely that downstream tests will pass, unless SV respects the UnitDiagonal and Upper arguments. |
You could always set an atexit() hook to call rsb_lib_exit(). |
When we set up the librsb TPL, we would add CMake logic to Epetra to set a macro if the TPL is enabled. That logic would test whether C++11 is enabled, and stop with a configure-time error if it is not. That's the easiest way to do this. I'll be happy to help you set that up. |
@mhoemmen : Sure, hooking rsb_lib_exit() with atexit() is a good idea for Epetra_RsbMatrix. |
I think this is on the track you are on anyway, @mhoemmen, but we can have this new feature depend on C++11, but we cannot have Epetra depend on C++11, and any Epetra features that depend on C++11 should not be enabled by default. |
@jwillenbring : I suggest to make now depend Epetra_RsbMatrix on C++11, then in the future we can see if that's avoidable (highly probably yes -- 99% of the code is in librsb's C code anyways). |
@jwillenbring That's exactly what I meant -- thanks for restating more clearly :-) librsb would not be enabled by default. It would be a TPL. Epetra features that depend on this TPL may use C++11, because the TPL would not be enabled by default. It would nevertheless still be good to avoid use of C++11 features in Epetra, even if they depend on the TPL. |
It would be nicer if we could limit all C++11 code to librsb. However, I'll accept C++11 code in those parts of Epetra that depend on the librsb TPL. It's important not to let C++11 code leak out into parts of Epetra that do not depend on the librsb TPL, though. |
This issue has had no activity for 365 days and is marked for closure. It will be closed after an additional 30 days of inactivity. |
This issue was closed due to inactivity for 395 days. |
rsb.hpp.txt
Epetra_CrsMatrix.h.txt
Epetra_CrsMatrix.cpp.txt
@mhoemmen @maherou
Hi. After my talk at EUROTUG'16 on Apr. 18-20 2016 near Munich [ https://www.mhpc.mw.tum.de/index.php?id=38 ] and subsequent discussion with Michael and Mark I've been encouraged to propose an incremental integration of the sparse matrix type RSB (provided by librsb [ http://librsb.sourceforge.net/ ]) into Epetra.
So following such a minimalist approach I have modified a few lines in Epetra_CrsMatrix (from trilinos-12.6.1) to use librsb for: MV/MTV/SV/SM, in code delimited by the HAVE_EPETRA_RSB
preprocessor symbol; and constructs in Epetra_CrsMatrix::FillComplete and in the copy constructor.
So the prototype I am providing creates an RSB copy of the matrix just for the purposes of using it in the operations above.
I am also working on a proper "Epetra_RsbMatrix" class, but let's first see if this one here is able to sustain some tests for the above operations.
The way I suggest to build this is:
get my / michele martone's GPG key
gpg --search EF1258B8download librsb from
https://sourceforge.net/projects/librsb/files/librsb-1.2.0-rc3.tar.gz/downloaddownload its signature from
https://sourceforge.net/projects/librsb/files/librsb-1.2.0-rc3.tar.gz.asc/downloadverify signature
gpg --verify librsb-1.2.0-rc3.tar.gz.ascbuild librsb
tar xzf librsb-1.2.0-rc3.tar.gzcd librsb-1.2.0-rc3
./configure CFLAGS="-O3 -fPIC" FCFLAGS="-O3 -fPIC" --prefix=/opt/librsb
make
quick check
make qtestslong check (I recommend to skip it)
make testsmake install
and put attached rsb.hpp (the Epetra-agnostic C++ wrapper to librsb)
into e.g. /opt/librsb/include/
/opt/librsb/bin/librsb-config --I_opts
/opt/librsb/bin/librsb-config --ldflags
-fopenmp -lm -lzI attach the source files I have used, with ".txt" appended to the filename.
The rsb.hpp file is meant to become part of a future release of librsb.
I am new here, so if there is a more practical approach to follow to provide this proof-of-concept test, please suggest it to me.
The text was updated successfully, but these errors were encountered: