Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Conversation

@btracey
Copy link
Member

@btracey btracey commented Jul 30, 2015

No description provided.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

PTAL @kortschak

native/dgetf2.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if we do this elsewhere, but we probably should if not. "a" here should be "A" since we are not actually describing the abstract matrix in the parameter a as we do in mat64; m, n, a and lda are required to do this. So, leave the parameter as "a" and change the doc to "A" where appropriate. Probably we need to vet all the docs at some point to ensure we are doing this consistently.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

Sorry, I forgot I cheated on the swapping. Fixing now.

@kortschak
Copy link
Member

Add tests for the cgo implementation.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

mat64 will use the blocked version of the algorithm (dgetrf). Do we want cgo tests even though mat64 won't import dgetf2?

@kortschak
Copy link
Member

Yes, please.

native/dgetf2.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Should this +1 be here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Assuming you mean -1, yes. Nice catch.

Copy link
Member

Choose a reason for hiding this comment

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

The loop in fortran is 1,m-j which is 1 <= i <= m-j; shifted to 0-based 0 <= i <= m-j-1 which is 0 <= i < m-j. So no adjustment at all. Am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. j is 1-indexed, so to shift from Fortran j to Go j you also need to subtract 1.

Copy link
Member Author

Choose a reason for hiding this comment

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

For example, for the first column, in fortran it's 1 <= i <= m -1.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, OK. Thanks.

@kortschak
Copy link
Member

The issue of blas/native v blas/cgo and their interaction with lapack/native v lapack/cgo I think needs to be sorted out. Proviously the configuration was simple since we didn't use lapack, now there are two knobs where one is ignored in some states of the other. This needs at least to be documented in mat64.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

Added cgo tests. Agreed on the need for mat64 documentation.

Copy link
Member

Choose a reason for hiding this comment

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

add the name ok to the return - at the moment the documentation make it look like you are returning (isSingular bool).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is returning isSingular. The factorization doesn't stop when a singularity is found.

Copy link
Member

Choose a reason for hiding this comment

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

In the OpenBLAS code info is set to != 0 when it's singular and the fortran specifies info == 0 indicates OK. Here you set ok = false when you see a singularity. And you call it "ok".

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I see your point. Yes.

@kortschak
Copy link
Member

I'm not sure why the cgo code is failing on <go1.5. The OpenBLAS code is here and it looks like it should be doing the right things wrt the return boolean.

@kortschak
Copy link
Member

What's more, it passes on my machine.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

Mine too.

@kortschak
Copy link
Member

Would you make an exploratory change to clapack.Dgetf2 to print the return value before calling isZero so we can see what is happening on the travis machine? Also add echo OpenBLAS $(git rev-parse HEAD) just below https://github.com/gonum/lapack/blob/master/.travis/linux/OpenBLAS/install.sh#L10 (we might want to keep that there - but for another PR). This will all be reset after we see what's going on.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

I'll make the change in a few minutes.

@kortschak
Copy link
Member

I suggested wrong line in install.sh - I've pushed the correct version now.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

So I shouldn't add the cgo test lines? Sorry, I'm also helping a new gopher at the moment.

@kortschak
Copy link
Member

Yes, add them, and the other things (see #23 but wait for it to succeed).

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

Pushed. Here's what it prints on my machine

brendan:~/Documents/mygo/src/github.com/gonum/lapack/cgo$ go test
0
0
0
0
0
0
2
2
2
2
PASS
ok      github.com/gonum/lapack/cgo 1.156s

@kortschak
Copy link
Member

So the last two give different results. Unfortunately the rev-parse is on the wrong line (note where it is on #23 - I was wrong in my original instructions), so we can't see which OpenBLAS is being used.

@kortschak
Copy link
Member

I suspect that this is a bug in OpenBLAS, but we need to the HEAD sha to report - I imagine that both of us are using an older version of OpenBLAS than the current default HEAD.

@kortschak
Copy link
Member

OK, I'm officially bewildered. I've built OpenMathLib/OpenBLAS@3f1b576 which is the sha that was reported in the #23 tests and so presumably is what was built here also, and then tested that on my machine.

I get pass and the same output as you.

@kortschak
Copy link
Member

@xianyi Do you have any ideas why OpenBLAS Dgetf2 might be returning singular matrices as not singular, but only on travis hardware?

@vladimir-ch
Copy link
Member

I'm not sure if it is related, but in optimize we also had problems with tests failing only on Travis, they were running differently. As for the reason, I don't know.

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

I assume I should revert the cgo changes, or are they still useful?

@kortschak
Copy link
Member

Don't revert them, reset --hard e86d740 and push -f.

@btracey btracey force-pushed the adddgetf2 branch 2 times, most recently from e86d740 to abd7e2b Compare July 30, 2015 04:56
cgo/lapack.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Woops

@btracey
Copy link
Member Author

btracey commented Jul 30, 2015

Oh, oops.

fixed incorrect comment and incorrect test

Real permutations and PR comments

Add cgo tests

fix indexing error

change return to ok

fix okays

fix ok
@btracey
Copy link
Member Author

btracey commented Aug 1, 2015

What is the status of this PR? Are we waiting until we have a resolution on the OpenBLAS error?

@kortschak
Copy link
Member

kortschak commented Aug 1, 2015 via email

btracey added a commit that referenced this pull request Aug 1, 2015
Add Dgetf2 (unblocked LU algorithm) and tests
@btracey btracey merged commit 846e349 into master Aug 1, 2015
@vladimir-ch vladimir-ch deleted the adddgetf2 branch May 31, 2016 21:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants