Skip to content
Merged
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
557 changes: 310 additions & 247 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ ndarray = "0.16"
anyhow = "1"
cxx = "1"
cxx-build = "1"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "native-tls"] }
reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] }
tar = "0.4"
flate2 = "1"
bzip2 = "0.4"
sha2 = "0.10"
dirs = "6"
petgraph = "0.6"

pecos-core = { version = "0.1.1", path = "crates/pecos-core" }
pecos-qsim = { version = "0.1.1", path = "crates/pecos-qsim" }
Expand Down
1 change: 1 addition & 0 deletions crates/pecos-build-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ sha2.workspace = true
dirs.workspace = true
tar.workspace = true
flate2.workspace = true
bzip2.workspace = true
49 changes: 49 additions & 0 deletions crates/pecos-build-utils/src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ pub const CHROMOBIUS_COMMIT: &str = "35e289570fdc1d71e73582e1fd4e0c8e29298ef5";
pub const CHROMOBIUS_SHA256: &str =
"da73d819e67572065fd715db45fabb342c2a2a1e961d2609df4f9864b9836054";

/// Qulacs library constants
/// Used by Qulacs quantum simulator
pub const QULACS_VERSION: &str = "0.6.12";
pub const QULACS_SHA256: &str = "b9e5422e0bb2b07725b0c62f7827326b5a1486facb30cf68d12b4ef119c485e9";

/// Eigen library constants
/// Used by Qulacs quantum simulator
pub const EIGEN_VERSION: &str = "3.4.0";
pub const EIGEN_SHA256: &str = "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72";

/// Boost library constants
/// Used by Qulacs quantum simulator (for property_tree and dynamic_bitset)
pub const BOOST_VERSION: &str = "1.83.0";
pub const BOOST_SHA256: &str = "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e";

/// Helper functions to create DownloadInfo structs for each dependency
use crate::DownloadInfo;

Expand Down Expand Up @@ -82,3 +97,37 @@ pub fn chromobius_download_info() -> DownloadInfo {
name: format!("chromobius-{}", &CHROMOBIUS_COMMIT[..8]),
}
}

/// Create DownloadInfo for Qulacs
pub fn qulacs_download_info() -> DownloadInfo {
DownloadInfo {
url: format!("https://github.com/qulacs/qulacs/archive/v{QULACS_VERSION}.tar.gz"),
sha256: QULACS_SHA256,
name: format!("qulacs-{}", QULACS_VERSION),
}
}

/// Create DownloadInfo for Eigen
pub fn eigen_download_info() -> DownloadInfo {
DownloadInfo {
url: format!(
"https://gitlab.com/libeigen/eigen/-/archive/{}/eigen-{}.tar.gz",
EIGEN_VERSION, EIGEN_VERSION
),
sha256: EIGEN_SHA256,
name: format!("eigen-{}", EIGEN_VERSION),
}
}

/// Create DownloadInfo for Boost
pub fn boost_download_info() -> DownloadInfo {
let version_underscore = BOOST_VERSION.replace('.', "_");
DownloadInfo {
url: format!(
"https://archives.boost.io/release/{}/source/boost_{}.tar.bz2",
BOOST_VERSION, version_underscore
),
sha256: BOOST_SHA256,
name: format!("boost-{}", BOOST_VERSION),
}
}
21 changes: 17 additions & 4 deletions crates/pecos-build-utils/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,30 @@ use crate::errors::{BuildError, Result};
use std::fs;
use std::path::{Path, PathBuf};

/// Extract a tar.gz archive and emit rerun-if-changed for all extracted files
/// Extract a tar.gz or tar.bz2 archive and emit rerun-if-changed for all extracted files
pub fn extract_archive(
data: &[u8],
out_dir: &Path,
expected_dir_name: Option<&str>,
) -> Result<PathBuf> {
use flate2::read::GzDecoder;
use tar::Archive;

let tar = GzDecoder::new(data);
let mut archive = Archive::new(tar);
// Try to detect if this is gzip or bzip2 by checking magic bytes
let mut archive = if data.len() >= 3 && data[0] == 0x1f && data[1] == 0x8b && data[2] == 0x08 {
// gzip magic bytes
use flate2::read::GzDecoder;
let tar = GzDecoder::new(data);
Archive::new(Box::new(tar) as Box<dyn std::io::Read>)
} else if data.len() >= 3 && &data[0..3] == b"BZh" {
// bzip2 magic bytes
use bzip2::read::BzDecoder;
let tar = BzDecoder::new(data);
Archive::new(Box::new(tar) as Box<dyn std::io::Read>)
} else {
return Err(BuildError::Archive(
"Unknown archive format - not gzip or bzip2".to_string(),
));
};

// Extract to temporary directory first
let temp_dir = out_dir.join(format!("extract_temp_{}", std::process::id()));
Expand Down
3 changes: 0 additions & 3 deletions crates/pecos-cppsparsesim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ readme = "README.md"

[dependencies]
cxx.workspace = true
pecos-core.workspace = true
pecos-qsim.workspace = true
rand.workspace = true
rand_chacha.workspace = true

[build-dependencies]
cxx-build.workspace = true
Expand Down
3 changes: 0 additions & 3 deletions crates/pecos-decoders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ default = []
ldpc = ["dep:pecos-ldpc-decoders"]
all = ["ldpc"]

[dev-dependencies]
ndarray.workspace = true

[lib]
name = "pecos_decoders"

Expand Down
1 change: 0 additions & 1 deletion crates/pecos-ldpc-decoders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ cxx.workspace = true
[build-dependencies]
pecos-build-utils.workspace = true
cxx-build.workspace = true
cc.workspace = true

[dev-dependencies]
rand.workspace = true
Expand Down
35 changes: 35 additions & 0 deletions crates/pecos-qulacs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "pecos-qulacs"
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Qulacs quantum simulator bindings for PECOS"
readme.workspace = true

[dependencies]
pecos-core.workspace = true
pecos-qsim.workspace = true
num-complex.workspace = true
rand.workspace = true
rand_chacha.workspace = true
cxx.workspace = true


[dev-dependencies]
rand.workspace = true

[build-dependencies]
cxx-build.workspace = true
pecos-build-utils.workspace = true
cc = "1.0"

[lib]
name = "pecos_qulacs"

[lints]
workspace = true
Loading
Loading