62 Star 125 Fork 121

Ascend/mind-cluster
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
job.go 2.45 KB
一键复制 编辑 原始数据 按行查看 历史
luxiang6 提交于 2024-10-07 10:15 +08:00 . 代码仓归一
/*
Copyright(C)2020-2023. Huawei Technologies Co.,Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Package module910x8 is using for HuaWei Ascend pin affinity schedule.
*/
package module910x8
import (
"fmt"
"k8s.io/klog"
"volcano.sh/volcano/pkg/scheduler/plugins/ascend-volcano-plugin/util"
)
func (tp *module910x8) checkJobTrainMode() error {
if tp.NPUTaskNum == 0 {
klog.V(util.LogErrorLev).Infof("GetVTaskNumInVJob %s has no npu tasks.", tp.Name)
return fmt.Errorf("%s no npu job", tp.Name)
}
if tp.NPUTaskNum == 1 {
if err := tp.checkSingleTrainMode(); err != nil {
klog.V(util.LogErrorLev).Infof("%s checkSingleTrainMode %s: %s", tp.GetPluginName(), tp.Name, err)
return err
}
return nil
}
if err := tp.checkModuleDistributeTrainMode(); err != nil {
klog.V(util.LogErrorLev).Infof("%s check distribute %s err: %s", tp.GetPluginName(), tp.Name, err)
return err
}
return nil
}
// CheckSingleTrainMode Single Train job has only one task.
func (tp *module910x8) checkSingleTrainMode() error {
klog.V(util.LogDebugLev).Infof("checkSingleTrainMode job(%s) has %d tasks.", tp.Name, len(tp.Tasks))
jobNPU := tp.ReqNPUNum
if jobNPU == 1 || jobNPU == util.NPUIndex2 || jobNPU == util.NPUIndex4 || jobNPU == util.NPUIndex8 {
return nil
}
return fmt.Errorf("%s checkSingleTrainMode %s req npu not in [1,2,4,8]", tp.GetPluginName(), tp.Name)
}
// checkModuleDistributeTrainMode Distribute Train job has more than one task.
func (tp *module910x8) checkModuleDistributeTrainMode() error {
klog.V(util.LogDebugLev).Infof("half DistributeTrainMode %s has %d tasks.", tp.Name, len(tp.Tasks))
for _, task := range tp.Tasks {
if !task.IsNPUTask() {
continue
}
if task.ReqNPUNum == util.NPUIndex1 || task.ReqNPUNum == util.NPUIndex2 || task.ReqNPUNum == util.NPUIndex4 ||
task.ReqNPUNum == tp.MaxNodeNPUNum {
return nil
}
return fmt.Errorf("checkModuleDistributeTrainMode %s req %d not in [1,2,4,8]", task.Name, task.ReqNPUNum)
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ascend/mind-cluster.git
git@gitee.com:ascend/mind-cluster.git
ascend
mind-cluster
mind-cluster
v6.0.0

搜索帮助