Skip to content

Commit

Permalink
chore: add GPU driver and toolkit status (janhq#2628)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Apr 8, 2024
1 parent c5c3156 commit f8cf93a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 101 deletions.
2 changes: 2 additions & 0 deletions extensions/monitoring-extension/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ const updateGpuInfo = async () =>

data = updateCudaExistence(data)
writeFileSync(GPU_INFO_FILE, JSON.stringify(data, null, 2))
log(`[APP]::${JSON.stringify(data)}`)
resolve({})
} else {
reject(error)
Expand Down Expand Up @@ -263,6 +264,7 @@ const updateGpuInfo = async () =>

data = updateCudaExistence(data)
writeFileSync(GPU_INFO_FILE, JSON.stringify(data, null, 2))
log(`[APP]::${JSON.stringify(data)}`)
resolve({})
}
)
Expand Down
79 changes: 0 additions & 79 deletions web/containers/GPUDriverPromptModal/index.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions web/containers/Providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Toaster } from 'react-hot-toast'

import { TooltipProvider } from '@janhq/uikit'

import GPUDriverPrompt from '@/containers/GPUDriverPromptModal'
import EventListenerWrapper from '@/containers/Providers/EventListener'
import JotaiWrapper from '@/containers/Providers/Jotai'
import ThemeWrapper from '@/containers/Providers/Theme'
Expand Down Expand Up @@ -81,7 +80,6 @@ const Providers = ({ children }: PropsWithChildren) => {
<TooltipProvider delayDuration={0}>
<DataLoader>{children}</DataLoader>
</TooltipProvider>
{!isMac && <GPUDriverPrompt />}
</EventListenerWrapper>
<Toaster />
</KeyListener>
Expand Down
17 changes: 0 additions & 17 deletions web/hooks/useSettings.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { useCallback, useEffect, useState } from 'react'

import { fs, joinPath } from '@janhq/core'
import { atom, useAtom } from 'jotai'

export const isShowNotificationAtom = atom<boolean>(false)

export type AppSettings = {
run_mode: 'cpu' | 'gpu' | undefined
Expand All @@ -15,9 +12,6 @@ export type AppSettings = {

export const useSettings = () => {
const [isGPUModeEnabled, setIsGPUModeEnabled] = useState(false) // New state for GPU mode
const [showNotification, setShowNotification] = useAtom(
isShowNotificationAtom
)
const [settings, setSettings] = useState<AppSettings>()

useEffect(() => {
Expand All @@ -29,15 +23,6 @@ export const useSettings = () => {

const validateSettings = async () => {
readSettings().then((settings) => {
if (
settings &&
settings.notify &&
((settings.nvidia_driver?.exist && !settings.cuda?.exist) ||
!settings.nvidia_driver?.exist)
) {
setShowNotification(false)
}

// Check if run_mode is 'gpu' or 'cpu' and update state accordingly
setIsGPUModeEnabled(settings?.run_mode === 'gpu')
})
Expand Down Expand Up @@ -84,11 +69,9 @@ export const useSettings = () => {
}

return {
showNotification,
isGPUModeEnabled,
readSettings,
saveSettings,
setShowNotification,
validateSettings,
settings,
}
Expand Down
4 changes: 1 addition & 3 deletions web/screens/Settings/Advanced/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ const Advanced = () => {
const [gpuList, setGpuList] = useState<GPU[]>([])
const [gpusInUse, setGpusInUse] = useState<string[]>([])

const { readSettings, saveSettings, validateSettings, setShowNotification } =
useSettings()
const { readSettings, saveSettings, validateSettings } = useSettings()
const { stopModel } = useActiveModel()

const selectedGpu = gpuList
Expand Down Expand Up @@ -273,7 +272,6 @@ const Advanced = () => {
if (e === true) {
saveSettings({ runMode: 'gpu' })
setGpuEnabled(true)
setShowNotification(false)
snackbar({
description:
'Successfully turned on GPU Acceleration',
Expand Down

0 comments on commit f8cf93a

Please sign in to comment.