You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies if this is the wrong forum for a newbie question. My problem is more about how to use go assembler than python. I have gotten stuck trying to compile and run the output of PeachPy in the go-generate example:
jon@brainsIntel:~/Documents/PeachPy/examples/go-generate$ go generate dot_product.go
jon@brainsIntel:~/Documents/PeachPy/examples/go-generate$ ls
dot_product_amd64.s dot_product.go dot_product.py dot_product_test.go main.go
I tried many different go build and go run commands with no success yet. To get the main.go to run I had to change "package blas" to "package main" in all files and rename the folder from "go-generate" to "main". Finally I could run the main function with "go build -x .". Sadly the results seem to be incorrect, so I guess I am doing something wrong still:
Could you help me? I am missing the exact series of "go" commands (or other) that need to be used in a shell order to run the code, run the tests and verify the output is correct.
Adding the main function code into the test code and running "go test" lets me use the original folder, but the answer is still incorrect ?
jon@brainsIntel:~/Documents/PeachPy/examples/go-generate$ go test .
--- FAIL: TestDotProduct (0.00s)
dot_product_test.go:20: Dot incorrect, got: 5252114210988121653248.000000 want: 12288.000000
FAIL
FAIL _/home/jon/Documents/PeachPy/examples/go-generate 0.001s
jon@brainsIntel:~/Documents/PeachPy/examples/go-generate$ git diff dot_product_test.go
diff --git a/examples/go-generate/dot_product_test.go b/examples/go-generate/dot_product_test.go
index d7f24b4..e86a9e2 100644
--- a/examples/go-generate/dot_product_test.go
+++ b/examples/go-generate/dot_product_test.go
@@ -4,6 +4,22 @@ import (
"testing"
"math/rand"
)
+
+func TestDotProduct(t *testing.T ){
+ var N int
+ N = 2048
+ x := make([]float32, N)
+ y := make([]float32, N)
+ for i:=0 ; i < N; i++ {
+ x[i] = 2.
+ y[i] = 3.
+ }
+ dasm := DotProduct( &x[0], &y[0], uint(N) )
+ dtrue := float32( N ) * 6
+ if dasm != dtrue {
+ t.Errorf("Dot incorrect, got: %f want: %f",dasm,dtrue)
+ }
+}
It could also be an error in the generated asm code perhaps, but I was sort of assuming this should be OK...
Many thanks in advance for your help!
The text was updated successfully, but these errors were encountered:
Apologies if this is the wrong forum for a newbie question. My problem is more about how to use go assembler than python. I have gotten stuck trying to compile and run the output of PeachPy in the go-generate example:
I tried many different go build and go run commands with no success yet. To get the main.go to run I had to change "package blas" to "package main" in all files and rename the folder from "go-generate" to "main". Finally I could run the main function with "go build -x .". Sadly the results seem to be incorrect, so I guess I am doing something wrong still:
Could you help me? I am missing the exact series of "go" commands (or other) that need to be used in a shell order to run the code, run the tests and verify the output is correct.
Adding the main function code into the test code and running "go test" lets me use the original folder, but the answer is still incorrect ?
It could also be an error in the generated asm code perhaps, but I was sort of assuming this should be OK...
Many thanks in advance for your help!
The text was updated successfully, but these errors were encountered: