mirror of
https://github.com/beclab/Olares
synced 2026-04-21 13:37:46 +00:00
* feat(connector): add functions to detect Mthreads AI Book and RockChip models * feat(gpu): add MThreads GPU support and related modules * fix(cli): remove redundant import of amdgpu package * chore(cli): remove unnecessary tasks when adding node --------- Co-authored-by: dkeven <dkvvven@gmail.com>
39 lines
1 KiB
Go
39 lines
1 KiB
Go
package mtgpu
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/beclab/Olares/cli/pkg/clientset"
|
|
"github.com/beclab/Olares/cli/pkg/common"
|
|
"github.com/beclab/Olares/cli/pkg/core/connector"
|
|
"github.com/beclab/Olares/cli/pkg/core/logger"
|
|
"github.com/beclab/Olares/cli/pkg/gpu"
|
|
"k8s.io/utils/ptr"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// UpdateNodeMThreadsGPUInfo updates Kubernetes node labels with MThreads GPU information.
|
|
type UpdateNodeMThreadsGPUInfo struct {
|
|
common.KubeAction
|
|
}
|
|
|
|
func (u *UpdateNodeMThreadsGPUInfo) Execute(runtime connector.Runtime) error {
|
|
client, err := clientset.NewKubeClient()
|
|
if err != nil {
|
|
return errors.Wrap(errors.WithStack(err), "kubeclient create error")
|
|
}
|
|
|
|
// Check if MThreads AI Book M1000 exists
|
|
m1000Exists := connector.IsMThreadsAIBookM1000(runtime)
|
|
if !m1000Exists {
|
|
logger.Info("MThreads AI Book M1000 is not detected")
|
|
return nil
|
|
}
|
|
|
|
if runtime.GetSystemInfo().IsAmdApu() {
|
|
return gpu.UpdateNodeGpuLabel(context.Background(), client.Kubernetes(), nil, nil, nil, ptr.To(gpu.MThreadsM1000Type))
|
|
}
|
|
|
|
return nil
|
|
}
|