Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Make goblas the default BLAS implementation #63

Merged
merged 5 commits into from
Jan 1, 2015
Merged

Make goblas the default BLAS implementation #63

merged 5 commits into from
Jan 1, 2015

Conversation

kortschak
Copy link
Member

Also allow cblas use in testing with go test -tags cblas.

@kortschak kortschak force-pushed the goblas branch 2 times, most recently from 3d92d42 to 5bd8062 Compare January 1, 2015 03:18
Also allow cblas use in testing with `go test -tags cblas`.
@jonlawlor
Copy link
Contributor

It appears that it fails on FAIL: dense_test.go:551: S.TestPow. I get the same failure on my machine. Is there an issue with Mul?

@kortschak
Copy link
Member Author

This change highlights two issues.

  1. The errors meesages used in goblas and cblas differ, so it is not possible to transparantly drop in one or the other and retain use of the recovered message. This should probably be changed.
  2. Mul in goblas does not correctly handle cases where the receiver is full of NaN.

@kortschak
Copy link
Member Author

I think I know why this is happening, and I think it shows that cblas is actually the one that is incorrect. In goblas, @btracey (correctly) does C <- aAB + bC, which means that if (as is the case in this test) C is full of NaN, C is NaN at completion. Why this doesn't happen in cblas? Dunno.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.24%) when pulling 35f9fa1 on goblas into 2f2cd0a on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.27%) when pulling f9625e8 on goblas into 2f2cd0a on master.

//+build cblas

package mat64

Copy link
Member

Choose a reason for hiding this comment

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

Does this mean the package is tested with cblas? Is this file somehow avoided with the go test call?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you want to test with cblas, use go test -tags cblas. This does not happen on travis. If you do this locally, it will fail at the moment - we need to harmonise panic values between the two implementations. My proposal would be to drop the c from the beginning of the cblas panics and use those in both - the reasoning being that those messages are more informative (they give a stronger hint to which parameter was incorrect).

Copy link
Member

Choose a reason for hiding this comment

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

Use the cblas panic messages rather than the goblas ones? SGTM.

I see what this code does now. Thanks. I hadn't used build tags before.

@btracey
Copy link
Member

btracey commented Jan 1, 2015

LGTM.

Now that we have a default implementation registered, do we need the explicit nil checks in functions? We could instead move the nil check into register and then it's impossible for it to be nil. Doesn't need to happen here, just a note for the future.

@jonlawlor
Copy link
Contributor

Would we also want to have downstream packages (stat, for example) use build tags for goblas vs cblas?

@btracey
Copy link
Member

btracey commented Jan 1, 2015

I'm under the impression this is a temporary tie-over until there is a single place to register BLAS (located in the blas package). Then there is one tag for all code whether you're interfacing with BLAS directly, mat64 indirectly, or something else.

@jonlawlor
Copy link
Contributor

LGTM

@kortschak
Copy link
Member Author

PTAL

@coveralls
Copy link

Coverage Status

Coverage increased (+0.14%) when pulling af21049 on goblas into 8b25631 on master.

@jonlawlor
Copy link
Contributor

LGTM as well.

@kortschak
Copy link
Member Author

Then there is one tag for all code whether you're interfacing with BLAS directly, mat64 indirectly, or something else.

The tag only specifies the mat64 test behaviour; I don't want to use tags anywhere else for specifying which implementation, that's down to client code, but yes, once we've centralise the registration, a single Register call will do all the work of changing implementation.

@@ -501,7 +501,7 @@ func (s *S) TestMul(c *check.C) {

// These probably warrant a better check and failure. They should never happen in the wild though.
temp.mat.Data = nil
c.Check(func() { temp.Mul(a, b) }, check.PanicMatches, "cblas: index of c out of range", check.Commentf("Test %d"))
c.Check(func() { temp.Mul(a, b) }, check.PanicMatches, "general: insufficient length", check.Commentf("Test %d"))
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 panic message be "blas: index out of range" to match https://github.com/gonum/blas/pull/66/files

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet. When goblas is being harmonised this should change too.

@btracey
Copy link
Member

btracey commented Jan 1, 2015

LGTM

kortschak added a commit that referenced this pull request Jan 1, 2015
Make goblas the default BLAS implementation
@kortschak kortschak merged commit b6222f5 into master Jan 1, 2015
@kortschak kortschak deleted the goblas branch January 1, 2015 23:51
This pull request was closed.
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