add synthPoRep support to bench simple

This commit is contained in:
Łukasz Magiera 2023-07-18 10:27:40 -07:00
parent c4b469bf86
commit 7adf8237f6
2 changed files with 34 additions and 18 deletions

View File

@ -334,7 +334,7 @@ var sealBenchCmd = &cli.Command{
if !skipc2 { if !skipc2 {
log.Info("generating winning post candidates") log.Info("generating winning post candidates")
wipt, err := spt(sectorSize).RegisteredWinningPoStProof() wipt, err := spt(sectorSize, false).RegisteredWinningPoStProof()
if err != nil { if err != nil {
return err return err
} }
@ -552,7 +552,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
Miner: mid, Miner: mid,
Number: i, Number: i,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, false),
} }
start := time.Now() start := time.Now()
@ -584,7 +584,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
Miner: mid, Miner: mid,
Number: i, Number: i,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, false),
} }
start := time.Now() start := time.Now()
@ -795,7 +795,7 @@ var proveCmd = &cli.Command{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(c2in.SectorNum), Number: abi.SectorNumber(c2in.SectorNum),
}, },
ProofType: spt(abi.SectorSize(c2in.SectorSize)), ProofType: spt(abi.SectorSize(c2in.SectorSize), false),
} }
fmt.Printf("----\nstart proof computation\n") fmt.Printf("----\nstart proof computation\n")
@ -826,8 +826,8 @@ func bps(sectorSize abi.SectorSize, sectorNum int, d time.Duration) string {
return types.SizeStr(types.BigInt{Int: bps}) + "/s" return types.SizeStr(types.BigInt{Int: bps}) + "/s"
} }
func spt(ssize abi.SectorSize) abi.RegisteredSealProof { func spt(ssize abi.SectorSize, synth bool) abi.RegisteredSealProof {
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion, false) spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion, synth)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -181,7 +181,7 @@ var simpleAddPiece = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, false),
} }
data, err := os.Open(cctx.Args().First()) data, err := os.Open(cctx.Args().First())
@ -218,6 +218,10 @@ var simplePreCommit1 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)", Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000", Value: "t01000",
}, },
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
}, },
ArgsUsage: "[unsealed] [sealed] [cache] [[piece cid] [piece size]]...", ArgsUsage: "[unsealed] [sealed] [cache] [[piece cid] [piece size]]...",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
@ -254,7 +258,7 @@ var simplePreCommit1 = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, cctx.Bool("synthetic")),
} }
var ticket [32]byte // all zero var ticket [32]byte // all zero
@ -292,6 +296,10 @@ var simplePreCommit2 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)", Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000", Value: "t01000",
}, },
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
}, },
ArgsUsage: "[sealed] [cache] [pc1 out]", ArgsUsage: "[sealed] [cache] [pc1 out]",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
@ -332,7 +340,7 @@ var simplePreCommit2 = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, cctx.Bool("synthetic")),
} }
start := time.Now() start := time.Now()
@ -363,6 +371,10 @@ var simpleCommit1 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)", Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000", Value: "t01000",
}, },
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
}, },
ArgsUsage: "[sealed] [cache] [comm D] [comm R] [c1out.json]", ArgsUsage: "[sealed] [cache] [comm D] [comm R] [c1out.json]",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
@ -398,7 +410,7 @@ var simpleCommit1 = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, cctx.Bool("synthetic")),
} }
start := time.Now() start := time.Now()
@ -464,6 +476,10 @@ var simpleCommit2 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)", Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000", Value: "t01000",
}, },
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
}, },
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
if c.Bool("no-gpu") { if c.Bool("no-gpu") {
@ -510,7 +526,7 @@ var simpleCommit2 = &cli.Command{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(c2in.SectorNum), Number: abi.SectorNumber(c2in.SectorNum),
}, },
ProofType: spt(abi.SectorSize(c2in.SectorSize)), ProofType: spt(abi.SectorSize(c2in.SectorSize), c.Bool("synthetic")),
} }
start := time.Now() start := time.Now()
@ -568,7 +584,7 @@ var simpleWindowPost = &cli.Command{
return xerrors.Errorf("parse commr: %w", err) return xerrors.Errorf("parse commr: %w", err)
} }
wpt, err := spt(sectorSize).RegisteredWindowPoStProof() wpt, err := spt(sectorSize, false).RegisteredWindowPoStProof()
if err != nil { if err != nil {
return err return err
} }
@ -588,7 +604,7 @@ var simpleWindowPost = &cli.Command{
vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{ vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{
SectorInfo: prf.SectorInfo{ SectorInfo: prf.SectorInfo{
SealProof: spt(sectorSize), SealProof: spt(sectorSize, false),
SectorNumber: sn, SectorNumber: sn,
SealedCID: commr, SealedCID: commr,
}, },
@ -655,7 +671,7 @@ var simpleWinningPost = &cli.Command{
return xerrors.Errorf("parse commr: %w", err) return xerrors.Errorf("parse commr: %w", err)
} }
wpt, err := spt(sectorSize).RegisteredWinningPoStProof() wpt, err := spt(sectorSize, false).RegisteredWinningPoStProof()
if err != nil { if err != nil {
return err return err
} }
@ -675,7 +691,7 @@ var simpleWinningPost = &cli.Command{
vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{ vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{
SectorInfo: prf.SectorInfo{ SectorInfo: prf.SectorInfo{
SealProof: spt(sectorSize), SealProof: spt(sectorSize, false),
SectorNumber: sn, SectorNumber: sn,
SealedCID: commr, SealedCID: commr,
}, },
@ -758,7 +774,7 @@ var simpleReplicaUpdate = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, false),
} }
start := time.Now() start := time.Now()
@ -826,7 +842,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, false),
} }
start := time.Now() start := time.Now()
@ -913,7 +929,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
}, },
ProofType: spt(sectorSize), ProofType: spt(sectorSize, false),
} }
start := time.Now() start := time.Now()