feat: add t-head

This commit is contained in:
jialin
2026-01-15 19:54:20 +08:00
parent 337cb67cd9
commit 9676e63b5e
13 changed files with 109 additions and 29 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

+1 -1
View File
@@ -2,7 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
// import './iconfont/iconfont.js';
const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/c/font_4613488_xson4g41d39.js'
scriptUrl: '//at.alicdn.com/t/c/font_4613488_7f4klfqdzm.js'
});
export default IconFont;
+5 -1
View File
@@ -125,5 +125,9 @@ export default {
'You can also skip this step and add them later from the cluster list.',
'clusters.create.k8sTips1': 'Next, register existing Kubernetes cluster.',
'clusters.create.k8sTips2':
'You can also skip this step and register it later from the cluster list.'
'You can also skip this step and register it later from the cluster list.',
'clusters.addworker.theadNotes':
'If the <span class="bold-text">/usr/local/PPU_SDK</span> directory does not exist, please create a symbolic link pointing to the T-Head installed path: <span class="bold-text">ln -s /path/to/PPU_SDK /usr/local/PPU_SDK</span>.',
'clusters.addworker.theadNotes-02':
'T-Head PPU uses the Container Device Interface (CDI) for device injection and requires the <span class="bold-text">/var/run/cdi</span> directory to be available for CDI generation.'
};
+2 -1
View File
@@ -5,5 +5,6 @@ export default {
'vendor.moorthreads': 'Moore Threads',
'vendor.iluvatar': 'Iluvatar',
'vendor.metax': 'Metax',
'vendor.cambricon': 'Cambricon'
'vendor.cambricon': 'Cambricon',
'vendor.thead': 'T-Head'
};
+7 -1
View File
@@ -125,7 +125,11 @@ export default {
'You can also skip this step and add them later from the cluster list.',
'clusters.create.k8sTips1': 'Next, register existing Kubernetes cluster.',
'clusters.create.k8sTips2':
'You can also skip this step and register it later from the cluster list.'
'You can also skip this step and register it later from the cluster list.',
'clusters.addworker.theadNotes':
'If the <span class="bold-text>/usr/local/PPU_SDK</span> directory does not exist, please create a symbolic link pointing to the T-Head installed path: <span class="bold-text>ln -s /path/to/PPU_SDK /usr/local/PPU_SDK</span>',
'clusters.addworker.theadNotes-02':
'T-Head PPU uses the Container Device Interface (CDI) for device injection and requires the <span class="bold-text">/var/run/cdi</span> directory to be available for CDI generation.'
};
// ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -227,4 +231,6 @@ export default {
// 92. 'clusters.create.k8sTips1': 'Next, register existing Kubernetes cluster.',
// 93. 'clusters.create.k8sTips2': 'You can also skip this step and register it later from the cluster list.',
// 94. 'clusters.create.steps.configure': 'Configure',
// 99. 'clusters.addworker.theadNotes': 'If the <span class="bold-text>/usr/local/PPU_SDK</span> directory does not exist, please create a symbolic link pointing to the T-Head installed path: <span class="bold-text>ln -s /path/to/PPU_SDK /usr/local/PPU_SDK</span>',
// 100. 'clusters.addworker.theadNotes-02': 'T-Head PPU uses the Container Device Interface (CDI) for device injection and requires the <span class="bold-text">/var/run/cdi</span> directory to be available for CDI generation.'
// ========== End of To-Do List ==========
+2 -1
View File
@@ -5,5 +5,6 @@ export default {
'vendor.moorthreads': 'Moore Threads',
'vendor.iluvatar': 'Iluvatar',
'vendor.metax': 'Metax',
'vendor.cambricon': 'Cambricon'
'vendor.cambricon': 'Cambricon',
'vendor.thead': 'T-Head'
};
+7 -1
View File
@@ -126,7 +126,11 @@ export default {
'You can also skip this step and add them later from the cluster list.',
'clusters.create.k8sTips1': 'Next, register existing Kubernetes cluster.',
'clusters.create.k8sTips2':
'You can also skip this step and register it later from the cluster list.'
'You can also skip this step and register it later from the cluster list.',
'clusters.addworker.theadNotes':
'If the <span class="bold-text>/usr/local/PPU_SDK</span> directory does not exist, please create a symbolic link pointing to the T-Head installed path: <span class="bold-text>ln -s /path/to/PPU_SDK /usr/local/PPU_SDK</span>',
'clusters.addworker.theadNotes-02':
'T-Head PPU uses the Container Device Interface (CDI) for device injection and requires the <span class="bold-text">/var/run/cdi</span> directory to be available for CDI generation.'
};
// ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -139,4 +143,6 @@ export default {
// 7. 'clusters.create.k8sTips1': 'Next, register existing Kubernetes cluster.',
// 8. 'clusters.create.k8sTips2': 'You can also skip this step and register it later from the cluster list.',
// 9. 'clusters.create.steps.configure': 'Configure',
// 10. 'clusters.addworker.theadNotes': 'If the <span class="bold-text>/usr/local/PPU_SDK</span> directory does not exist, please create a symbolic link pointing to the T-Head installed path: <span class="bold-text>ln -s /path/to/PPU_SDK /usr/local/PPU_SDK</span>',
// 11. 'clusters.addworker.theadNotes-02': 'T-Head PPU uses the Container Device Interface (CDI) for device injection and requires the <span class="bold-text">/var/run/cdi</span> directory to be available for CDI generation.'
// ================================================================
+2 -1
View File
@@ -5,5 +5,6 @@ export default {
'vendor.moorthreads': 'Moore Threads',
'vendor.iluvatar': 'Iluvatar',
'vendor.metax': 'Metax',
'vendor.cambricon': 'Cambricon'
'vendor.cambricon': 'Cambricon',
'vendor.thead': 'T-Head'
};
+5 -1
View File
@@ -121,5 +121,9 @@ export default {
'clusters.create.dockerTips1': '接下来,为该集群添加节点。',
'clusters.create.dockerTips2': '你也可以跳过此步骤,稍后在集群列表中添加。',
'clusters.create.k8sTips1': '接下来,注册已有的 Kubernetes 集群。',
'clusters.create.k8sTips2': '你也可以跳过此步骤,稍后在集群列表中进行注册。'
'clusters.create.k8sTips2': '你也可以跳过此步骤,稍后在集群列表中进行注册。',
'clusters.addworker.theadNotes':
'如果 <span class="bold-text">/usr/local/PPU_SDK</span> 目录不存在,请创建一个指向已安装平头哥(T-Head)路径的符号链接:<span class="bold-text">ln -s /path/to/PPU_SDK /usr/local/PPU_SDK</span>。',
'clusters.addworker.theadNotes-02':
'平头哥(T-Head)PPU 使用容器设备接口(CDI)进行设备注入,因此需要确保 <span class="bold-text">/var/run/cdi</span> 目录可用以生成 CDI。'
};
+2 -1
View File
@@ -5,5 +5,6 @@ export default {
'vendor.moorthreads': '摩尔线程',
'vendor.iluvatar': '天数智芯',
'vendor.metax': '沐曦',
'vendor.cambricon': '寒武纪'
'vendor.cambricon': '寒武纪',
'vendor.thead': '平头哥'
};
@@ -12,6 +12,7 @@ const AddWorkerCommand: React.FC<ViewModalProps> = ({
provider = '',
currentGPU
}) => {
console.log('check env command provider:', currentGPU);
const code = React.useMemo(() => {
const configs = addWorkerGuide['all'];
const command = configs.checkEnvCommand(currentGPU);
@@ -96,7 +96,7 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
locale: false,
notes: AddWorkerDockerNotes[GPUDriverMap.NVIDIA],
link: 'https://docs.gpustack.ai/latest/installation/requirements/#nvidia-gpu',
icon: <ProviderImage src={nvidiaLogo} height={20} />
icon: <ProviderImage src={nvidiaLogo} height={18} />
},
{
label: 'AMD',
@@ -139,7 +139,6 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.moorthreads' }),
hiddenTitle: true,
// description: 'common.tag.experimental',
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
value: GPUDriverMap.MOORE_THREADS,
key: GPUDriverMap.MOORE_THREADS,
@@ -151,7 +150,6 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.iluvatar' }),
hiddenTitle: true,
// description: 'common.tag.experimental',
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
value: GPUDriverMap.ILUVATAR,
key: GPUDriverMap.ILUVATAR,
@@ -163,7 +161,6 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.cambricon' }),
hiddenTitle: true,
// description: 'common.tag.experimental',
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
value: GPUDriverMap.CAMBRICON,
key: GPUDriverMap.CAMBRICON,
@@ -175,7 +172,6 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
{
label: intl.formatMessage({ id: 'vendor.metax' }),
hiddenTitle: true,
// description: 'common.tag.experimental',
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
value: GPUDriverMap.METAX,
key: GPUDriverMap.METAX,
@@ -183,6 +179,22 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
link: 'https://docs.gpustack.ai/latest/installation/requirements/#metax-gpu',
notes: AddWorkerDockerNotes[GPUDriverMap.METAX],
icon: <ProviderImage src={metaxLogo} height={20} />
},
{
label: intl.formatMessage({ id: 'vendor.thead' }),
hiddenTitle: true,
extra: intl.formatMessage({ id: 'common.tag.experimental' }),
value: GPUDriverMap.THEAD,
key: GPUDriverMap.THEAD,
locale: false,
link: 'https://docs.gpustack.ai/latest/installation/requirements/#thead-gpu',
notes: AddWorkerDockerNotes[GPUDriverMap.THEAD],
icon: (
<IconFont
type="icon-thead"
style={{ fontSize: 90, color: 'var(--ant-color-text)' }}
/>
)
}
];
@@ -194,7 +206,7 @@ const SupportedHardware: React.FC<SupportedHardwareProps> = ({
current={current}
dataList={supportedHardPlatforms}
clickable={clickable}
cols={4}
cols={5}
/>
</Box>
);
+57 -14
View File
@@ -6,7 +6,8 @@ export const GPUDriverMap = {
MOORE_THREADS: 'musa',
ILUVATAR: 'corex',
CAMBRICON: 'neuware',
METAX: 'maca'
METAX: 'maca',
THEAD: 'ppu'
};
export const ManufacturerMap = {
@@ -17,7 +18,8 @@ export const ManufacturerMap = {
[GPUDriverMap.MOORE_THREADS]: 'vendor.moorthreads',
[GPUDriverMap.ILUVATAR]: 'vendor.iluvatar',
[GPUDriverMap.CAMBRICON]: 'vendor.cambricon',
[GPUDriverMap.METAX]: 'vendor.metax'
[GPUDriverMap.METAX]: 'vendor.metax',
[GPUDriverMap.THEAD]: 'vendor.thead'
};
export const GPUsConfigs: Record<
@@ -25,52 +27,58 @@ export const GPUsConfigs: Record<
{ label: string; value: string; runtime: string; driver: string }
> = {
[GPUDriverMap.NVIDIA]: {
label: ManufacturerMap[GPUDriverMap.NVIDIA],
label: 'Nvidia', // this label is used in echo command, do not translate
value: GPUDriverMap.NVIDIA,
runtime: 'nvidia',
driver: 'nvidia-smi'
},
[GPUDriverMap.AMD]: {
label: ManufacturerMap[GPUDriverMap.AMD],
label: 'AMD',
value: GPUDriverMap.AMD,
runtime: 'amd',
driver: 'amd-smi static'
},
[GPUDriverMap.ASCEND]: {
label: ManufacturerMap[GPUDriverMap.ASCEND],
label: 'Ascend',
value: GPUDriverMap.ASCEND,
runtime: 'ascend',
driver: 'npu-smi info'
},
[GPUDriverMap.HYGON]: {
label: ManufacturerMap[GPUDriverMap.HYGON],
label: 'Hygon',
value: GPUDriverMap.HYGON,
runtime: '', // TODO: confirm runtime name
driver: 'hy-smi'
},
[GPUDriverMap.MOORE_THREADS]: {
label: ManufacturerMap[GPUDriverMap.MOORE_THREADS],
label: 'Moore Threads',
value: GPUDriverMap.MOORE_THREADS,
runtime: 'mthreads',
driver: 'mthreads-gmi'
},
[GPUDriverMap.ILUVATAR]: {
label: ManufacturerMap[GPUDriverMap.ILUVATAR],
label: 'Iluvatar',
value: GPUDriverMap.ILUVATAR,
runtime: 'iluvatar',
driver: 'ixsmi'
},
[GPUDriverMap.CAMBRICON]: {
label: ManufacturerMap[GPUDriverMap.CAMBRICON],
label: 'Cambricon',
value: GPUDriverMap.CAMBRICON,
runtime: 'cambricon',
driver: 'cnmon info'
},
[GPUDriverMap.METAX]: {
label: ManufacturerMap[GPUDriverMap.METAX],
label: 'Metax',
value: GPUDriverMap.METAX,
runtime: 'metax',
driver: 'mx-smi'
},
[GPUDriverMap.THEAD]: {
label: 'T-Head',
value: GPUDriverMap.THEAD,
runtime: 'thead', // TODO: confirm runtime name
driver: 'ppu-smi'
}
};
@@ -87,7 +95,7 @@ const generateNvidiaDockerEnvCommand = (config: {
return `${config.driver} >/dev/null 2>&1 && echo "${config.label} driver OK" || (echo "${config.label} driver issue"; exit 1) && sudo docker info 2>/dev/null | grep -q "${runtimeCheck}" && echo "${config.label} Container Toolkit OK" || (echo "${config.label} Container Toolkit not configured"; exit 1)`;
};
// avaliable for Hygon、Iluvatar、MetaX 、Cambricon
// avaliable for Hygon、Iluvatar、MetaX 、Cambricon、T-Head
const generateHygonDockerEnvCommand = (config: {
label: string;
value: string;
@@ -127,6 +135,9 @@ export const dockerEnvCommandMap = {
),
[GPUDriverMap.METAX]: generateHygonDockerEnvCommand(
GPUsConfigs[GPUDriverMap.METAX]
),
[GPUDriverMap.THEAD]: generateHygonDockerEnvCommand(
GPUsConfigs[GPUDriverMap.THEAD]
)
};
@@ -145,9 +156,17 @@ interface AddWorkerCommandParams {
const generateEnvArgs = (params: any) => {
const registrationInfo = params.registrationInfo || {};
registrationInfo.env = {
...registrationInfo.env,
...params.extraEnv
};
// generate environment variables args from registrationInfo.env
let envArgs = '';
if (registrationInfo.env && typeof registrationInfo.env === 'object') {
if (
registrationInfo.env &&
typeof registrationInfo.env === 'object' &&
Object.keys(registrationInfo.env).length > 0
) {
Object.keys(registrationInfo.env).forEach((key) => {
const value = registrationInfo.env[key];
envArgs += `-e "${key}=${value}" \\\n `;
@@ -217,6 +236,25 @@ const registerAscendWorker = (params: AddWorkerCommandParams) => {
${setWorkerIPArg(params)}`;
};
// avaliable for t-head
const registerTHeadWorker = (params: AddWorkerCommandParams) => {
const config = GPUsConfigs[params.gpu];
const commonArgs = setNormalArgs({
...params,
extraEnv: {
GPUSTACK_RUNTIME_DOCKER_RESOURCE_INJECTION_POLICY: 'CDI'
}
});
const imageArgs = setImageArgs(params);
return `${commonArgs}
--volume /usr/local/PPU_SDK:/usr/local/PPU_SDK:ro \\
--volume /var/run/cdi:/var/run/cdi \\
--runtime ${config.runtime} \\
${imageArgs}
${setWorkerIPArg(params)}`;
};
const registerHygonWorker = (params: AddWorkerCommandParams) => {
const config = GPUsConfigs[params.gpu];
const commonArgs = setNormalArgs(params);
@@ -273,7 +311,8 @@ export const registerAddWokerCommandMap = {
[GPUDriverMap.ILUVATAR]: registerIluvatarWorker,
[GPUDriverMap.CAMBRICON]: registerCambriconWorker,
[GPUDriverMap.METAX]: registerMetaXWorker,
[GPUDriverMap.MOORE_THREADS]: registerWorker
[GPUDriverMap.MOORE_THREADS]: registerWorker,
[GPUDriverMap.THEAD]: registerTHeadWorker
};
export const AddWorkerDockerNotes: Record<string, string[]> = {
@@ -287,5 +326,9 @@ export const AddWorkerDockerNotes: Record<string, string[]> = {
],
[GPUDriverMap.ILUVATAR]: ['clusters.addworker.corexNotes'],
[GPUDriverMap.CAMBRICON]: ['clusters.addworker.cambriconNotes'],
[GPUDriverMap.METAX]: ['clusters.addworker.metaxNotes']
[GPUDriverMap.METAX]: ['clusters.addworker.metaxNotes'],
[GPUDriverMap.THEAD]: [
'clusters.addworker.theadNotes',
'clusters.addworker.theadNotes-02'
]
};