How to use cargo-mpirun to run a Rust demo with my own cluster?

Viewed 23

I have successfully run a C demo on my cluster with two nodes whose name are "node1" and "node2". When I wan to run a Rust demo on the same cluster with cargo-mpirun, I can only run it on only one node in the cluster.I can not find useful option in cargo-mpirun to run my Rust demo.

This is my "main" function:

fn main() {
    let rank = mpi::initialize().unwrap().world().rank();

    println!(
        "Hello from rank {}, on {}. (core affinity = {})",
        rank,
        get_hostname(),
        get_affinity()
    );
}

Its output is following with the command:

cargo mpirun --np 4 --bin mpi_rust_test 

Hello from rank 0, on node2. (core affinity = 0-7)

Hello from rank 1, on node2. (core affinity = 0-7)

Hello from rank 2, on node2. (core affinity = 0-7)

Hello from rank 3, on node2. (core affinity = 0-7)

As is shown above, the processes only appear in the "node2". I think the option "npernode" or "jobs" in cargo mpirun would work.But I don't know how to use them to run the little demo on my cluster.I want to see the processes appear both on node1 and node2 at the same time.

0 Answers
Related