Skip to content

Commit

Permalink
Merge pull request #1001 from ipfs-force-community/fix/0x5459/cargo.toml
Browse files Browse the repository at this point in the history
fix(dep): conditional compilation errors
  • Loading branch information
LinZexiao authored Oct 19, 2023
2 parents afff2bc + b497f22 commit 228b552
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions damocles-worker/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 28 additions & 2 deletions damocles-worker/src/bin/damocles-worker/processor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[allow(unused_imports)]
use anyhow::{Context, Result};
use clap::Subcommand;
#[allow(unused_imports)]
use vc_processors::{
builtin::{
processors::{BuiltinProcessor, TransferProcessor},
Expand All @@ -14,17 +16,26 @@ use vc_processors::{
core::ext::{run_consumer, run_consumer_with_proc},
};

#[cfg(any(feature = "supra-c2", feature = "cuda-supraseal"))]
#[cfg(all(
feature = "fil-proofs",
any(feature = "supra-c2", feature = "cuda-supraseal")
))]
const C2_ABOUT: &str = "damocles-worker built-in c2 [supra c2 enabled]";
#[cfg(not(any(feature = "supra-c2", feature = "cuda-supraseal")))]
#[cfg(all(
feature = "fil-proofs",
not(any(feature = "supra-c2", feature = "cuda-supraseal"))
))]
const C2_ABOUT: &str = "damocles-worker built-in c2";

#[derive(Subcommand)]
pub enum ProcessorCommand {
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_ADD_PIECES)]
AddPieces,
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_TREED)]
TreeD,
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_PC1)]
PC1 {
/// Specify the path to the hugepage memory file and scan the hugepage memory files
Expand Down Expand Up @@ -55,31 +66,40 @@ pub enum ProcessorCommand {
)]
hugepage_files_path_pattern: Option<String>,
},
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_PC2)]
PC2,
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_C2, about=C2_ABOUT)]
C2,
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_SNAP_ENCODE)]
SnapEncode,
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_SNAP_PROVE)]
SnapProve,
#[command(name=STAGE_NAME_TRANSFER)]
Transfer {
#[arg(long, alias = "disable_link", env = "DISABLE_LINK")]
disable_link: bool,
},
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_WINDOW_POST)]
WindowPoSt,
#[cfg(feature = "fil-proofs")]
#[command(name=STAGE_NAME_WINNING_POST)]
WinningPoSt,
}

pub(crate) fn run(cmd: &ProcessorCommand) -> Result<()> {
match cmd {
#[cfg(feature = "fil-proofs")]
ProcessorCommand::AddPieces => {
run_consumer::<AddPieces, BuiltinProcessor>()
}
#[cfg(feature = "fil-proofs")]
ProcessorCommand::TreeD => run_consumer::<TreeD, BuiltinProcessor>(),
#[cfg(feature = "fil-proofs")]
ProcessorCommand::PC1 {
hugepage_files_path,
hugepage_files_path_pattern,
Expand Down Expand Up @@ -108,11 +128,15 @@ pub(crate) fn run(cmd: &ProcessorCommand) -> Result<()> {

run_consumer::<PC1, BuiltinProcessor>()
}
#[cfg(feature = "fil-proofs")]
ProcessorCommand::PC2 => run_consumer::<PC2, BuiltinProcessor>(),
#[cfg(feature = "fil-proofs")]
ProcessorCommand::C2 => run_consumer::<C2, BuiltinProcessor>(),
#[cfg(feature = "fil-proofs")]
ProcessorCommand::SnapEncode => {
run_consumer::<SnapEncode, BuiltinProcessor>()
}
#[cfg(feature = "fil-proofs")]
ProcessorCommand::SnapProve => {
run_consumer::<SnapProve, BuiltinProcessor>()
}
Expand All @@ -122,9 +146,11 @@ pub(crate) fn run(cmd: &ProcessorCommand) -> Result<()> {
*disable_link,
))
}
#[cfg(feature = "fil-proofs")]
ProcessorCommand::WindowPoSt => {
run_consumer::<WindowPoSt, BuiltinProcessor>()
}
#[cfg(feature = "fil-proofs")]
ProcessorCommand::WinningPoSt => {
run_consumer::<WinningPoSt, BuiltinProcessor>()
}
Expand Down
6 changes: 3 additions & 3 deletions damocles-worker/vc-processors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ fnv = "1.0.7"
nix = { workspace = true }
libc = { workspace = true }

[target.'cfg(target_os = "linux")'.dependencies]
cgroups-rs = "0.3"

filecoin-proofs = { version = "16.0", default-features = false, features = [
"opencl",
"multicore-sdr",
Expand All @@ -46,6 +43,9 @@ filecoin-proofs-api = { version = "16.0", default-features = false, features = [
storage-proofs-core = { version = "16.0", optional = true }
storage-proofs-porep = { version = "16.0", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
cgroups-rs = "0.3"

[dev-dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-test = "0.2"
Expand Down

0 comments on commit 228b552

Please sign in to comment.