-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Engine stuff. Also Go 1.14 fixed (#61)
* Fixed Engine stuff. Also Go 1.14 fixed * Fixed Travis (Gonum only supports the two most recent versions of Go)
- Loading branch information
Showing
10 changed files
with
44 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,8 @@ branches: | |
only: | ||
- master | ||
go: | ||
- 1.10.x | ||
- 1.11.x | ||
- 1.12.x | ||
- 1.13.x | ||
- 1.14.x | ||
- tip | ||
|
||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// +build !race | ||
|
||
package tensor | ||
|
||
import ( | ||
"testing" | ||
"unsafe" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// This test will fail the `go test -race`. | ||
// | ||
// This is because FromMemory() will use uintptr in a way that is incorrect according to the checkptr directive of Go 1.14+ | ||
// | ||
// Though it's incorrect, it's the only way to use heterogenous, readable memory (i.e. CUDA). | ||
func TestFromMemory(t *testing.T) { | ||
// dummy memory - this could be an externally malloc'd memory, or a mmap'ed file. | ||
// but here we're just gonna let Go manage memory. | ||
s := make([]float64, 100) | ||
ptr := uintptr(unsafe.Pointer(&s[0])) | ||
size := uintptr(100 * 8) | ||
|
||
T := New(Of(Float32), WithShape(50, 4), FromMemory(ptr, size)) | ||
if len(T.Float32s()) != 200 { | ||
t.Error("expected 200 Float32s") | ||
} | ||
assert.Equal(t, make([]float32, 200), T.Data()) | ||
assert.True(t, T.IsManuallyManaged(), "Unamanged %v |%v | q: %v", ManuallyManaged, T.flag, (T.flag>>ManuallyManaged)&MemoryFlag(1)) | ||
|
||
fail := func() { New(FromMemory(ptr, size), Of(Float32)) } | ||
assert.Panics(t, fail, "Expected bad New() call to panic") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters