| @@ -276,6 +276,16 @@ type Category struct { | |||||
| Value string `json:"value"` | Value string `json:"value"` | ||||
| } | } | ||||
| type GpuTypes struct { | |||||
| GpuType []*GpuType `json:"gpu_type"` | |||||
| } | |||||
| type GpuType struct { | |||||
| Id int `json:"id"` | |||||
| Value string `json:"value"` | |||||
| Queue string `json:"queue"` | |||||
| } | |||||
| type CommitImageParams struct { | type CommitImageParams struct { | ||||
| Ip string `json:"ip"` | Ip string `json:"ip"` | ||||
| TaskContainerId string `json:"taskContainerId"` | TaskContainerId string `json:"taskContainerId"` | ||||
| @@ -12,6 +12,7 @@ type CreateCloudBrainForm struct { | |||||
| Attachment string `form:"attachment" binding:"Required"` | Attachment string `form:"attachment" binding:"Required"` | ||||
| JobType string `form:"job_type" binding:"Required"` | JobType string `form:"job_type" binding:"Required"` | ||||
| BenchmarkCategory string `form:"get_benchmark_category"` | BenchmarkCategory string `form:"get_benchmark_category"` | ||||
| GpuType string `form:"gpu_type"` | |||||
| } | } | ||||
| type CommitImageCloudBrainForm struct { | type CommitImageCloudBrainForm struct { | ||||
| @@ -23,7 +23,7 @@ const ( | |||||
| Success = "S000" | Success = "S000" | ||||
| ) | ) | ||||
| func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType string) error { | |||||
| func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType, gpuType string) error { | |||||
| dataActualPath := setting.Attachment.Minio.RealPath + | dataActualPath := setting.Attachment.Minio.RealPath + | ||||
| setting.Attachment.Minio.Bucket + "/" + | setting.Attachment.Minio.Bucket + "/" + | ||||
| setting.Attachment.Minio.BasePath + | setting.Attachment.Minio.BasePath + | ||||
| @@ -32,7 +32,7 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, | |||||
| jobResult, err := CreateJob(jobName, models.CreateJobParams{ | jobResult, err := CreateJob(jobName, models.CreateJobParams{ | ||||
| JobName: jobName, | JobName: jobName, | ||||
| RetryCount: 1, | RetryCount: 1, | ||||
| GpuType: setting.JobType, | |||||
| GpuType: gpuType, | |||||
| Image: image, | Image: image, | ||||
| TaskRoles: []models.TaskRole{ | TaskRoles: []models.TaskRole{ | ||||
| { | { | ||||
| @@ -437,6 +437,7 @@ var ( | |||||
| RestServerHost string | RestServerHost string | ||||
| JobPath string | JobPath string | ||||
| JobType string | JobType string | ||||
| GpuTypes string | |||||
| DebugServerHost string | DebugServerHost string | ||||
| //benchmark config | //benchmark config | ||||
| @@ -1145,7 +1146,8 @@ func NewContext() { | |||||
| RestServerHost = sec.Key("REST_SERVER_HOST").MustString("http://192.168.202.73") | RestServerHost = sec.Key("REST_SERVER_HOST").MustString("http://192.168.202.73") | ||||
| JobPath = sec.Key("JOB_PATH").MustString("/datasets/minio/data/opendata/jobs/") | JobPath = sec.Key("JOB_PATH").MustString("/datasets/minio/data/opendata/jobs/") | ||||
| DebugServerHost = sec.Key("DEBUG_SERVER_HOST").MustString("http://192.168.202.73") | DebugServerHost = sec.Key("DEBUG_SERVER_HOST").MustString("http://192.168.202.73") | ||||
| JobType = sec.Key("JOB_TYPE").MustString("debug_openi") | |||||
| JobType = sec.Key("GPU_TYPE_DEFAULT").MustString("openidebug") | |||||
| GpuTypes = sec.Key("GPU_TYPES").MustString("openidebug,openidgx") | |||||
| sec = Cfg.Section("benchmark") | sec = Cfg.Section("benchmark") | ||||
| IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false) | IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false) | ||||
| @@ -134,6 +134,9 @@ func CloudBrainNew(ctx *context.Context) { | |||||
| var categories *models.Categories | var categories *models.Categories | ||||
| json.Unmarshal([]byte(setting.BenchmarkCategory), &categories) | json.Unmarshal([]byte(setting.BenchmarkCategory), &categories) | ||||
| ctx.Data["benchmark_categories"] = categories.Category | ctx.Data["benchmark_categories"] = categories.Category | ||||
| var gpuTypes *models.GpuTypes | |||||
| json.Unmarshal([]byte(setting.GpuTypes), &gpuTypes) | |||||
| ctx.Data["gpu_types"] = gpuTypes.GpuType | |||||
| ctx.Data["snn4imagenet_path"] = cloudbrain.Snn4imagenetMountPath | ctx.Data["snn4imagenet_path"] = cloudbrain.Snn4imagenetMountPath | ||||
| ctx.Data["is_snn4imagenet_enabled"] = setting.IsSnn4imagenetEnabled | ctx.Data["is_snn4imagenet_enabled"] = setting.IsSnn4imagenetEnabled | ||||
| ctx.HTML(200, tplCloudBrainNew) | ctx.HTML(200, tplCloudBrainNew) | ||||
| @@ -146,6 +149,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| command := form.Command | command := form.Command | ||||
| uuid := form.Attachment | uuid := form.Attachment | ||||
| jobType := form.JobType | jobType := form.JobType | ||||
| gpuType := setting.JobType | |||||
| codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath | codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath | ||||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) { | if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) { | ||||
| @@ -165,6 +169,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath | benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath | ||||
| if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { | if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { | ||||
| gpuType = form.GpuType | |||||
| downloadRateCode(repo, jobName, setting.BenchmarkCode, benchmarkPath, form.BenchmarkCategory) | downloadRateCode(repo, jobName, setting.BenchmarkCode, benchmarkPath, form.BenchmarkCategory) | ||||
| } | } | ||||
| @@ -173,7 +178,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||||
| downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath, "") | downloadRateCode(repo, jobName, setting.Snn4imagenetCode, snn4imagenetPath, "") | ||||
| } | } | ||||
| err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType) | |||||
| err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, modelPath, benchmarkPath, snn4imagenetPath, jobType, gpuType) | |||||
| if err != nil { | if err != nil { | ||||
| ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) | ||||
| return | return | ||||
| @@ -139,6 +139,15 @@ | |||||
| </div> | </div> | ||||
| <input id="store_category" type="hidden" name="get_benchmark_category"> | <input id="store_category" type="hidden" name="get_benchmark_category"> | ||||
| <div class="inline required field cloudbrain_benchmark"> | |||||
| <label>GPU类型</label> | |||||
| <select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型" style='width:385px' name="gpu_type"> | |||||
| {{range .gpu_types}} | |||||
| <option value="{{.Queue}}">{{.Value}}</option> | |||||
| {{end}} | |||||
| </select> | |||||
| </div> | |||||
| <div class="inline required field"> | <div class="inline required field"> | ||||
| <label>镜像</label> | <label>镜像</label> | ||||
| <select class="ui search dropdown" id="cloudbrain_image" placeholder="选择镜像" style='width:385px' name="image"> | <select class="ui search dropdown" id="cloudbrain_image" placeholder="选择镜像" style='width:385px' name="image"> | ||||