Skip to content

Conversation

nalimilan
Copy link
Member

The check introduced in #10362 is actually too strict,
as ABI break only happen with mismatches in the major
version. Warning on minor version differences means
distributions cannot update SuiteSparse without
rebuiling Julia (#12841).

Also fix the incorrect wording introuced in 25eb444:
this message corresponds to the case where the version is
different, not necessarily older.

CC: @andreasnoack

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I don't understand why this line is here. version_array is declared const above, and already set during compilation using the very same call. Since it's supposed to hold the version used when building Julia, resetting it on init doesn't make any sense to me. Should I remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version_array ends up with the linked version of CHOLMOD if possible and tmp has the version at build time. Therefore, I think we could just have

tmp = copy(version_array)

instead of

tmp = Array(Cint, 3)
ccall((:jl_cholmod_version, :libsuitesparse_wrapper), Cint, (Ptr{Cint},), tmp)

but I think there is a problem with version which should be updated at run time.

I think we need these definitions at compile time, but I'm not completely sure, so it might be that they can just be defined in the __init__ function.

@kshyatt kshyatt added the sparse Sparse arrays label Sep 7, 2015
@nalimilan
Copy link
Member Author

(Moving from adding comments inline as they get hidden after a new commit is added.)

More precisions. I was actually able to get the tests to pass with 4.1.0 (it was related to a build issue). But with 4.0.0 they don't, and I get this error, which seems more serious:

     * sparse               ERROR: LoadError: LoadError("/home/milan/Dev/julia/usr/share/julia/test/sparse.jl",6,LoadError("/home/milan/Dev/julia/usr/share/julia/test/sparsedir/cholmod.jl",106,ErrorException("test failed: 1 == 0\n in expression: unsafe_load(chma.p).is_ll == 0")))

So we should rely on either 4.1.0 (libcholmod 2.1.0) or 4.2.0 (libcholmod 2.1.1) as a minimum. Since only the latter allows getting the version number, I'm inclined to require it. Both versions were released in the same month 2013. That's what this PR currently does.

I'll also write to Tim Davis to ensure we never get ABI breaks inside a minor release in the future.

Finally, I forgot to say that currently, even with this PR, sparse support doesn't work at all when the warning message is printed: since StdErr is not defined, it triggers an error, and the initialization phase does not complete. So we also need to fix #12841 separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just say "binaries from www.julialang.org" without mentioning the OS here? MSYS2 may eventually have a Julia package where this could also apply.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will fix when the PR is ready.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the new version.

@JeffBezanson JeffBezanson added this to the 0.4.0 milestone Sep 8, 2015
@JeffBezanson
Copy link
Member

@andreasnoack @ViralBShah can somebody comment on the current state of this?

@nalimilan
Copy link
Member Author

I've changed it to use Libdl.dlsym_e.

There's still something I don't understand in the logic of the code: why do we call cholmod_version at the top level, i.e. at build time? If we only care about the version used during the build, we could call jl_cholmod_version unconditionally there. At the moment all that is quite confusing, since the global version_array and version can get out of sync, since the former is used to store the current CHOLMOD version in __init__. Do we even need these globals? Wouldn't calling jl_cholmod_version in __init__be enough to find out the build time version of CHOLMOD?

@andreasnoack
Copy link
Member

There used to be function definitions the depended on the version and therefore the constants were convenient. However, these conditions have been removed. It is likely that we don't need these constants at compile time anymore so feel free to try to remove them.

@nalimilan
Copy link
Member Author

@andreasnoack OK, I've added a commit simplifying the logic.

@nalimilan
Copy link
Member Author

With the last commit, the fields of the C_Factor struct are determined based on the CHOLMOD version the SuiteSparse wrapper was compiled with. This means that merely recompiling the Julia image without recompiling this wrapper won't make it take into account a change in the CHOLMOD version. I considered that's not an issue since an ABI break without rebuilding would generate problems with the wrapper anyway, right?

@andreasnoack
Copy link
Member

I think your reasoning here makes good sense. Package maintainers like you are also the main audience for these checks so if they make sense from a packaging perspective, we should be good. Users who downloads the generic builds or compile from source won't have these problems.

I don't think I have any further comment. Is the pr ready now?

The check introduced in #10362 is actually too strict,
as ABI break only happen with mismatches in the major
version. Warning on minor version differences means
distributions cannot update SuiteSparse without
rebuiling Julia (#12841). We also require at least
libcholmod 2.1.1.

Call dlsym_e instead of dlsym, which raises an error instead
of returning C_NULL.

Also fix the incorrect wording introuced in 25eb444:
this message corresponds to the case where the version is
different, not necessarily older.
Use jl_cholmod_version only once to get the version
used during the build, and do not modify this constant
in __init__(). Rename variables to make them more explicit.

Also only register gc tracked allocator if current version
(and not build version) is recent enough.
@nalimilan
Copy link
Member Author

That's ready from my side. I've squashed the two first commits, as they are tightly related and overlap a lot when moving the messages around.

@ViralBShah
Copy link
Member

This looks ok to me too. Can merge once CI completes.

@mschauer
Copy link
Contributor

mschauer commented Sep 9, 2015

Congrats, the last issue with milestone 0.4.0. Nice that it falls on number 13000.

@nalimilan
Copy link
Member Author

Cool, I hadn't noticed that detail! So I have the privilege of hitting the green button. Thanks everybody for the review!

nalimilan added a commit that referenced this pull request Sep 9, 2015
Improve CHOLMOD version mismatch detection
@nalimilan nalimilan merged commit e9f4e20 into master Sep 9, 2015
@nalimilan nalimilan deleted the nl/choldmod branch September 9, 2015 15:20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be spaces, not tabs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I hate editors when they don't respect the existing style of a file. I've pushed a fix on master, should I also push it on release-0.4 to ease future backports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just did d523dde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sparse Sparse arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants