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

fix(gpu): make GPU unavailable if all devices are excluded #1375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MCozhusheck
Copy link
Collaborator

@MCozhusheck MCozhusheck commented Jan 13, 2025

Description

Makes entire GPU unavailable for gpu mining if all devices were excluded.

Motivation and Context

Right now if all devices are excluded the gpu miner will restart over and over failing each time. This PR makes early check for this case.

How Has This Been Tested?

Before mining - turn on GPU mining and turn off every GPU device then:

  • check if GPU mining is not working (check GPU power and if xtrgpuminer process is absent)

Also check case if GPU mining is turned on and at least 1 GPU device then check if GPU mining is working as expected.

What process can a PR reviewer use to test or verify this change?

Same as above.

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

Comment on lines +204 to +208
if self.gpu_devices.len() <= excluded_gpu_devices.len() {
self.is_available = false;
} else {
self.is_available = true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if self.gpu_devices.len() <= excluded_gpu_devices.len() {
self.is_available = false;
} else {
self.is_available = true;
}
self.is_available = !(self.gpu_devices.len() <= excluded_gpu_devices.len())

Comment on lines +203 to +207
if (excludedGpuDevices.length === hardware.length) {
set({ gpu: { ...getState().gpu, mining: { ...getState().gpu.mining, is_available: false } } });
} else {
set({ gpu: { ...getState().gpu, mining: { ...getState().gpu.mining, is_available: true } } });
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (excludedGpuDevices.length === hardware.length) {
set({ gpu: { ...getState().gpu, mining: { ...getState().gpu.mining, is_available: false } } });
} else {
set({ gpu: { ...getState().gpu, mining: { ...getState().gpu.mining, is_available: true } } });
}
set({ gpu: { ...getState().gpu, mining: { ...getState().gpu.mining, is_available: !(excludedGpuDevices.length === hardware.length) } } });

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