Skip to content

Commit

Permalink
Remove GPU list endpoints (#2333)
Browse files Browse the repository at this point in the history
Remove gpu list endpoints
  • Loading branch information
joeyballentine authored Nov 22, 2023
1 parent 9850f9c commit 10825aa
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 76 deletions.
41 changes: 0 additions & 41 deletions backend/src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,47 +345,6 @@ async def kill(request: Request):
return json(error_response("Error killing execution!", exception), status=500)


@app.route("/list-gpus/ncnn", methods=["GET"])
async def list_ncnn_gpus(_request: Request):
"""Lists the available GPUs for NCNN"""
await nodes_available()
try:
# pylint: disable=import-outside-toplevel
from ncnn_vulkan import ncnn

result = []
for i in range(ncnn.get_gpu_count()):
result.append(ncnn.get_gpu_info(i).device_name())
return json(result)
except Exception as exception:
try:
from ncnn import ncnn

result = ["cpu"]
return json(result)
except Exception as exception2:
logger.error(exception, exc_info=True)
logger.error(exception2, exc_info=True)
return json([])


@app.route("/list-gpus/nvidia", methods=["GET"])
async def list_nvidia_gpus(_request: Request):
"""Lists the available GPUs for NCNN"""
await nodes_available()
try:
nv = get_nvidia_helper()

if nv is None:
return json([])

result = nv.list_gpus()
return json(result)
except Exception as exception:
logger.error(exception, exc_info=True)
return json([])


@app.route("/python-info", methods=["GET"])
async def python_info(_request: Request):
version = (
Expand Down
14 changes: 0 additions & 14 deletions src/common/Backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,6 @@ export class Backend {
return this.fetchJson('/clear-cache/individual', 'POST', { id });
}

/**
* Gets a list of all NCNN GPU devices and their indexes
*/
listNcnnGpus(): Promise<string[]> {
return this.fetchJson('/list-gpus/ncnn', 'GET');
}

/**
* Gets a list of all Nvidia GPU devices and their indexes
*/
listNvidiaGpus(): Promise<string[]> {
return this.fetchJson('/list-gpus/nvidia', 'GET');
}

pythonInfo(): Promise<PythonInfo> {
return this.fetchJson('/python-info', 'GET');
}
Expand Down
21 changes: 0 additions & 21 deletions src/renderer/contexts/DependencyContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ import {
PyPiPackage,
Version,
} from '../../common/common-types';
import { isArmMac } from '../../common/env';
import { log } from '../../common/log';
import { OnStdio, runPipInstall, runPipUninstall } from '../../common/pip';
import { noop } from '../../common/util';
import { versionGt } from '../../common/version';
import { Markdown } from '../components/Markdown';
import { useAsyncEffect } from '../hooks/useAsyncEffect';
import { useMemoObject } from '../hooks/useMemo';
import { AlertBoxContext, AlertType } from './AlertBoxContext';
import { BackendContext } from './BackendContext';
Expand Down Expand Up @@ -386,15 +384,6 @@ export const DependencyProvider = memo(({ children }: React.PropsWithChildren<un
const [isConsoleOpen, setIsConsoleOpen] = useState(false);
const [usePipDirectly, setUsePipDirectly] = useState(false);

const [hasNvidia, setHasNvidia] = useState(false);
useAsyncEffect(
() => ({
supplier: async () => (await backend.listNvidiaGpus()).length > 0,
successEffect: setHasNvidia,
}),
[backend]
);

const { data: installedPyPi, refetch: refetchInstalledPyPi } = useQuery({
queryKey: 'dependencies',
queryFn: async () => {
Expand Down Expand Up @@ -531,16 +520,6 @@ export const DependencyProvider = memo(({ children }: React.PropsWithChildren<un
<ModalCloseButton disabled={currentlyProcessingDeps} />
<ModalBody>
<VStack w="full">
{!isArmMac && (
<Flex w="full">
<Text
flex="1"
textAlign="left"
>
{hasNvidia ? 'CUDA supported' : 'CUDA not supported'}
</Text>
</Flex>
)}
<Flex
align="center"
w="full"
Expand Down

0 comments on commit 10825aa

Please sign in to comment.