camure

Crates.iocamure
lib.rscamure
version
sourcesrc
created_at2024-11-27 13:55:05.156662
updated_at2024-12-01 21:02:46.252247
descriptionHigh-performance 1-to-many communication and synchronization primitives using UDP multicast.
homepagehttps://github.com/soehrl/camure
repositoryhttps://github.com/soehrl/camure
max_upload_size
id1463098
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Simon Oehrl (soehrl)

documentation

README

Camure

High-performance 1-to-many communication and synchronization primitives using UDP multicast.

This crates provides a set of communication and synchronization primitives similar to the collective communication routines found in MPI. In contrast to MPI, this crates allows for more flexible communication patterns without sacrificing performance and is designed to be used in mid-sized distributed systems. The underlying protocol is session based which allows nodes to join and leave at any time. One node explicitly takes over the role of the session coordinator and is responsible for creating the session. All other nodes must join the session as a member.

Getting Started

If you use Rust you can add camure as dependency using:

cargo add camure

If you want to use the library from languages other than Rust, please take a look at camure-ffi.

Below are a few examples that will get you started quickly. The full documentation can be found here.

Barrier Groups

Coordinator

use camure::session::Coordinator;

let bind_addr = "192.168.0.100:12345".parse()?;
let multicast_addr = "234.0.0.0:55555".parse()?;
let coordinator = Coordinator::start_session(bind_addr, multicast_addr)?;
 
let mut barrier_group_coordinator = coordinator.create_barrier_group(Some(0))?;
barrier_group_coordinator.accept()?;
 
for _ in 0..1000 {
    barrier_group_coordinator.wait()?;
}

Member

use camure::session::Member;

let coordinator_addr = "192.168.0.100:12345".parse()?;
let member = Member::join_session(coordinator_addr)?;

let mut barrier_group_member = member.join_barrier_group(0)?;
for _ in 0..1000 {
    barrier_group_member.wait()?;
}

Broadcast Groups

Coordinator

use camure::session::Coordinator;
use std::io::Write;

let bind_addr = "192.168.0.100:12345".parse()?;
let multicast_addr = "234.0.0.0:55555".parse()?;
let coordinator = Coordinator::start_session(bind_addr, multicast_addr)?;
 
let mut sender = coordinator.create_broadcast_group(Some(0))?;
sender.accept().unwrap();

for _ in 0..1000 {
    sender.write_message().write_all(b"SOME DATA")?;
}
sender.wait()?;

Member

use camure::session::Member;
use std::io::Read;

let coordinator_addr = "192.168.0.100:12345".parse()?;
let member = Member::join_session(coordinator_addr)?;

let mut receiver = member.join_broadcast_group(0).unwrap();

for _ in 0..1000 {
    let mut buf = String::new();
    let message = receiver.recv()?;
    let mut message_reader = message.read();
    message_reader.read_to_string(&mut buf)?;
    println!("{}", buf);
}
Commit count: 27

cargo fmt