- Implement SynorStorage class for decentralized storage operations including upload, download, pinning, and CAR file management. - Create supporting types and models for storage operations such as UploadOptions, Pin, and StorageConfig. - Implement SynorWallet class for wallet operations including wallet creation, address generation, transaction signing, and balance queries. - Create supporting types and models for wallet operations such as Wallet, Address, and Transaction. - Introduce error handling for both storage and wallet operations.
67 lines
1.7 KiB
Rust
67 lines
1.7 KiB
Rust
//! Synor Compute SDK for Rust
|
|
//!
|
|
//! Access distributed heterogeneous compute resources (CPU, GPU, TPU, NPU, LPU, FPGA, DSP)
|
|
//! for AI/ML workloads at 90% cost reduction compared to traditional cloud.
|
|
//!
|
|
//! # Quick Start
|
|
//!
|
|
//! ```rust,no_run
|
|
//! use synor_compute::{SynorCompute, Tensor, ProcessorType, Precision};
|
|
//!
|
|
//! #[tokio::main]
|
|
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
//! // Create client
|
|
//! let client = SynorCompute::new("your-api-key");
|
|
//!
|
|
//! // Matrix multiplication on GPU
|
|
//! let a = Tensor::rand(&[512, 512]);
|
|
//! let b = Tensor::rand(&[512, 512]);
|
|
//! let result = client.matmul(&a, &b)
|
|
//! .precision(Precision::FP16)
|
|
//! .processor(ProcessorType::GPU)
|
|
//! .send()
|
|
//! .await?;
|
|
//!
|
|
//! if result.is_success() {
|
|
//! println!("Time: {}ms", result.execution_time_ms.unwrap_or(0));
|
|
//! }
|
|
//!
|
|
//! // LLM inference
|
|
//! let response = client.inference("llama-3-70b", "Explain quantum computing")
|
|
//! .send()
|
|
//! .await?;
|
|
//! println!("{}", response.result.unwrap_or_default());
|
|
//!
|
|
//! // Streaming inference
|
|
//! use futures::StreamExt;
|
|
//! let mut stream = client.inference_stream("llama-3-70b", "Write a poem").await?;
|
|
//! while let Some(token) = stream.next().await {
|
|
//! print!("{}", token?);
|
|
//! }
|
|
//!
|
|
//! Ok(())
|
|
//! }
|
|
//! ```
|
|
|
|
mod types;
|
|
mod tensor;
|
|
mod client;
|
|
mod error;
|
|
|
|
pub mod wallet;
|
|
pub mod rpc;
|
|
pub mod storage;
|
|
pub mod database;
|
|
pub mod hosting;
|
|
pub mod bridge;
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|
|
|
|
pub use types::*;
|
|
pub use tensor::Tensor;
|
|
pub use client::SynorCompute;
|
|
pub use error::{Error, Result};
|
|
|
|
/// SDK version
|
|
pub const VERSION: &str = "0.1.0";
|