Open weijizhen opened 4 months ago
Hi, indeed setting up the GPU support is a bit cumbersome and depends on the ICICLE library being set up correctly. Have a look at https://github.com/ingonyama-zk/icicle/tree/main/wrappers/golang on how to build ICICLE.
I am at gnark/.../example, a main. go was created, such as the following code: package main
import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" )
// CubicCircuit defines a simple circuit // x**3 + x + 5 == y type CubicCircuit struct { // struct tags on a variable is optional // default uses variable name and secret visibility. X frontend.Variable
gnark:"x"
Y frontend.Variablegnark:",public"
}// Define declares the circuit constraints // x*3 + x + 5 == y func (circuit CubicCircuit) Define(api frontend.API) error { x3 := api.Mul(circuit.X, circuit.X, circuit.X) api.AssertIsEqual(circuit.Y, api.Add(x3, circuit.X, 5)) return nil }
func main() { // compiles our circuit into a R1CS var circuit CubicCircuit ccs, _ := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, &circuit)
}
errors: /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /usr/bin/ld: cannot find -lbn254: No such file or directory collect2: error: ld returned 1 exit status
Should I download the article first and then compile it? Finally, to gnark/.../example and to execute "go run -tags=icicle main.go" What should I do?