fix: multiple gpu (#4641)

* fix: multiple gpu

* chore: check vulkan when app load

* chore: remove log

* chore: update engine variant conditional
This commit is contained in:
Faisal Amir 2025-02-12 22:50:56 +07:00 committed by GitHub
parent 6d73f49cdf
commit aed42edb3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 24 deletions

View File

@ -65,21 +65,22 @@ export const engineVariant = async (
// There is no need to append the variant extension for mac // There is no need to append the variant extension for mac
if (platform.startsWith('mac')) return platform if (platform.startsWith('mac')) return platform
let engineVariant = [ let engineVariant =
gpuSetting?.vulkan || gpuSetting.gpus.some((e) => !e.additional_information)
? [platform, 'vulkan']
: [
platform, platform,
gpuSetting?.vulkan gpuRunMode(gpuSetting) === 'cuda' &&
? 'vulkan' (gpuSetting.cpu.instructions.includes('avx2') ||
: (gpuRunMode(gpuSetting) === 'cuda' && // GPU mode - packaged CUDA variants of avx2 and noavx gpuSetting.cpu.instructions.includes('avx512'))
gpuSetting.cpu.instructions.some((inst) => inst === 'avx2')) ||
gpuSetting.cpu.instructions.some((inst) => inst === 'avx512')
? 'avx2' ? 'avx2'
: 'noavx', : 'noavx',
gpuRunMode(gpuSetting), gpuRunMode(gpuSetting),
cudaVersion(gpuSetting), cudaVersion(gpuSetting),
] ].filter(Boolean) // Remove any falsy values
.filter((e) => !!e)
.join('-')
log(`[CORTEX]: Engine variant: ${engineVariant}`) let engineVariantString = engineVariant.join('-')
return engineVariant
log(`[CORTEX]: Engine variant: ${engineVariantString}`)
return engineVariantString
} }

View File

@ -50,9 +50,9 @@ const Hardware = () => {
} }
// Handle switch toggle for GPU activation // Handle switch toggle for GPU activation
const handleSwitchChange = async (index: number, isActive: boolean) => { const handleSwitchChange = async (id: string, isActive: boolean) => {
const updatedGpus = gpus.map((gpu, i) => const updatedGpus = gpus.map((gpu) =>
i === index ? { ...gpu, activated: isActive } : gpu gpu.id === id ? { ...gpu, activated: isActive } : gpu
) )
setGpus(updatedGpus) setGpus(updatedGpus)
// Call the API to update the active GPUs // Call the API to update the active GPUs
@ -282,7 +282,10 @@ const Hardware = () => {
<Switch <Switch
checked={item.activated} checked={item.activated}
onChange={(e) => onChange={(e) =>
handleSwitchChange(i, e.target.checked) handleSwitchChange(
item.id,
e.target.checked
)
} }
/> />