chore: update add worker command

This commit is contained in:
jialin
2025-11-04 13:37:53 +08:00
parent 4bbae673dc
commit 9be465a8cf
6 changed files with 349 additions and 453 deletions
@@ -3,6 +3,7 @@ import { addWorkerGuide } from '@/pages/resources/config';
import React from 'react';
type ViewModalProps = {
currentGPU?: string;
registrationInfo: {
token: string;
image: string;
@@ -10,17 +11,20 @@ type ViewModalProps = {
};
};
const AddWorkerCommand: React.FC<ViewModalProps> = ({ registrationInfo }) => {
const AddWorkerCommand: React.FC<ViewModalProps> = ({
registrationInfo,
currentGPU
}) => {
const code = React.useMemo(() => {
const commandCode = addWorkerGuide['all'];
return commandCode?.registerWorker({
gpu: currentGPU || '',
server: registrationInfo.server_url || origin,
tag: '',
image: registrationInfo.image,
token: registrationInfo.token || '${token}',
workerip: '${workerip}'
token: registrationInfo.token || '${token}'
});
}, [registrationInfo]);
}, [registrationInfo, currentGPU]);
return (
<HighlightCode
@@ -124,7 +124,10 @@ const AddWorkerStep: React.FC<AddModalProps> = ({
<div className="command-info">
2. {intl.formatMessage({ id: 'clusters.create.addCommand.tips' })}
</div>
<AddWorkerCommand registrationInfo={registrationInfo} />
<AddWorkerCommand
registrationInfo={registrationInfo}
currentGPU={currentGPU}
/>
</>
)}
</Container>
@@ -5,6 +5,7 @@ import iluvatarWEBP from '@/assets/logo/Iluvatar.png';
import metaxLogo from '@/assets/logo/metax.png';
import moorePNG from '@/assets/logo/moore _threads.png';
import IconFont from '@/components/icon-font';
import { GPUDriverMap } from '@/pages/resources/config/gpu-driver';
import { useIntl } from '@umijs/max';
import ProviderCatalog from './provider-catalog';
@@ -26,49 +27,6 @@ interface SupportedHardwareProps {
clickable?: boolean;
}
const GPUsConfigs = {
cuda: {
label: 'NVIDIA',
value: 'cuda',
runtime: 'nvidia'
},
rocm: {
label: 'AMD',
value: 'rocm',
runtime: 'rocm'
},
npu: {
label: 'Ascend',
value: 'npu',
runtime: 'ascend'
},
dcu: {
label: 'Hygon',
value: 'dcu',
runtime: 'dcu'
},
musa: {
label: 'Moore Threads',
value: 'musa',
runtime: 'musa'
},
corex: {
label: 'Iluvatar',
value: 'corex',
runtime: 'corex'
},
cambricon: {
label: 'Cambricon',
value: 'cambricon',
runtime: 'cambricon'
},
metax: {
label: 'MetaX',
value: 'metax',
runtime: 'metax'
}
};
const SupportedHardware: React.FC<SupportedHardwareProps> = ({
onSelect,
clickable,
@@ -79,9 +37,9 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
const supportedHardPlatforms = [
{
label: 'NVIDIA',
value: 'cuda',
value: GPUDriverMap.NVIDIA,
description: '',
key: 'cuda',
key: GPUDriverMap.NVIDIA,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#nvidia-cuda',
icon: <IconFont type="icon-nvidia2" style={{ fontSize: 32 }} />
@@ -89,8 +47,8 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: 'AMD',
description: '',
value: 'rocm',
key: 'rocm',
value: GPUDriverMap.AMD,
key: GPUDriverMap.AMD,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#amd-rocm',
icon: (
@@ -103,8 +61,8 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.ascend' }),
description: '',
value: 'npu',
key: 'npu',
value: GPUDriverMap.ASCEND,
key: GPUDriverMap.ASCEND,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#ascend-cann',
icon: <ProviderImage src={ascendLogo} showBg />
@@ -112,8 +70,8 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.hygon' }),
description: '',
value: 'dcu',
key: 'dcu',
value: GPUDriverMap.HYGON,
key: GPUDriverMap.HYGON,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#hygon-dtk',
icon: <ProviderImage src={hyponPNG} />
@@ -121,8 +79,8 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.moorthreads' }),
description: '',
value: 'musa',
key: 'musa',
value: GPUDriverMap.MOORE_THREADS,
key: GPUDriverMap.MOORE_THREADS,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#moore-threads-musa',
icon: <ProviderImage src={moorePNG} />
@@ -130,24 +88,24 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.iluvatar' }),
description: '',
value: 'corex',
key: 'corex',
value: GPUDriverMap.ILUVATAR,
key: GPUDriverMap.ILUVATAR,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#iluvatar-corex',
icon: <ProviderImage src={iluvatarWEBP} showBg />
},
{
label: intl.formatMessage({ id: 'vendor.cambricon' }),
value: 'cambricon',
key: 'cambricon',
value: GPUDriverMap.CAMBRICON,
key: GPUDriverMap.CAMBRICON,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/installation-requirements/#cambricon-mlu',
icon: <ProviderImage src={CambriconPNG} />
},
{
label: intl.formatMessage({ id: 'vendor.metax' }),
value: 'metax',
key: 'metax',
value: GPUDriverMap.METAX,
key: GPUDriverMap.METAX,
locale: false,
icon: <ProviderImage src={metaxLogo} showBg />
}
-138
View File
@@ -1,138 +0,0 @@
export default {
items: [
{
source: 'model_scope',
huggingface_repo_id: null,
huggingface_filename: null,
ollama_library_model_name: null,
model_scope_model_id: 'Qwen/Qwen3-30B-A3B-FP8',
model_scope_file_path: null,
local_path: null,
name: null,
description: null,
meta: {},
replicas: 1,
ready_replicas: 0,
categories: [],
embedding_only: false,
image_only: false,
reranker: false,
speech_to_text: false,
text_to_speech: false,
placement_strategy: 'spread',
cpu_offloading: false,
distributed_inference_across_workers: false,
worker_selector: {},
gpu_selector: null,
backend: 'SGLang',
backend_version: null,
backend_parameters: [
'--reasoning-parser=qwen3',
'--tool-call-parser=qwen25'
],
image_name: null,
run_command: null,
env: null,
restart_on_error: true,
distributable: false,
extended_kv_cache: null,
speculative_config: null,
quantization: 'FP8',
mode: 'throughput'
},
{
source: 'model_scope',
huggingface_repo_id: null,
huggingface_filename: null,
ollama_library_model_name: null,
model_scope_model_id: 'Qwen/Qwen3-30B-A3B-FP8',
model_scope_file_path: null,
local_path: null,
name: null,
description: null,
meta: {},
replicas: 1,
ready_replicas: 0,
categories: [],
embedding_only: false,
image_only: false,
reranker: false,
speech_to_text: false,
text_to_speech: false,
placement_strategy: 'spread',
cpu_offloading: false,
distributed_inference_across_workers: false,
worker_selector: {},
gpu_selector: null,
backend: 'SGLang',
backend_version: null,
backend_parameters: [
'--reasoning-parser=qwen3',
'--tool-call-parser=qwen25',
'--speculative-algorithm=EAGLE3',
'--speculative-draft-model-path=Tengyunw/qwen3_30b_moe_eagle3',
'--speculative-num-steps=6',
'--speculative-eagle-topk=10',
'--speculative-num-draft-tokens=32'
],
image_name: null,
run_command: null,
env: null,
restart_on_error: true,
distributable: false,
extended_kv_cache: null,
speculative_config: {
enabled: true,
algorithm: 'eagle3',
draft_model: 'Qwen3-30B-A3B-EAGLE3',
num_draft_tokens: 8,
ngram_min_match_length: null,
ngram_max_match_length: null
},
quantization: 'FP8',
mode: 'latency'
},
{
source: 'model_scope',
huggingface_repo_id: null,
huggingface_filename: null,
ollama_library_model_name: null,
model_scope_model_id: 'Qwen/Qwen3-30B-A3B',
model_scope_file_path: null,
local_path: null,
name: null,
description: null,
meta: {},
replicas: 1,
ready_replicas: 0,
categories: [],
embedding_only: false,
image_only: false,
reranker: false,
speech_to_text: false,
text_to_speech: false,
placement_strategy: 'spread',
cpu_offloading: false,
distributed_inference_across_workers: true,
worker_selector: {},
gpu_selector: null,
backend: 'vLLM',
backend_version: null,
backend_parameters: [
'--tool-call-parser=hermes',
'--enable-auto-tool-choice',
'--max-model-len=32768'
],
image_name: null,
run_command: null,
env: null,
restart_on_error: true,
distributable: false,
extended_kv_cache: null,
speculative_config: null,
quantization: 'BF16',
mode: 'reference'
}
],
pagination: { page: 1, perPage: 100, total: 3, totalPage: 1 }
};
+299
View File
@@ -0,0 +1,299 @@
export const GPUDriverMap = {
NVIDIA: 'cuda',
AMD: 'rocm',
ASCEND: 'npu',
HYGON: 'dcu',
MOORE_THREADS: 'musa',
ILUVATAR: 'corex',
CAMBRICON: 'cambricon',
METAX: 'metax'
};
const ManufacturerMap = {
[GPUDriverMap.NVIDIA]: 'NVIDIA',
[GPUDriverMap.AMD]: 'AMD',
[GPUDriverMap.ASCEND]: 'Huawei',
[GPUDriverMap.HYGON]: 'Hygon',
[GPUDriverMap.MOORE_THREADS]: 'Moore Threads',
[GPUDriverMap.ILUVATAR]: 'Iluvatar',
[GPUDriverMap.CAMBRICON]: 'Cambricon',
[GPUDriverMap.METAX]: 'MetaX'
};
export const GPUsConfigs: Record<
string,
{ label: string; value: string; runtime: string; driver: string }
> = {
[GPUDriverMap.NVIDIA]: {
label: ManufacturerMap[GPUDriverMap.NVIDIA],
value: GPUDriverMap.NVIDIA,
runtime: 'nvidia',
driver: 'nvidia-smi'
},
[GPUDriverMap.AMD]: {
label: ManufacturerMap[GPUDriverMap.AMD],
value: GPUDriverMap.AMD,
runtime: 'amd',
driver: 'amd-smi'
},
[GPUDriverMap.ASCEND]: {
label: ManufacturerMap[GPUDriverMap.ASCEND],
value: GPUDriverMap.ASCEND,
runtime: 'ascend',
driver: 'npu-smi info'
},
[GPUDriverMap.HYGON]: {
label: ManufacturerMap[GPUDriverMap.HYGON],
value: GPUDriverMap.HYGON,
runtime: 'dcu', // TODO: confirm runtime name
driver: 'hy-smi'
},
[GPUDriverMap.MOORE_THREADS]: {
label: ManufacturerMap[GPUDriverMap.MOORE_THREADS],
value: GPUDriverMap.MOORE_THREADS,
runtime: 'mthreads',
driver: 'mthreads-gmi'
},
[GPUDriverMap.ILUVATAR]: {
label: ManufacturerMap[GPUDriverMap.ILUVATAR],
value: GPUDriverMap.ILUVATAR,
runtime: 'corex', // TODO: confirm runtime name
driver: 'ixsmi'
},
[GPUDriverMap.CAMBRICON]: {
label: ManufacturerMap[GPUDriverMap.CAMBRICON],
value: GPUDriverMap.CAMBRICON,
runtime: 'cambricon',
driver: 'cnmon info'
},
[GPUDriverMap.METAX]: {
label: ManufacturerMap[GPUDriverMap.METAX],
value: GPUDriverMap.METAX,
runtime: 'metax',
driver: 'mx-smi'
}
};
// Generate the Docker environment command: available for NVIDIA, AMD, Ascend, Moore Threads
const generateNvidiaDockerEnvCommand = (config: {
label: string;
value: string;
runtime: string;
driver: string;
}) => {
return `${config.driver} >/dev/null 2>&1 && echo "${config.label} driver OK" || (echo "${config.label} driver issue"; exit 1) && docker info 2>/dev/null | grep -q "${config.runtime}" && echo "${config.label} Container Toolkit OK" || (echo "${config.label} Container Toolkit not configured"; exit 1)`;
};
// avaliable for Hygon、Iluvatar、MetaX 、Cambricon
const generateHygonDockerEnvCommand = (config: {
label: string;
value: string;
runtime: string;
driver: string;
}) => {
return `${config.driver} >/dev/null 2>&1 && echo "${config.label} driver OK" || (echo "${config.label} driver issue"; exit 1)`;
};
// available for Kubernetes
export const generateKubernetesEnvCommand = (gpu: string) => {
const config = GPUsConfigs[gpu];
return `kubectl get runtimeclass ${config.runtime} > /dev/null 2>&1 && echo "${config.label} runtimeclass registered" || (echo "${config.label} runtimeclass issue"; exit 1)`;
};
export const dockerEnvCommandMap = {
[GPUDriverMap.NVIDIA]: generateNvidiaDockerEnvCommand(
GPUsConfigs[GPUDriverMap.NVIDIA]
),
[GPUDriverMap.AMD]: generateNvidiaDockerEnvCommand(
GPUsConfigs[GPUDriverMap.AMD]
),
[GPUDriverMap.ASCEND]: generateNvidiaDockerEnvCommand(
GPUsConfigs[GPUDriverMap.ASCEND]
),
[GPUDriverMap.MOORE_THREADS]: generateNvidiaDockerEnvCommand(
GPUsConfigs[GPUDriverMap.MOORE_THREADS]
),
[GPUDriverMap.HYGON]: generateHygonDockerEnvCommand(
GPUsConfigs[GPUDriverMap.HYGON]
),
[GPUDriverMap.ILUVATAR]: generateHygonDockerEnvCommand(
GPUsConfigs[GPUDriverMap.ILUVATAR]
),
[GPUDriverMap.CAMBRICON]: generateHygonDockerEnvCommand(
GPUsConfigs[GPUDriverMap.CAMBRICON]
),
[GPUDriverMap.METAX]: generateHygonDockerEnvCommand(
GPUsConfigs[GPUDriverMap.METAX]
)
};
// avaliable for NVIDIA、AMD、MThreads
const registerWorker = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {
const config = GPUsConfigs[params.gpu];
return `WORKER_NAME="gpustack-worker" \\
WORKER_IP="" \\
docker run -d --name \${WORKER_NAME} \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true" \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=\${WORKER_NAME}" \\
-volume /var/run/docker.sock:/var/run/docker.sock \\
--volume gpustack-data:/var/lib/gpustack \\
--runtime ${config.runtime} \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip \${WORKER_IP}`;
};
// avaliable for Ascend
const registerAscendWorker = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {
const config = GPUsConfigs[params.gpu];
return `WORKER_NAME="gpustack-worker" \\
WORKER_IP="" \\
docker run -d --name \${WORKER_NAME} \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true" \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=\${WORKER_NAME}" \\
-volume /var/run/docker.sock:/var/run/docker.sock \\
--volume gpustack-data:/var/lib/gpustack \\
--runtime ${config.runtime} \\
--env "ASCEND_VISIBLE_DEVICES=$(npu-smi info -m | tail -n 1 | awk '{print $1}') \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip \${WORKER_IP}`;
};
const registerHygonWorker = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {
const config = GPUsConfigs[params.gpu];
return `WORKER_NAME="gpustack-worker" \\
WORKER_IP="" \\
docker run -d --name \${WORKER_NAME} \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true" \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=\${WORKER_NAME}" \\
-volume /var/run/docker.sock:/var/run/docker.sock \\
--volume gpustack-data:/var/lib/gpustack \\
--runtime ${config.runtime} \\
--volume /opt/hyhal:/opt/hyhal:ro \\
--volume /opt/dtk:/opt/dtk:ro \\
--env ROCM_PATH=/opt/dtk \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip \${WORKER_IP}`;
};
const registerIluvatarWorker = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {
const config = GPUsConfigs[params.gpu];
return `WORKER_NAME="gpustack-worker" \\
WORKER_IP="" \\
docker run -d --name \${WORKER_NAME} \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true" \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=\${WORKER_NAME}" \\
-volume /var/run/docker.sock:/var/run/docker.sock \\
--volume gpustack-data:/var/lib/gpustack \\
--volume /lib/modules:/lib/modules:ro \\
--volume /usr/local/corex:/usr/local/corex:ro \\
--volume /usr/bin/ixsmi:/usr/bin/ixsmi \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip \${WORKER_IP}`;
};
const registerMetaXWorker = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {
const config = GPUsConfigs[params.gpu];
return `WORKER_NAME="gpustack-worker" \\
WORKER_IP="" \\
docker run -d --name \${WORKER_NAME} \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true" \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=\${WORKER_NAME}" \\
-volume /var/run/docker.sock:/var/run/docker.sock \\
--volume gpustack-data:/var/lib/gpustack \\
--volume /opt/mxdriver:/opt/mxdriver:ro \\
--volume /opt/maca:/opt/maca:ro \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip \${WORKER_IP}`;
};
const registerCambriconWorker = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {
const config = GPUsConfigs[params.gpu];
return `WORKER_NAME="gpustack-worker" \\
WORKER_IP="" \\
docker run -d --name \${WORKER_NAME} \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true" \\
--env "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=\${WORKER_NAME}" \\
-volume /var/run/docker.sock:/var/run/docker.sock \\
--volume gpustack-data:/var/lib/gpustack \\
--volume /usr/local/neuware:/usr/local/neuware:ro \\
--volume /usr/bin/cnmon:/usr/bin/cnmon \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip \${WORKER_IP}`;
};
export const registerAddWokerCommandMap = {
[GPUDriverMap.NVIDIA]: registerWorker,
[GPUDriverMap.AMD]: registerWorker,
[GPUDriverMap.ASCEND]: registerAscendWorker,
[GPUDriverMap.HYGON]: registerHygonWorker,
[GPUDriverMap.ILUVATAR]: registerIluvatarWorker,
[GPUDriverMap.CAMBRICON]: registerCambriconWorker,
[GPUDriverMap.METAX]: registerMetaXWorker,
[GPUDriverMap.MOORE_THREADS]: registerWorker
};
+21 -251
View File
@@ -1,5 +1,10 @@
import { StatusMaps } from '@/config';
import { ProviderValueMap } from '@/pages/cluster-management/config';
import {
dockerEnvCommandMap,
generateKubernetesEnvCommand,
registerAddWokerCommandMap
} from './gpu-driver';
export const WorkerStatusMap = {
ready: 'ready',
@@ -33,267 +38,33 @@ export const status: any = {
[WorkerStatusMap.pending]: StatusMaps.transitioning,
[WorkerStatusMap.initializing]: StatusMaps.transitioning
};
export const GPUsConfigs: Record<string, any> = {
cuda: {
label: 'NVIDIA',
value: 'cuda',
runtime: 'nvidia',
driver: 'nvidia-smi'
},
rocm: {
label: 'AMD',
value: 'rocm',
runtime: 'rocm',
driver: 'rocm-smi'
},
npu: {
label: 'Ascend',
value: 'npu',
runtime: 'ascend',
driver: 'npu-smi'
},
dcu: {
label: 'Hygon',
value: 'dcu',
runtime: 'dcu', // TODO: confirm runtime name
driver: 'hy-smi'
},
musa: {
label: 'Moore Threads',
value: 'musa',
runtime: 'mthreads',
driver: 'mthreads-gmi'
},
corex: {
label: 'Iluvatar',
value: 'corex',
runtime: 'corex', // TODO: confirm runtime name
driver: 'ixsmi'
},
cambricon: {
label: 'Cambricon',
value: 'cambricon',
runtime: 'cambricon',
driver: 'cnmon'
},
metax: {
label: 'MetaX',
value: 'metax',
runtime: 'metax',
driver: 'mx-smi'
}
export const checkEnvCommand = (gpu: string) => {
return {
[ProviderValueMap.Docker]: dockerEnvCommandMap[gpu] || '',
[ProviderValueMap.Kubernetes]: generateKubernetesEnvCommand(gpu) || ''
};
};
export const generateAddWokerCommand = (params: {
server: string;
tag: string;
token: string;
image: string;
gpu: string;
}) => {};
export const addWorkerGuide: Record<string, any> = {
mac: {
getToken: 'cat /var/lib/gpustack/token',
registerWorker(params: { server: string; token: string }) {
return `curl -sfL https://get.gpustack.ai | sh -s - --server-url ${params.server} --token ${params.token}`;
}
},
win: {
getToken:
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
registerWorker(params: { server: string; token: string }) {
return `Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } --server-url '${params.server}' --token '${params.token}'"`;
}
},
all: {
getToken:
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
registerWorker(params: {
server: string;
tag: string;
token: string;
image: string;
workerip: string;
gpu: string;
}) {
return `docker run -d --name gpustack-worker \\
--restart=unless-stopped \\
--privileged \\
--net=host \\
-v /var/run/docker.sock:/var/run/docker.sock \\
-v /var/lib/gpustack:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} \\
--token ${params.token} \\
--worker-ip ${params.workerip}`;
return registerAddWokerCommandMap[params.gpu]?.(params);
},
checkEnvCommand(gpu: string) {
const config = GPUsConfigs[gpu];
return {
[ProviderValueMap.Docker]: `${config.driver} >/dev/null 2>&1 && echo "${config.label} driver OK" || (echo "${config.label} driver issue"; exit 1) && docker info 2>/dev/null | grep -q "Default Runtime: ${config.runtime}" && echo "${config.label} Container Toolkit OK" || (echo "${config.label} Container Toolkit not configured"; exit 1)`,
[ProviderValueMap.Kubernetes]: `kubectl get runtimeclass ${config.runtime} > /dev/null 2>&1 && echo "${config.label} runtimeclass registered" || (echo "${config.label} runtimeclass issue"; exit 1)`
};
}
},
npu: {
getToken:
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
--restart=unless-stopped \\
--device /dev/davinci0 \\
--device /dev/davinci1 \\
--device /dev/davinci_manager \\
--device /dev/devmm_svm \\
--device /dev/hisi_hdc \\
-v /usr/local/dcmi:/usr/local/dcmi \\
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \\
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \\
-v /etc/ascend_install.info:/etc/ascend_install.info \\
--network=host \\
--ipc=host \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
npu310p: {
getToken:
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
--restart=unless-stopped \\
--device /dev/davinci0 \\
--device /dev/davinci1 \\
--device /dev/davinci_manager \\
--device /dev/devmm_svm \\
--device /dev/hisi_hdc \\
-v /usr/local/dcmi:/usr/local/dcmi \\
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \\
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \\
-v /etc/ascend_install.info:/etc/ascend_install.info \\
--network=host \\
--ipc=host \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} -310p \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
musa: {
getToken:
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
--restart=unless-stopped \\
--network=host \\
--ipc=host \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
cpu: {
getToken:
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
--restart=unless-stopped \\
--network=host \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
rocm: {
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
--restart=unless-stopped \\
--device=/dev/kfd \\
--device=/dev/dri \\
--network=host \\
--ipc=host \\
--group-add video \\
--cap-add=SYS_PTRACE \\
--security-opt seccomp=unconfined \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
dcu: {
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
--restart=unless-stopped \\
--device=/dev/kfd \\
--device=/dev/mkfd \\
--device=/dev/dri \\
-v /opt/hyhal:/opt/hyhal:ro \\
--network=host \\
--ipc=host \\
--group-add video \\
--cap-add=SYS_PTRACE \\
--security-opt seccomp=unconfined \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
corex: {
registerWorker(params: {
server: string;
tag: string;
token: string;
workerip: string;
image: string;
}) {
return `docker run -d --name gpustack \\
-v /lib/modules:/lib/modules \\
-v /dev:/dev \\
--privileged \\
--cap-add=ALL \\
--pid=host \\
--restart=unless-stopped \\
--network=host \\
--ipc=host \\
-v gpustack-data:/var/lib/gpustack \\
${params.image} \\
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
}
},
container: {
getToken:
'docker exec -it ${gpustack_container_id} cat /var/lib/gpustack/token'
checkEnvCommand: checkEnvCommand
}
};
@@ -304,7 +75,6 @@ export const containerInstallOptions = [
{ label: 'Hygon DTK', value: 'dcu' },
{ label: 'Moore Threads MUSA', value: 'musa' },
{ label: 'Iluvatar Corex', value: 'corex' }
// { label: 'CPU', value: 'cpu' }
];
export const ModelfileStateMap = {