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

Supranational brownfield PC2 <> Lotus-Miner #10983

Closed
7 of 8 tasks
Tracked by #10340
rjan90 opened this issue Jun 14, 2023 · 5 comments · Fixed by #11185
Closed
7 of 8 tasks
Tracked by #10340

Supranational brownfield PC2 <> Lotus-Miner #10983

rjan90 opened this issue Jun 14, 2023 · 5 comments · Fixed by #11185
Assignees

Comments

@rjan90
Copy link
Contributor

rjan90 commented Jun 14, 2023

WIP tracking issue for implementing Supranational brownfield PC2 as a drop-in replacement for the current PC2 sealing proof in Lotus-Miner.

User story:

  • As a storage provider (SP) I want to utilize the highly optimized brownfield PC2 sealing proofs from SupraNational, so that I can experience reduced energy consumption and hardware needs while achieving significant improvements in sealing times for the PC2 tasks (estimated 70%+ reduction) without compromising compatibility with deal-sectors, CC-sectors or sector sizes applicable on the Filecoin mainnet.

Acceptence criteria:

  • Must be usable with both 32 GiB and 64 GiB sector sizes
  • Must be usable with both deal- and CC-sectors
  • Check that the user has CUDA enabled when trying to use Supranational brownfield PC2

Techincal scope

Techincal breakdown:

Testing breakdown:

  1. rjan90

Tippy, Reiers will help out with the testing and documentation ^^

Benchmarks/estimated improvements with 32GiB CC-sectors:

GPU-model Current PC2 proofs Supranational brownfield PC2
RTX 3090 8m 2m
RTX 6000 Ada 5m38s 1m15s
RTX A2000 (70W) no benchmark 7m40s

Please note that these benchmarks was done with CC-sectors. When the Supranational brownfield PC2 proofs supports deal data that might lead to slower benchmarks, although this slowdown is estimated to be minimal.

@rjan90 rjan90 changed the title [Epic] Supranational brownfield PC2 <> Lotus-Miner: Supranational brownfield PC2 <> Lotus-Miner: Jun 14, 2023
@rjan90 rjan90 changed the title Supranational brownfield PC2 <> Lotus-Miner: Supranational brownfield PC2 <> Lotus-Miner Jun 14, 2023
@rjan90 rjan90 added this to the Sealing Improvements milestone Jun 20, 2023
@vmx
Copy link
Contributor

vmx commented Jun 21, 2023

Ability to pass in any arbitrary sealed unsealed file in brownfield PC2 binary

This was fixed upstream by Supranation. With the latest version of https://github.com/supranational/supra_seal there is a pc2 binary that works on the unsealed file. So you pass in the unsealed file, the directory with the SDR layers (the output of PC1), and the where the output should be stored. It will then produce TreeC, TreeR and the sealed file (called sealed-file).

You would run it as:

./bin/pc2 -d /tmp/window-post-32gib-dir/staged-file -i /tmp/window-post-32gib-dir -o /tmp/pc2_output

Building just the pc2 binary is not straight forward, hence here's a stripped down version of the build.sh:

#!/bin/bash

# Copyright Supranational LLC

set -e
set -x

SECTOR_SIZE="-DSECTOR_SIZE_32GiB"
if [ "$1" == "512MiB" ]; then
    SECTOR_SIZE="-DSECTOR_SIZE_512MiB"
fi

NVCC=${NVCC:-nvcc}

# Check for the default result directory
if [ ! -d "/tmp/supra_seal" ]; then
    mkdir -p /tmp/supra_seal
fi

rm -fr obj
mkdir -p obj

rm -fr bin
mkdir -p bin

mkdir -p deps
if [ ! -d "deps/sppark" ]; then
    git clone https://github.com/supranational/sppark.git deps/sppark
fi
if [ ! -d "deps/blst" ]; then
    git clone https://github.com/supranational/blst.git deps/blst
    (cd deps/blst
     ./build.sh -D__ADX__)
fi

# Generate .h files for the Poseidon constants
xxd -i poseidon/constants/constants_2  > obj/constants_2.h
xxd -i poseidon/constants/constants_4  > obj/constants_4.h
xxd -i poseidon/constants/constants_8  > obj/constants_8.h
xxd -i poseidon/constants/constants_11 > obj/constants_11.h
xxd -i poseidon/constants/constants_16 > obj/constants_16.h
xxd -i poseidon/constants/constants_24 > obj/constants_24.h
xxd -i poseidon/constants/constants_36 > obj/constants_36.h

# Standalone GPU pc2
$NVCC -std=c++17 $SECTOR_SIZE -DNO_SPDK -DSTREAMING_NODE_READER_FILES \
     -g -Xcompiler -Wall -Xcompiler -Wextra -Xcompiler -Werror \
     -Xcompiler -Wno-subobject-linkage -Xcompiler -Wno-unused-parameter \
     -Xcompiler -march=native -O3 \
     -x cu tools/pc2.cu -o bin/pc2 \
     -Iposeidon -Ideps/sppark -Ideps/sppark/util -Ideps/blst/src -L deps/blst -lblst -lconfig++

@jennijuju
Copy link
Member

  • I would like a brief "expected/estimated improvement" in the user story to justify why we prioritize this.
  • for the testing plan, i think we should also confirm such sector can be successfully snapped too

@rjan90
Copy link
Contributor Author

rjan90 commented Jul 4, 2023

Added estimate in the userstory here:

achieving significant improvements in sealing times for the PC2 tasks (estimated 70%+ reduction)

Added an item in the testing plan snapping a sealed sector with SupraSeal PC2 code.

@jennijuju
Copy link
Member

Allow lotus-workers to use the SupraSeal PC2-binary

What's the work needed in lotus to enable this? Worth asking this question: who's the audience of this issue?

  • If its for eng to be able to pick up the issue and implement: @snadrus @shrenujbansal will you be able to take on this issue as its written?
  • If its for TPM: I won't be able to engage in effort esitiamtion given lack of info.

@jennijuju
Copy link
Member

@rjan90 Amazing work on the testing breakdown!

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 a pull request may close this issue.

6 participants