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

Hide GPU setting when it is not available #1959

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/gui/src/components/settings/SettingsHarvester.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ServiceName, HarvesterConfig } from '@chia-network/api';
import {
useGetHarvesterConfigQuery,
useGetPlottersQuery,
useUpdateHarvesterConfigMutation,
useClientStartServiceMutation,
useClientStopServiceMutation,
Expand All @@ -14,6 +15,7 @@ import React from 'react';
const messageAnchorOrigin = { vertical: 'bottom' as const, horizontal: 'center' as const };

export default function SettingsHarvester() {
const { data: plotters } = useGetPlottersQuery();
const { data, isLoading } = useGetHarvesterConfigQuery();
const [updateHarvesterConfig, { isLoading: isUpdating }] = useUpdateHarvesterConfigMutation();
const [startService, { isLoading: isStarting }] = useClientStartServiceMutation();
Expand Down Expand Up @@ -351,6 +353,17 @@ export default function SettingsHarvester() {
[configUpdateRequests]
);

const gpuOptionStyle = React.useMemo(
() =>
!plotters ||
!plotters.bladebit_cuda ||
!plotters.bladebit_cuda.installInfo.cudaSupport ||
configUpdateRequests.parallelDecompressorCount === 0
? { display: 'none' }
: undefined,
[configUpdateRequests, plotters]
);

return (
<Grid container style={{ maxWidth: '624px' }} gap={3}>
<Grid item>
Expand Down Expand Up @@ -473,7 +486,7 @@ export default function SettingsHarvester() {
</Grid>
</Grid>

<Grid container sx={compressionOptionStyle}>
<Grid container sx={gpuOptionStyle}>
<Grid item style={{ width: '400px' }}>
<SettingsTitle>
<Trans>Enable GPU Harvesting</Trans>
Expand All @@ -489,7 +502,7 @@ export default function SettingsHarvester() {
</Grid>
</Grid>

<Grid container sx={compressionOptionStyle}>
<Grid container sx={gpuOptionStyle}>
<Grid item style={{ width: '400px' }}>
<SettingsTitle>
<Trans>GPU Device Index</Trans>
Expand Down