-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Upgrade to Lapack lite 3.2.2 #8649
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
Conversation
Given the huge number of |
Yep, previously we used a patched This problem was actually present in #8381 - should have made more noise there! I'll make a quick Pr for that at some point |
I didn't see it when I compiled on my machine with |
Hmm, I can't get travis to show me the warnings for that build either. Perhaps it only shows warnings if any errors occur? (there is a real error hiding in the logs here) |
I'm wondering if pip picks up CFLAGS. However, I see that you introduced a new warning in 564b7cb
|
d53a43d
to
fd08dc5
Compare
- END DO | ||
+C DO I = M, 1, -1 | ||
+C IF( A(I, J).NE.ZERO ) EXIT | ||
+C END DO |
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.
This is a pretty bad patch, that instead of actually rewriting this code in F77 style, just says "oh, we probably didn't need this anyway". The entire set of patches is rewriting this kind of loop.
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.
There's a patch here that probably better fixes this, which I should probably copy here.
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.
@eric-wieser - I was very surprised that this wouldn't just convert. Trying bit with f2c
(as packaged by debian testing), the problem does not seem to be the do, enddo
construction, but rather the exit
statement. It should not be needed to do more than replace that with a goto <end-label>
.
p.s. I wish we could just compile the fortran; gfortran
is a very nice compiler...
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 can certainly give that a go - thanks @mhvk
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.
Well, if the other patch just works, then maybe that is easier. Anyway, let me know if there are issues; I'm old enough for most of my scientific code to have been written in fortran.
8e78d20
to
15bc60a
Compare
There's a now-hidden conversation here about the contents of the I'm pretty sure that the |
@eric-wieser What is the status of this? |
@charris: Fortran patches probably need work, and I haven't found the time to improve them. It's possible the bits of code in need of patching are just optimizations though, and that everything is working correctly right now. Also, if you can thing of a tidy way to not have essentially the same patch file four times, and then one patch with the same hunk four times, that would be handy |
15bc60a
to
29b9226
Compare
- IF( A(I, J).NE.ZERO ) EXIT | ||
- END DO | ||
+ IF( A(I, J).NE.ZERO ) GOTO 10 | ||
+ 10 END DO |
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 don't think this is correct for the EXIT, what you have here is equivalent to the C continue, whereas you want a break, i.e., GOTO the first statement after the END DO. See https://gcc.gnu.org/onlinedocs/gcc-3.4.4/g77/CYCLE-and-EXIT.html .
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.
Looking at the generated code, I can confirm you're correct. Darn.
I don't think the EXIT fixes are correct. |
Alarming that tests didn't catch that. |
Ok, I've added a pair of fixup commits that resolve that. If they look ok, then I'll rebase them in |
f1f6d21
to
c75af4d
Compare
numpy/linalg/lapack_lite/README.rst
Outdated
The output C files in git use the LAPACK source from the LAPACK_ page, using | ||
version 3.2.2. Unfortunately, the newer version use newer and newer FORTRAN | ||
features that are increasingly not supported bt ``f2c``. As these are found, | ||
the patch files need to be changed |
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 need'
numpy/linalg/lapack_lite/README.rst
Outdated
released version of LAPACK available at the LAPACK_ page. | ||
The output C files in git use the LAPACK source from the LAPACK_ page, using | ||
version 3.2.2. Unfortunately, the newer version use newer and newer FORTRAN | ||
features that are increasingly not supported bt ``f2c``. As these are found, |
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.
'bt' <- 'by'. Maybe just one "newer"
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.
So
"Unfortunately, newer versions use newer FORTRAN features ..."
@@ -107,7 +106,6 @@ doublereal dlamch_(char *cmach) | |||
|
|||
|
|||
if (first) { | |||
first = FALSE_; |
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.
Any particular reason to move 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.
Because the oracle that is f2c
decided to. This is generated code beyond my control
@@ -239,7 +237,6 @@ doublereal dlamch_(char *cmach) | |||
|
|||
|
|||
if (first) { | |||
first = FALSE_; |
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.
See above. I think it is easier to follow setting first
here, i.e., execute only the first time.
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.
And so on for the rest.
@@ -23,7 +23,7 @@ | |||
# Arguments to pass to f2c. You'll always want -A for ANSI C prototypes | |||
# Others of interest: -a to not make variables static by default | |||
# -C to check array subscripts | |||
F2C_ARGS = ['-A'] | |||
F2C_ARGS = ['-A', '-Nx800'] |
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.
What is the -N
option?
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.
Something to do with function table sizes. Without it, f2c
would error asking for it to be provided. It might no longer be needed now that dlapack is actually just the d
functions
- IF( V( LASTV, I ).NE.ZERO ) EXIT | ||
+ IF( V( LASTV, I ).NE.ZERO ) GO TO 35 | ||
END DO | ||
+ 35 CONTINUE |
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'd put the label on the next statement, but really, that is total nitpicking. This certainly works...
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.
This is the whole point in CONTINUE
though, right?
Did this because it makes the patch more self-contained
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.
ok, that makes sense.
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.
Ah, another old Fortran guy. I remember when the compiler was written in assembly, came on paper tape, and ran in several kilobytes of memory. Not only that, but a single human being could read the code and understand it.
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.
Haven't used paper tape, but did use punch cards... But I fear my real early programming experience was in BASIC on a PET 2001... (plus 6205 assembly...)
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.
Ah, different generation. The good thing about paper tape was that you could edit it with a razor blade and scotch tape 8-)
Anyway, I confess that the first computer I programmed for was one of the bigger ones in the country at that time, an IBM 360 with two megabytes of memory.
Patches look good, couple of other comments. Why the big increase in size? More functions or more complex code? |
I think a lot of the documentation got better. Remember that we're looking at 10 years of development to LAPACK here |
Should I remove the author from the README and/or add myself? I'm not too keen on putting my email address that visible on the easily-scrapable web, but I could put a github username in that file if it helps? Readme is fixed, and fixup commits have been squashed |
This doesn't yet actually generate the files, since they would cause the diff to balloon
These are copied from the libf2c source code, which is presumably where all the others came from
c75af4d
to
0b525a5
Compare
LGTM. Could you add something to the 1.13 release notes? |
I think you could just add your name and a date. If anyone wants to find out more they can use git blame to track it back to the relevant commit. |
Or you could just leave it be. Pearu's name is still in some of the f2py files as an histori D215 cal artifact even though others have worked on the source since. |
Also, update authors of lapack_lite [ci skip]
In it goes. Thanks Eric. |
Implements #8376. We pick the earliest acceptable version for the bug this was aiming to fix (
dgelsd
does not correctly computeiwork
), because each new version throws more fortran features not supported byf2c
at us.This is fully functional
, but a little hacky right now.Not sure how best to structure the commits here. Unlike the last PR, these don't stand up by themselves - but I don't really want to stick a huge generated diff in the same place as hand-written code.