use lamellar::active_messaging::prelude::*;
use lamellar::darc::prelude::*;
#[AmData(Debug,Clone)]
struct HelloWorld {
originial_pe: usize,
#[AmData(static)]
msg: Darc<String>,
}
#[lamellar::am]
impl LamellarAM for HelloWorld {
async fn exec(self) {
println!(
"{:?}} on PE {:?} of {:?} using thread {:?}, received from PE {:?}",
self.msg,
lamellar::current_pe,
lamellar::num_pes,
std::thread::current().id(),
self.originial_pe.lock(),
);
}
}
fn main() {
let world = lamellar::LamellarWorldBuilder::new().build();
let my_pe = world.my_pe();
world.barrier();
let msg = Darc::<String>::new(&world, "Hello World".to_string());
let request = world.exec_am_all(HelloWorld {
originial_pe: my_pe,
msg: msg,
});
world.block_on(request);
}