-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
CHOLMOD makeover #10117
CHOLMOD makeover #10117
Conversation
cc21a72
to
994aa0a
Compare
|
||
### A way of examining some of the fields in chm_com | ||
for Ti in IndexTypes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is IndexTypes
defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cholmod_h.jl
Generally in favor so far, but a few things. First, can you separate the library version bump from the major revamp of the Julia code? Presumably it's a backwards compatible release of SuiteSparse so shouldn't break anything otherwise. If you are relying on behavior that has only been fixed in that latest version, we'll need to get that version built into the Windows nightlies, and packaged in the Homebrew tap and the Ubuntu PPA for this to work on CI. And this pull request is unmergeable, it apparently needs rebasing. |
Yes. I'll separate out the version bump. I've inserted branches for the versions where I rely on the fix, so the code works with order versions of SuiteSparse, but is less efficient. I'll rebase when SuiteSparse has been bumped. However, don't know why the tests fail on Travis, as they pass locally, but I'm looking into it. |
994aa0a
to
3ec69db
Compare
This is fantastic. Much needed work! I see there are modifications to |
Also, the commits are nicely separated - so would love to keep this commit history. |
Can't quite tell in the large patch set here - but we should also check for the correct cholmod version for the bug in |
Do you think we can get rid of SuiteSparse_wrapper.c? |
@isok ccall((:cholmod_l_start, :libcholmod), Cint, (Ptr{UInt8},), chm_l_com) | ||
end | ||
chm_l_com | ||
ccall((:jl_cholmod_version, :libsuitesparse_wrapper), Cint, (Ptr{Cint},), version_array) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if dlsym
does not find the cholmod_version
symbol, it is safe to assume that the version of CHOLMOD is too old for us. This lets us get rid of jl_cholmod_version
from the wrapper too.
These tests are failing for me:
|
Very nice! It's a lot of changes but it looks much more consistent this way. @ViralBShah : we can't get rid of the wrapper yet, since we still need |
Since we pick the sizeof_long as part of SuiteSparse config, we can write it during build time. |
The problem is how to parse SuitSparse's config.h. The size of Suitsparse_long is picked depending on the platform (via |
We know it because we pick it in
|
@ViralBShah |
@ViralBShah I changed the printing level as you suggest. This is also to suppress warnings when the matrix is not positive definite. In the end I decided to write a new I'm checking the version in Regarding The errors you are getting are the same as the errors on Travis, but I dont' see them locally. I'll try julia.mit.edu and see if I can get them there. |
Actually, I think that we are only using fields of |
Disregard the last comment. We'll need the offsets because we need to extract fields that are far down the struct. The |
It's probably not worth the effort to ask Tim. I guess we can just retain the file for now. |
@ViralBShah I don't see the test failures on julia.mit.edu either. Annoying when failures are not locally reproducible. Which system are you using when you get the failures? |
@tkelman I was wondering the same after I posted my comment. I vaguely recollect that one can still configure SuiteSparse_Long. It may not matter if we are retaining the wrapper. However, from SuiteSparse_config.h
|
@andreasnoack I am using OS X. Are you running on a clean copy? |
No. I also just tried to build on the server again without |
I am trying that - but are you sure you have committed everything? |
Huh - after a |
Travis probably also has the old suitesparse - if it is indeed the cholmod_symmetry bug. |
I've added some lines to the list of changes. In particular I'd forgotten to add the separation between the LLt and LDLt factorization such you now get the former from Talking about Travis, I made it print the version of CHOLMOD and to my surprise it was 2.1.1 which is almost two years old. I thought that Travis used the same versions of the dependencies as those specified in Versions.make. @tkelman and @staticfloat is this expected? |
r2 = int(unsafe_load(s.p, i1 + 1)) | ||
(r1 > r2) && return zero(T) | ||
r1 = int(searchsortedfirst(pointer_to_array(s.i, (s.nzmax,), false), i0 - 1, r1, r2, Base.Order.Forward)) | ||
((r1 > r2) || (unsafe_load(s.i, r1) + 1 != i0)) ? zero(T) : unsafe_load(s.x, r1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that none of these branches are tested as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are probably right. I can probably reach all of them by testing the show method on Sparse
.
e408296
to
e8264db
Compare
@jakebolewski I have made an iteration more over the test coverage and I've also expanded most of the branches to separate lines to make it easier to see the coverage as you suggested. The print methods from CHOLMOD cannot be tested without printing to the screen, so I have left them out deliberately. I've been rebasing locally to add changes to the old commits to try to keep some of the changes separated. At the same time there was a conflict with master and I think the combination made git do things I didn't expect when trying to |
Split cholfact and ldltfact functionality Add cholmod_symmetry wrapper. Add issym and ishermitian methods. SuiteSparse version bumped to fix bug in cholmod_symmetry Name cleanup: - cholmod and CHOLMOD avoided within module - use same names as in the C library for the wrapper Use same argument order as the C library Argument types in ccall checked Remove scale methods for Sparse Reorganize tests
…ve some unused methods.
87b9e2f
to
c380d39
Compare
This is a great improvement. Thanks @andreasnoack |
I believe SuiteSparse needs to be bumped, now that this is merged. |
You're welcome. I think we should wait to next bug fix release. I've added version checks around the new features so they work, although slower, with out present version. The reason we should wait is that Tim Davis forgot to bump the version number in the header file so it will appear as the old version in our wrappers. He said he'd collect a few more bug fixes before next release so we should just wait for that. |
I just noticed now that I have been working with this version for a couple of days that there are no Was this intentional or an oversight? If it is an oversight then I will create a pull request to add methods for it. (Well, I will try to create a pull request. Most of the time things fall apart badly when I try to do so and I need to remove all traces of julia from my computer and start again from scratch.) |
It looks as if it would be possible to simply copy the |
Because I had split the LDLt from the LL', I decided to introduce Could you check and see if |
Thanks. I didn't see the Sorry for the false alarm. |
Small note to those interested: SuiteSparse 4.4.3 is now the default on Travis and Ubuntu. |
This was initiated as an attempt to fix #3295 and with the changes in this pr makes it possible to write
which is comparable to MATLAB on my computer. MATLAB is a little faster, but their versions of the sparse solvers could use a different optimization library for the symbolic part and MATLAB also uses MKL.
To make this work, I had to wrap
cholmod_symmetry
which is an effective function for checking symmetry/Hermitianity of a matrix. The method had a tiny bug, which Tim Davis was kind enough to fix promptly, so I'm also bumping the SuiteSparse version.However, it ended up with quite a bit more:
cholfact
andldltfact
.AAt
when passing non-symmetric/Hermitian matrixCholmod
has been removed from most names as it is redundant in a module namedCHOLMOD
Symmetric{Tv,SparseMatrixCSC{Tv,Ti}}
andHermitian{Tv,SparseMatrixCSC{Tv,Ti}}
for symmetric/Hermitian sparse matrices. This makes it possible to work with symmetric/Hermitian sparse matrices where only one triangle is stored as is the case for MM files.Triplet
type and methods have been removed as it they were unexported, untested, and the functionality is covered in native Juliashow(Factor)
method that takes anio
argumentI'd like to hear what @dmbates has to say on these changes. I've might broken some functionality used down the stream (beyond the obvious from the name changes). Also cc: @ViralBShah, @tkelman, @acroy
UPDATE: I forgot a couple of changes which are now added to the list