-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
|
Test for cgo? clapack has Dormbr. |
|
We're back at that level? Exiting! I just ran the cgo tests to make sure they pass before implementing the Dormbr tests. I hit the Dlantr panic. Not reproducable, but copying here for future reference |
native/dormbr.go
Outdated
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 understand this for two reasons. First, blas.Side and blas.Transpose are not letters (we translate them in the wrappers around clapack in cgo for example), and second, opts is ignored by Ilaenv in native (in the FORTRAN it is only considered when ispec > 11 which the Go code panics for).
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're right that this is definitely wrong. What would you like me to do? I'm under the impression that Ilaenv is hypothetically tunable to the architecture, like ATLAS does, and I imagine this is the reason the values are passed explicitly instead of ignored even though the netlib implementation doesn't use them. Would you like me to construct and pass the string explicitly, or pass in empty?
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.
We face the user with blas types rather than FORTRAN chars, so I'm less fussed by the translation thing (there is no internal native package like clapack - though the rest of Ilaenv does use letters), but it seems odd to me that ILAENV is called with ISPEC=1 and the OPTS are passed through with work to construct them.
The approach that you are taking is probably the only reasonable way to do it (alternative is as []int) since the types we use for these options are distinct. Maybe just add a comment that the current implementation does not use opts, but a future change may make that happen. Whether they get converted to 'L'/'R' and 'T'/'N' is up to you - and changeable later since nothing is done with them.
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.
Done.
|
The cgo tests fail on Dormbr. This is weird, because before seeing this I would have put a high probability on the go code being correct. We know P and Q are computed appropriately. This is tested by Dgebd2, which both native and cgo pass. The only step after this is to multiply C by the respective matrix. We know Dgemm is correct (otherwise everything would break). It also seems unlikely I would have a bug in the native implementation (a translation from Fortran), and the test (independently coded and using different matrix data) that exactly cancel out to create a passing native test. I pushed the cgo tests because I'm not sure I have time to debug at the moment and maybe you'll see something obvious. |
testlapack/general.go
Outdated
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.
Construct V and U.
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.
Done.
|
Well, it's just a small subset that is failing (applyP for specific sizes), so it's probably a bug in the implementation and test. |
|
In a few days I can have a look using a direct FORTRAN call if you don't get to it first. |
|
I wonder. The section that is failing has a call to Dormlq, and we have a comment in the cgo test for Dormlq I'll try again with the latest OpenBLAS version tonight |
cgo/lapack.go
Outdated
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.
off-diagonal
are stored? Or delete?
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.
Done.
|
Symptom: Cgo only fails Dorml2 the test when Side == Right, and only under certain conditions. I think I see the problem. From the documentation of Dorml2 From dormql_work.c This seems wrong. The size should depend on the value of size. Agreed? This matches that it only fails when side is right (since it's the correct size when left). Not fully clear why it passes under some of the Right conditions, but that may be due to an oddity of the way our test is constructed. |
|
I see, I'm probably back to rediscovering OpenMathLib/OpenBLAS#615 I guess I'll go back to seeing if I can fix linking errors. |
|
I think you are right. |
|
Nope, I get linking errors on tip as well. |
|
Working for me. |
|
It compiles for me if I delete the following functions |
|
The Dormlq test is still failing for me, even with the updated OpenBLAS. The transpode code has changed, but it now says (line 86 of dormlq_work.c) I think this is still wrong. The size of A depends on the side, as quoted above. |
|
Yes, I agree to both of those. BTW what OpenBLAS sha are you on? |
|
brendan:~/software/OpenBLAS$ git rev-parse HEAD |
|
I am at a loss. That's where I am and it builds fine here. |
|
Maybe it's a clang/ gcc thing? |
|
Size hypothesis correct. If I change the code to The Dorml2 tests pass |
|
Nice work. |
|
Send a PR to OpenBLAS? |
|
It looks to me like a similar problem with the failing cgo tests for the new function, Dormbr. It has The documentation says that a can be any of mxk, nxk, kxm, or kxn so it doesn't seem like there is any way this code can be correct. |
|
For dormlq |
|
And yes, confirmed for Dormbr. Following code gives passing go tests. |
|
For dormbr |
|
And lapack bug http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4863 |
|
Responded to PR comments. I disabled the currently failing Lapack tests with good error messages. We can reenable them when/if OpenBLAS updates. Note that this is not a cascading failure. The problem is with the c wrapper, and so functions that call Dormbr / Dormlq (i.e. SVD) through fortran get the correct answer, it's just calling these functions directly (as the test does) where the wrong answer is achieved. |
|
PTAL |
native/dormbr.go
Outdated
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.
opts = "L", equivalent for "R". The compiler should optimise them to the same operation, but might not.
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.
Done.
|
LGTM
|
No description provided.