-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
Now the runtime version of GMP is checked against the compile time version, as suggested by @JeffBezanson. He also noted that the limbs field of RangeGeneratorBigInt was not specific enough.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -18,8 +18,11 @@ else | |||
end | ||||
typealias CdoubleMax Union(Float16, Float32, Float64) | ||||
|
||||
const GMP_VERSION = VersionNumber(bytestring(unsafe_load(cglobal((:__gmp_version, :libgmp), Ptr{Cchar})))) | ||||
const GMP_BITS_PER_LIMB = Int(unsafe_load(cglobal((:__gmp_bits_per_limb, :libgmp), Cint))) | ||||
gmp_version() = VersionNumber(bytestring(unsafe_load(cglobal((:__gmp_version, :libgmp), Ptr{Cchar})))) | ||||
gmp_bits_per_limb() = Int(unsafe_load(cglobal((:__gmp_bits_per_limb, :libgmp), Cint))) | ||||
|
||||
const GMP_VERSION = gmp_version() | ||||
const GMP_BITS_PER_LIMB = gmp_bits_per_limb() | ||||
|
||||
# GMP's mp_limb_t is by default a typedef of `unsigned long`, but can also be configured to be either | ||||
# `unsigned int` or `unsigned long long int`. The correct unsigned type is here named Limb, and must | ||||
|
@@ -49,6 +52,11 @@ _gmp_clear_func = C_NULL | |||
_mpfr_clear_func = C_NULL | ||||
|
||||
function __init__() | ||||
if gmp_version() != GMP_VERSION || gmp_bits_per_limb() != GMP_BITS_PER_LIMB | ||||
error(string("the dynamically loaded GMP library (version $(gmp_version()) with __gmp_bits_per_limb == $(gmp_bits_per_limb()))\n", | ||||
"does not correspond to the compile time version (version $GMP_VERSION with __gmp_bits_per_limb == $GMP_BITS_PER_LIMB)")) | ||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rfourquet
Author
Member
|
function check_blas() |
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
rfourquet
Dec 3, 2014
Author
Member
OK I will add "Try to rebuild Julia" to the error message. There are not build option to suggest as for BLAS, but this should just work.
3 comments
on commit 42fd6b1
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.
Will you be creating a PR for this?
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 didn't intend to... it's such a small change, so I linked to this branch in #9122, as a follow-up. Should I create a PR?
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.
No, it isn't necessary - I realized it was on the same branch, and was just wondering how you were planning to incorporate into master.
I think we have similar checks with blas in
interactiveutil.jl
, could you look over those and see if it would be worth adding a suggestion for what to do about the problem?