bench: Option to skip commit2
This commit is contained in:
parent
1bc55714ed
commit
630df050c0
@ -13,16 +13,17 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
|
||||||
"github.com/filecoin-project/go-sectorbuilder/fs"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
"gopkg.in/urfave/cli.v2"
|
"gopkg.in/urfave/cli.v2"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
|
"github.com/filecoin-project/go-sectorbuilder/fs"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
@ -102,6 +103,10 @@ func main() {
|
|||||||
Name: "json-out",
|
Name: "json-out",
|
||||||
Usage: "output results in json format",
|
Usage: "output results in json format",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "skip-commit2",
|
||||||
|
Usage: "skip the commit2 (snark) portion of the benchmark",
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "skip-unseal",
|
Name: "skip-unseal",
|
||||||
Usage: "skip the unseal portion of the benchmark",
|
Usage: "skip the unseal portion of the benchmark",
|
||||||
@ -174,9 +179,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.Bool("skip-commit2") {
|
||||||
if err := paramfetch.GetParams(build.ParametersJson(), uint64(sectorSize)); err != nil {
|
if err := paramfetch.GetParams(build.ParametersJson(), uint64(sectorSize)); err != nil {
|
||||||
return xerrors.Errorf("getting params: %w", err)
|
return xerrors.Errorf("getting params: %w", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sbfs := &fs.Basic{
|
sbfs := &fs.Basic{
|
||||||
Miner: maddr,
|
Miner: maddr,
|
||||||
@ -269,13 +276,18 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proof, err := sb.SealCommit2(context.TODO(), i, c1o)
|
var proof storage.Proof
|
||||||
|
if !c.Bool("skip-commit2") {
|
||||||
|
proof, err = sb.SealCommit2(context.TODO(), i, c1o)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sealcommit2 := time.Now()
|
sealcommit2 := time.Now()
|
||||||
|
|
||||||
|
if !c.Bool("skip-commit2") {
|
||||||
|
|
||||||
svi := abi.SealVerifyInfo{
|
svi := abi.SealVerifyInfo{
|
||||||
SectorID: abi.SectorID{Miner: mid, Number: i},
|
SectorID: abi.SectorID{Miner: mid, Number: i},
|
||||||
OnChain: abi.OnChainSealVerifyInfo{
|
OnChain: abi.OnChainSealVerifyInfo{
|
||||||
@ -299,11 +311,13 @@ func main() {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return xerrors.Errorf("porep proof for sector %d was invalid", i)
|
return xerrors.Errorf("porep proof for sector %d was invalid", i)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
verifySeal := time.Now()
|
verifySeal := time.Now()
|
||||||
|
|
||||||
if !c.Bool("skip-unseal") {
|
if !c.Bool("skip-unseal") {
|
||||||
log.Info("Unsealing sector")
|
log.Info("Unsealing sector")
|
||||||
|
// TODO: RM unsealed sector first
|
||||||
rc, err := sb.ReadPieceFromSealedSector(context.TODO(), 1, 0, abi.UnpaddedPieceSize(sectorSize), ticket, commD)
|
rc, err := sb.ReadPieceFromSealedSector(context.TODO(), 1, 0, abi.UnpaddedPieceSize(sectorSize), ticket, commD)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -359,6 +373,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bo := BenchResults{
|
||||||
|
SectorSize: sectorSize,
|
||||||
|
SealingResults: sealTimings,
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.Bool("skip-commit2") {
|
||||||
log.Info("generating election post candidates")
|
log.Info("generating election post candidates")
|
||||||
fcandidates, err := sb.GenerateEPostCandidates(sealedSectors, challenge[:], []abi.SectorNumber{})
|
fcandidates, err := sb.GenerateEPostCandidates(sealedSectors, challenge[:], []abi.SectorNumber{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -427,16 +447,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
verifypost2 := time.Now()
|
verifypost2 := time.Now()
|
||||||
|
|
||||||
bo := BenchResults{
|
bo.PostGenerateCandidates = gencandidates.Sub(beforePost)
|
||||||
SectorSize: sectorSize,
|
bo.PostEProofCold = epost1.Sub(gencandidates)
|
||||||
SealingResults: sealTimings,
|
bo.PostEProofHot = epost2.Sub(epost1)
|
||||||
|
bo.VerifyEPostCold = verifypost1.Sub(epost2)
|
||||||
|
bo.VerifyEPostHot = verifypost2.Sub(verifypost1)
|
||||||
|
}
|
||||||
|
|
||||||
PostGenerateCandidates: gencandidates.Sub(beforePost),
|
|
||||||
PostEProofCold: epost1.Sub(gencandidates),
|
|
||||||
PostEProofHot: epost2.Sub(epost1),
|
|
||||||
VerifyEPostCold: verifypost1.Sub(epost2),
|
|
||||||
VerifyEPostHot: verifypost2.Sub(verifypost1),
|
|
||||||
} // TODO: optionally write this as json to a file
|
|
||||||
|
|
||||||
if c.Bool("json-out") {
|
if c.Bool("json-out") {
|
||||||
data, err := json.MarshalIndent(bo, "", " ")
|
data, err := json.MarshalIndent(bo, "", " ")
|
||||||
@ -446,7 +463,7 @@ func main() {
|
|||||||
|
|
||||||
fmt.Println(string(data))
|
fmt.Println(string(data))
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("----\nresults (v23) (%d)\n", sectorSize)
|
fmt.Printf("----\nresults (v24) (%d)\n", sectorSize)
|
||||||
if robench == "" {
|
if robench == "" {
|
||||||
fmt.Printf("seal: addPiece: %s (%s)\n", bo.SealingResults[0].AddPiece, bps(bo.SectorSize, bo.SealingResults[0].AddPiece)) // TODO: average across multiple sealings
|
fmt.Printf("seal: addPiece: %s (%s)\n", bo.SealingResults[0].AddPiece, bps(bo.SectorSize, bo.SealingResults[0].AddPiece)) // TODO: average across multiple sealings
|
||||||
fmt.Printf("seal: preCommit phase 1: %s (%s)\n", bo.SealingResults[0].PreCommit1, bps(bo.SectorSize, bo.SealingResults[0].PreCommit1))
|
fmt.Printf("seal: preCommit phase 1: %s (%s)\n", bo.SealingResults[0].PreCommit1, bps(bo.SectorSize, bo.SealingResults[0].PreCommit1))
|
||||||
@ -458,12 +475,14 @@ func main() {
|
|||||||
fmt.Printf("unseal: %s (%s)\n", bo.SealingResults[0].Unseal, bps(bo.SectorSize, bo.SealingResults[0].Unseal))
|
fmt.Printf("unseal: %s (%s)\n", bo.SealingResults[0].Unseal, bps(bo.SectorSize, bo.SealingResults[0].Unseal))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !c.Bool("skip-commit2") {
|
||||||
fmt.Printf("generate candidates: %s (%s)\n", bo.PostGenerateCandidates, bps(bo.SectorSize*abi.SectorSize(len(bo.SealingResults)), bo.PostGenerateCandidates))
|
fmt.Printf("generate candidates: %s (%s)\n", bo.PostGenerateCandidates, bps(bo.SectorSize*abi.SectorSize(len(bo.SealingResults)), bo.PostGenerateCandidates))
|
||||||
fmt.Printf("compute epost proof (cold): %s\n", bo.PostEProofCold)
|
fmt.Printf("compute epost proof (cold): %s\n", bo.PostEProofCold)
|
||||||
fmt.Printf("compute epost proof (hot): %s\n", bo.PostEProofHot)
|
fmt.Printf("compute epost proof (hot): %s\n", bo.PostEProofHot)
|
||||||
fmt.Printf("verify epost proof (cold): %s\n", bo.VerifyEPostCold)
|
fmt.Printf("verify epost proof (cold): %s\n", bo.VerifyEPostCold)
|
||||||
fmt.Printf("verify epost proof (hot): %s\n", bo.VerifyEPostHot)
|
fmt.Printf("verify epost proof (hot): %s\n", bo.VerifyEPostHot)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user