Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: api: Make ClientCalcCommP multithreaded #8276

Merged
merged 2 commits into from
Mar 10, 2022

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented Mar 9, 2022

Related Issues

Proposed Changes

Make ClientCalcCommP a lot faster

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • All commits have a clear commit message.
  • The PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

@magik6k magik6k requested a review from a team as a code owner March 9, 2022 22:26
@@ -1295,16 +1278,20 @@ func (a *API) ClientCalcCommP(ctx context.Context, inpath string) (*api.CommPRet
return nil, xerrors.Errorf("seek to start: %w", err)
}

pieceReader, pieceSize := padreader.New(rdr, uint64(stat.Size()))
commP, err := ffiwrapper.GeneratePieceCIDFromFile(arbitraryProofType, pieceReader, pieceSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of makes sense but I don't understand why this ffiwrapper thing exists and was called in the first place if the commp writer thing could just do a direct sum over the piece bytes in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The writer thing is relatively recent, and this API existed for quite some time before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the writer also calls FFI, it just does that from multiple threads for smaller chunks, then creates the top tree from them)

@codecov
Copy link

codecov bot commented Mar 10, 2022

Codecov Report

Merging #8276 (0d9e34d) into master (c192637) will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8276   +/-   ##
=======================================
  Coverage   40.51%   40.51%           
=======================================
  Files         675      675           
  Lines       73527    73526    -1     
=======================================
+ Hits        29788    29790    +2     
+ Misses      38515    38510    -5     
- Partials     5224     5226    +2     
Impacted Files Coverage Δ
node/impl/client/client.go 51.37% <0.00%> (+0.06%) ⬆️
miner/warmup.go 71.42% <0.00%> (-4.09%) ⬇️
storage/wdpost_sched.go 77.45% <0.00%> (-3.93%) ⬇️
chain/stmgr/call.go 71.51% <0.00%> (-3.64%) ⬇️
blockstore/autobatch.go 56.30% <0.00%> (-1.69%) ⬇️
chain/vm/vm.go 61.63% <0.00%> (-1.07%) ⬇️
storage/wdpost_changehandler.go 97.64% <0.00%> (-0.95%) ⬇️
extern/sector-storage/stores/local.go 59.16% <0.00%> (-0.84%) ⬇️
chain/messagepool/messagepool.go 63.15% <0.00%> (-0.62%) ⬇️
chain/store/store.go 63.66% <0.00%> (-0.50%) ⬇️
... and 13 more

@magik6k magik6k merged commit 81f0cfd into master Mar 10, 2022
@magik6k magik6k deleted the feat/faster-clientcalccommp branch March 10, 2022 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants