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

Use a single GPU for proof generation #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikhailUshakoff
Copy link

No description provided.

@mikhailUshakoff mikhailUshakoff marked this pull request as ready for review February 7, 2025 21:12
Copy link

@Hyodar Hyodar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me, but I don't have much context on this!
Left some comments on possible refactorings and some remaining TODO comments.

@@ -167,8 +174,13 @@ impl ProofActor {
};
}
}
let mut tasks = tasks.lock().await;
tasks.remove(&key);
// TODO think
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this TODO about?

Comment on lines +178 to +183
{
let mut gpus = gpus.lock().await;
gpus.push_back(proof_request.gpu_number.unwrap());
let mut tasks = tasks.lock().await;
tasks.remove(&key);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to do this instead? Not an issue here but usually bad to unnecessarily nest mutex locks.

Suggested change
{
let mut gpus = gpus.lock().await;
gpus.push_back(proof_request.gpu_number.unwrap());
let mut tasks = tasks.lock().await;
tasks.remove(&key);
}
{
let mut gpus = gpus.lock().await;
gpus.push_back(proof_request.gpu_number.unwrap());
}
{
let mut tasks = tasks.lock().await;
tasks.remove(&key);
}

@@ -274,6 +296,7 @@ impl ProofActor {
Message::TaskComplete(req) => {
// pop up pending task if any task complete
debug!("Message::TaskComplete({req:?})");
// TODO fix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix what?

Comment on lines +275 to +284
// Set gpu number for task
if proof_request.gpu_number.is_some() { panic!("GPU number is already set"); }
let mut available_gpus = self.available_gpus.lock().await;
if let Some(gpu_number) = available_gpus.pop_front() {
proof_request.set_gpu_number(Some(gpu_number));
} else {
panic!("No available GPU");
}
drop(available_gpus);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this? It uses a closure so no need for an explicit drop too. Not a Rust expert though, so must be taken with caution!

Suggested change
// Set gpu number for task
if proof_request.gpu_number.is_some() { panic!("GPU number is already set"); }
let mut available_gpus = self.available_gpus.lock().await;
if let Some(gpu_number) = available_gpus.pop_front() {
proof_request.set_gpu_number(Some(gpu_number));
} else {
panic!("No available GPU");
}
drop(available_gpus);
proof_request.set_gpu_number(Some({
proof_request.gpu_number
.as_ref()
.inspect(|_| panic!("GPU number is already set"));
self.available_gpus
.lock()
.await
.pop_front()
.ok_or_else(|| panic!("No available GPU"))
}));

@@ -287,11 +293,18 @@ impl Prover for Sp1Prover {
}
}

// TODO it is None now
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is None?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants