Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 9 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,38 +457,18 @@ jobs:
# Run the build script (creates and uses Python venv internally)
./build.sh

- name: Verify binaries
- name: Verify library
working-directory: extern/supraseal
run: |
echo "=== Built binaries ==="
ls -lh bin/
echo "=== Verifying library exists ==="
test -f obj/libsupraseal.a && echo "✓ libsupraseal.a created" || exit 1

echo ""
echo "=== Verifying binaries exist ==="
test -f bin/seal && echo "✓ seal binary created" || exit 1
test -f bin/pc2 && echo "✓ pc2 binary created" || exit 1
test -f bin/tree_r && echo "✓ tree_r binary created" || exit 1
test -f bin/tree_r_cpu && echo "✓ tree_r_cpu binary created" || exit 1
test -f bin/tree_d_cpu && echo "✓ tree_d_cpu binary created" || exit 1
echo "=== Library size ==="
du -h obj/libsupraseal.a

echo ""
echo "=== Binary sizes ==="
du -h bin/*

echo ""
echo "✅ All binaries built successfully!"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: supraseal-binaries-ubuntu24-gcc12-cuda
path: |
extern/supraseal/bin/seal
extern/supraseal/bin/pc2
extern/supraseal/bin/tree_r
extern/supraseal/bin/tree_r_cpu
extern/supraseal/bin/tree_d_cpu
retention-days: 30
echo "✅ Library built successfully!"

- name: Upload library artifact
uses: actions/upload-artifact@v4
Expand All @@ -506,12 +486,12 @@ jobs:
echo "- GCC: $(gcc --version | head -1)" >> $GITHUB_STEP_SUMMARY
echo "- CUDA: $(nvcc --version | grep release)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Built Binaries:**" >> $GITHUB_STEP_SUMMARY
echo "**Built Library:**" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
ls -lh extern/supraseal/bin/ >> $GITHUB_STEP_SUMMARY
ls -lh extern/supraseal/obj/libsupraseal.a >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ All binaries compiled successfully with GCC 12 and CUDA!" >> $GITHUB_STEP_SUMMARY
echo "✅ Library compiled successfully with GCC 12 and CUDA!" >> $GITHUB_STEP_SUMMARY

gen-check:
runs-on: ubuntu-latest
Expand Down
34 changes: 5 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ build/.supraseal-install: $(SUPRA_FFI_PATH)
cd $(SUPRA_FFI_PATH) && ./build.sh
@touch $@

BUILD_DEPS+=build/.supraseal-install
CLEAN+=build/.supraseal-install
endif

Expand Down Expand Up @@ -86,6 +87,10 @@ deps: $(BUILD_DEPS)

CURIO_TAGS ?= cunative

ifeq ($(shell uname),Linux)
curio: CGO_LDFLAGS_ALLOW='.*'
endif

curio: $(BUILD_DEPS)
rm -f curio
GOAMD64=v3 CGO_LDFLAGS_ALLOW=$(CGO_LDFLAGS_ALLOW) $(GOCC) build $(GOFLAGS) \
Expand All @@ -109,33 +114,6 @@ pdptool: $(BUILD_DEPS)
.PHONY: pdptool
BINS+=pdptool

ifeq ($(shell uname),Linux)

batchdep: build/.supraseal-install
batchdep: $(BUILD_DEPS)
.PHONY: batchdep

batch: CURIO_TAGS+= supraseal
batch: CGO_LDFLAGS_ALLOW='.*'
batch: batchdep batch-build
.PHONY: batch


batch-calibnet: CURIO_TAGS+= supraseal
batch-calibnet: CURIO_TAGS+= calibnet
batch-calibnet: CGO_LDFLAGS_ALLOW='.*'
batch-calibnet: batchdep batch-build
.PHONY: batch-calibnet

else
batch:
@echo "Batch target is only available on Linux systems"
@exit 1

batch-calibnet:
@echo "Batch-calibnet target is only available on Linux systems"
@exit 1
endif

calibnet: CURIO_TAGS+= calibnet
calibnet: build
Expand All @@ -155,8 +133,6 @@ an existing curio binary in your PATH. This may cause problems if you don't run

.PHONY: build

batch-build: curio
.PHONY: batch-build

calibnet-sptool: CURIO_TAGS+= calibnet
calibnet-sptool: sptool
Expand Down
69 changes: 69 additions & 0 deletions cmd/curio/batch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package main

import (
"fmt"

"github.com/urfave/cli/v2"
"golang.org/x/xerrors"

"github.com/filecoin-project/curio/cmd/curio/internal/translations"
"github.com/filecoin-project/curio/lib/supraffi"
)

var batchCmd = &cli.Command{
Name: "batch",
Usage: translations.T("Manage batch sealing operations"),
Subcommands: []*cli.Command{
batchSetupCmd,
},
}

var batchSetupCmd = &cli.Command{
Name: "setup",
Usage: translations.T("Setup SPDK for batch sealing (configures hugepages and binds NVMe devices)"),
Description: translations.T(`Setup SPDK for batch sealing operations.

This command automatically:
- Downloads SPDK if not already available
- Configures 1GB hugepages (36 pages minimum)
- Binds NVMe devices for use with SupraSeal

Requires root/sudo access for SPDK setup operations.`),
Flags: []cli.Flag{
&cli.IntFlag{
Name: "hugepages",
Usage: translations.T("Number of 1GB hugepages to configure"),
Value: 36,
},
&cli.IntFlag{
Name: "min-pages",
Usage: translations.T("Minimum number of hugepages required"),
Value: 36,
},
},
Action: func(cctx *cli.Context) error {
nrHuge := cctx.Int("hugepages")
minPages := cctx.Int("min-pages")

fmt.Println("Setting up SPDK for batch sealing...")
fmt.Printf("Configuring %d hugepages (minimum required: %d)\n", nrHuge, minPages)

err := supraffi.CheckAndSetupSPDK(nrHuge, minPages)
if err != nil {
return xerrors.Errorf("SPDK setup failed: %w\n\n"+
"Please ensure you have:\n"+
"1. Root/sudo access for SPDK setup\n"+
"2. Raw NVMe devices available (no filesystems on them)\n"+
"3. Sufficient hugepages configured (see documentation)", err)
}

fmt.Println("✓ SPDK setup completed successfully")
fmt.Println("\nNext steps:")
fmt.Println("1. Verify hugepages: cat /proc/meminfo | grep Huge")
fmt.Println("2. Configure your batch sealing layer (see documentation)")
fmt.Println("3. Start batch sealing operations")

return nil
},
}

1 change: 1 addition & 0 deletions cmd/curio/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func main() {
ffiCmd,
calcCmd,
toolboxCmd,
batchCmd,
}

jaeger := tracing.SetupJaegerTracing("curio")
Expand Down
32 changes: 26 additions & 6 deletions documentation/en/supraseal.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ CUDA 12.x is required, 11.x won't work. The build process depends on GCC 11.x sy
Build and install the batch-capable Curio binary:

```bash
make batch
make curio
make sptool
```

Expand All @@ -152,8 +152,8 @@ make install
For calibnet

```bash
make batch-calibnet
make batch-sptool
make calibnet
make calibnet-sptool
```

```shell
Expand All @@ -166,13 +166,33 @@ The build should be run on the target machine. Binaries won't be portable betwee

### Setup NVMe devices for SPDK:

{% hint style="info" %}
This is only needed while batch sealing is in beta, future versions of Curio will handle this automatically.
{% hint style="success" %}
SPDK setup can be done automatically using the Curio CLI command:
{% endhint %}

```bash
sudo curio batch setup
```

This command will:
- Download SPDK if not already available
- Configure 1GB hugepages (36 pages by default)
- Bind NVMe devices for use with SupraSeal

You can customize the number of hugepages:

```bash
sudo curio batch setup --hugepages 36 --min-pages 36
```

Alternatively, if you need to manually check SPDK status or unbind devices, you can use:

```bash
cd extern/supraseal/deps/spdk-v24.05/
env NRHUGE=36 ./scripts/setup.sh
# Check status
sudo ./scripts/setup.sh status
# Manually run setup (not normally needed)
sudo env NRHUGE=36 ./scripts/setup.sh
```

### Benchmark NVME IOPS
Expand Down
34 changes: 27 additions & 7 deletions documentation/zh/supraseal.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ Total : 8006785.90 31276.51 71.91 1
构建支持批处理的 Curio 二进制文件:

```bash
make batch
make curio
```

对于 calibnet:

```bash
make calibnet


make batch-calibnet
```

{% hint style="warning" %}
Expand Down Expand Up @@ -307,13 +307,33 @@ Hugepagesize: 1048576 kB
### Setup NVMe devices for SPDK:
### 为SPDK设置NVMe设备:

{% hint style="info" %}
这只在批量密封处于测试阶段时需要,Curio的未来版本将自动处理这个问题。
{% hint style="success" %}
可以使用 Curio CLI 命令自动完成 SPDK 设置:
{% endhint %}

```bash
sudo curio batch setup
```

此命令将:
- 如果尚未可用,则下载 SPDK
- 配置 1GB 大页面(默认 36 页)
- 绑定 NVMe 设备以供 SupraSeal 使用

您可以自定义大页面数量:

```bash
sudo curio batch setup --hugepages 36 --min-pages 36
```

或者,如果您需要手动检查 SPDK 状态或解绑设备,可以使用:

```bash
cd extern/supraseal/deps/spdk-v24.05/
env NRHUGE=36 ./scripts/setup.sh
# 检查状态
sudo ./scripts/setup.sh status
# 手动运行设置(通常不需要)
sudo env NRHUGE=36 ./scripts/setup.sh
```


Expand Down
2 changes: 1 addition & 1 deletion extern/supraseal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ During the build process it will clone and build SPDK, sppark, and blst.
./build.sh
```

SPDK must be setup after every reboot:
SPDK setup is automatic when using Curio's batch sealer.
```
cd deps/spdk-v24.05
sudo env NRHUGE=36 ./scripts/setup.sh
Expand Down
Loading
Loading