Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial aggregation tree support #12

Merged
merged 2 commits into from
Mar 26, 2024
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ FROM optcast AS unittest

ENV RUST_LOG=info
ENV NCCL_SOCKET_IFNAME=lo
ENV RUSTFLAGS="--cfg no_spinloop"
RUN cd reduction_server && cargo test --all -- --nocapture --test-threads=1

FROM nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04 AS final
Expand Down
13 changes: 13 additions & 0 deletions reduction_server/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* See LICENSE for license information
*/

use std::hint;
use std::io::{Read, Write};
use std::net::{TcpListener, TcpStream};
use std::sync::Arc;
Expand Down Expand Up @@ -60,6 +61,12 @@ fn do_client<T: Float>(args: &Args, comms: Vec<(Comm, Comm)>) {
let start = std::time::Instant::now();

loop {
if cfg!(no_spinloop) {
std::thread::sleep(NO_SPINLOOP_INTERVAL);
} else {
hint::spin_loop();
}

for (i, req, sbuf, rbuf, mhs) in reqs.iter_mut() {
if req.is_none() && reqed < args.try_count {
*req = Some(
Expand All @@ -72,6 +79,12 @@ fn do_client<T: Float>(args: &Args, comms: Vec<(Comm, Comm)>) {
let mut rrequest: Option<Request> = None;

loop {
if cfg!(no_spinloop) {
std::thread::sleep(NO_SPINLOOP_INTERVAL);
} else {
hint::spin_loop();
}

if srequest.is_none() {
srequest = nccl_net::isend(
scomm,
Expand Down
Loading