From c59608eb4e42410f5eeffd3630af110749659b00 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:07:08 +0530 Subject: [PATCH 01/39] enable docker-submission generation --- .../_cm.json | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 3827af24a4..cd82a9d422 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -120,5 +120,40 @@ "mlperf-inference-submission", "mlcommons-inference-submission" ], - "uid": "5f8ab2d0b5874d53" + "uid": "5f8ab2d0b5874d53", + "docker": { + "use_host_group_id": true, + "use_host_user_id": true, + "deps": [ + { + "tags": "get,mlperf,inference,results,dir,local", + "names": "get-mlperf-inference-results-dir", + "skip_if_env": { + "OUTPUT_BASE_DIR": [ + "on" + ] + } + }, + { + "tags": "get,mlperf,inference,submission,dir,local", + "names": "get-mlperf-inference-submission-dir", + "skip_if_env": { + "CM_MLPERF_INFERENCE_SUBMISSION_DIR": [ + "on" + ] + } + } + ], + "pre_run_cmds": [ + "cm pull repo" + ], + "mounts": [ + "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", + "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" + ], + "os": "ubuntu", + "cm_repo": "mlcommons@cm4mlops", + "cm_repo_branch": "mlperf-inference", + "os_version": "22.04" + } } From 28ce998f3292d497bb5481f3c2b4fd4638d9c164 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:19:22 +0530 Subject: [PATCH 02/39] real run set to false --- script/generate-mlperf-inference-submission/_cm.json | 1 + 1 file changed, 1 insertion(+) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index cd82a9d422..d6acd726b9 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -124,6 +124,7 @@ "docker": { "use_host_group_id": true, "use_host_user_id": true, + "real_run": false, "deps": [ { "tags": "get,mlperf,inference,results,dir,local", From 2b35b792951856803a0d60a0deaf98fa89fabadc Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:00:54 +0530 Subject: [PATCH 03/39] docker run set to false --- script/get-mlperf-inference-sut-description/_cm.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/get-mlperf-inference-sut-description/_cm.json b/script/get-mlperf-inference-sut-description/_cm.json index e5b8723c49..d350ee2eaa 100644 --- a/script/get-mlperf-inference-sut-description/_cm.json +++ b/script/get-mlperf-inference-sut-description/_cm.json @@ -4,6 +4,9 @@ "automation_uid": "5b4e0237da074764", "cache": false, "category": "MLPerf benchmark support", + "docker": { + "run": false + }, "deps": [ { "tags": "detect,os" From 3309a3535d45a67437de9b5e4aac1980a5dbb6d2 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:05:43 +0530 Subject: [PATCH 04/39] Update results dir env variable --- script/generate-mlperf-inference-submission/_cm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index d6acd726b9..10e24bb874 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -130,7 +130,7 @@ "tags": "get,mlperf,inference,results,dir,local", "names": "get-mlperf-inference-results-dir", "skip_if_env": { - "OUTPUT_BASE_DIR": [ + "CM_MLPERF_INFERENCE_RESULTS_DIR_": [ "on" ] } From 8ffa471eb235ef04f4b2dbcd159c103d4e575d7d Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:58:38 +0530 Subject: [PATCH 05/39] updated docker permissions --- script/generate-mlperf-inference-submission/_cm.json | 1 + 1 file changed, 1 insertion(+) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 10e24bb874..79bddc8ea7 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -152,6 +152,7 @@ "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" ], + "extra_run_args": " --cap-add SYS_ADMIN --security-opt apparmor=unconfined --security-opt seccomp=unconfined", "os": "ubuntu", "cm_repo": "mlcommons@cm4mlops", "cm_repo_branch": "mlperf-inference", From 5ced2d23ec2e3045ea7973c9d4ea6cf9e69ce2b5 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 22:42:39 +0530 Subject: [PATCH 06/39] update docker permissions --- script/generate-mlperf-inference-submission/_cm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 79bddc8ea7..354d453b1f 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -152,7 +152,7 @@ "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" ], - "extra_run_args": " --cap-add SYS_ADMIN --security-opt apparmor=unconfined --security-opt seccomp=unconfined", + "extra_run_args": " --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined", "os": "ubuntu", "cm_repo": "mlcommons@cm4mlops", "cm_repo_branch": "mlperf-inference", From 3cabfa1386bf23de8e55724d479c52e391d66c23 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 23:10:29 +0530 Subject: [PATCH 07/39] Add docker input mapping --- script/generate-mlperf-inference-submission/_cm.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 354d453b1f..8a755379a2 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -156,6 +156,10 @@ "os": "ubuntu", "cm_repo": "mlcommons@cm4mlops", "cm_repo_branch": "mlperf-inference", - "os_version": "22.04" + "os_version": "22.04", + "docker_input_mapping": { + "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", + "results_dir": "CM_MLPERF_INFERENCE_RESULTS_DIR_" + } } } From 5149a0b269c0fb4cfdc11c453ad6dfbe33654758 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Thu, 31 Oct 2024 23:19:31 +0530 Subject: [PATCH 08/39] enabled modifying input mapping env inside docker --- automation/script/module_misc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/automation/script/module_misc.py b/automation/script/module_misc.py index c4e508c352..eb4f37f3a1 100644 --- a/automation/script/module_misc.py +++ b/automation/script/module_misc.py @@ -1917,10 +1917,11 @@ def docker(i): if host_env_key: container_env_string += " --env.{}={} ".format(host_env_key, container_env_key) # check if the below lines are needed when inputs are mapped to container paths - '''for v in docker_input_mapping: + + for v in docker_input_mapping: if docker_input_mapping[v] == host_env_key: - i[v] = container_env_key - ''' + i[v] = container_env_key + mounts = list(filter(lambda item: item is not None, mounts)) mount_string = "" if len(mounts)==0 else ",".join(mounts) From 44be9bd3fb9948d8be29908be26eecd8ee24e2b6 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 00:45:48 +0530 Subject: [PATCH 09/39] update the env key to run command --- automation/script/module_misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/script/module_misc.py b/automation/script/module_misc.py index eb4f37f3a1..0a5f283ea8 100644 --- a/automation/script/module_misc.py +++ b/automation/script/module_misc.py @@ -1916,11 +1916,11 @@ def docker(i): mounts[index] = new_host_mount+":"+new_container_mount if host_env_key: container_env_string += " --env.{}={} ".format(host_env_key, container_env_key) - # check if the below lines are needed when inputs are mapped to container paths for v in docker_input_mapping: if docker_input_mapping[v] == host_env_key: i[v] = container_env_key + i_run_cmd[v] = container_env_key mounts = list(filter(lambda item: item is not None, mounts)) From dc2d75ca2c006664b0818d3854f36a335676bf60 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:47:16 +0530 Subject: [PATCH 10/39] pass uid and gid args to docker run --- script/run-docker-container/customize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/run-docker-container/customize.py b/script/run-docker-container/customize.py index 00ab63c978..2e55978613 100644 --- a/script/run-docker-container/customize.py +++ b/script/run-docker-container/customize.py @@ -120,6 +120,8 @@ def postprocess(i): port_map_cmds = [] run_opts = '' + CM_DOCKER_BUILD_ARGS = env.get('+ CM_DOCKER_BUILD_ARGS', []) + if env.get('CM_DOCKER_PRE_RUN_COMMANDS', []): for pre_run_cmd in env['CM_DOCKER_PRE_RUN_COMMANDS']: run_cmds.append(pre_run_cmd) @@ -246,7 +248,7 @@ def postprocess(i): x2 = " && bash ) || bash" - CONTAINER="docker run " + x1 + " --entrypoint " + x + x + " " + run_opts + " " + docker_image_repo + "/" + docker_image_name + ":" + docker_image_tag + CONTAINER="docker run " + x1 + " --entrypoint " + x + x + " " + CM_DOCKER_BUILD_ARGS + " " + run_opts + " " + docker_image_repo + "/" + docker_image_name + ":" + docker_image_tag CMD = CONTAINER + " bash -c " + x + run_cmd_prefix + run_cmd + x2 + x print ('') From 97ccbc9baf67d2cf353cd040bc6064f7cdd32434 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:54:20 +0530 Subject: [PATCH 11/39] added docker run args --- automation/script/module_misc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/automation/script/module_misc.py b/automation/script/module_misc.py index 0a5f283ea8..6479125fcd 100644 --- a/automation/script/module_misc.py +++ b/automation/script/module_misc.py @@ -1941,10 +1941,12 @@ def docker(i): docker_use_host_group_id = i.get('docker_use_host_group_id', docker_settings.get('use_host_group_id')) if str(docker_use_host_group_id).lower() not in ['false', 'no', '0'] and os.name != 'nt': env['+ CM_DOCKER_BUILD_ARGS'].append("{}={}".format('GID', '\\" $(id -g $USER) \\"')) + env['+ CM_DOCKER_RUN_ARGS'].append("{}={}".format('GID', '\\" $(id -g $USER) \\"')) docker_use_host_user_id = i.get('docker_use_host_user_id', docker_settings.get('use_host_user_id')) if str(docker_use_host_user_id).lower() not in ['false', 'no', '0'] and os.name != 'nt': env['+ CM_DOCKER_BUILD_ARGS'].append("{}={}".format('UID', '\\" $(id -u $USER) \\"')) + env['+ CM_DOCKER_RUN_ARGS'].append("{}={}".format('UID', '\\" $(id -u $USER) \\"')) docker_base_image = i.get('docker_base_image', docker_settings.get('base_image')) docker_os = i.get('docker_os', docker_settings.get('os', 'ubuntu')) From 1634d68f8f57b0f1845dadc6453cacd71366ecb8 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:55:54 +0530 Subject: [PATCH 12/39] Updated build to run args --- script/run-docker-container/customize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/run-docker-container/customize.py b/script/run-docker-container/customize.py index 2e55978613..5b4a1b1c05 100644 --- a/script/run-docker-container/customize.py +++ b/script/run-docker-container/customize.py @@ -120,7 +120,7 @@ def postprocess(i): port_map_cmds = [] run_opts = '' - CM_DOCKER_BUILD_ARGS = env.get('+ CM_DOCKER_BUILD_ARGS', []) + CM_DOCKER_RUN_ARGS = env.get('+ CM_DOCKER_RUN_ARGS', []) if env.get('CM_DOCKER_PRE_RUN_COMMANDS', []): for pre_run_cmd in env['CM_DOCKER_PRE_RUN_COMMANDS']: @@ -248,7 +248,7 @@ def postprocess(i): x2 = " && bash ) || bash" - CONTAINER="docker run " + x1 + " --entrypoint " + x + x + " " + CM_DOCKER_BUILD_ARGS + " " + run_opts + " " + docker_image_repo + "/" + docker_image_name + ":" + docker_image_tag + CONTAINER="docker run " + x1 + " --entrypoint " + x + x + " " + CM_DOCKER_RUN_ARGS + " " + run_opts + " " + docker_image_repo + "/" + docker_image_name + ":" + docker_image_tag CMD = CONTAINER + " bash -c " + x + run_cmd_prefix + run_cmd + x2 + x print ('') From 5795ff365dd1d8f2f2275ccd25d221996d0b2409 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:57:49 +0530 Subject: [PATCH 13/39] Update module_misc.py --- automation/script/module_misc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/automation/script/module_misc.py b/automation/script/module_misc.py index 6479125fcd..210557af03 100644 --- a/automation/script/module_misc.py +++ b/automation/script/module_misc.py @@ -1932,6 +1932,9 @@ def docker(i): if env.get('+ CM_DOCKER_BUILD_ARGS', []) == []: env['+ CM_DOCKER_BUILD_ARGS'] = [] + if env.get('+ CM_DOCKER_RUN_ARGS', []) == []: + env['+ CM_DOCKER_RUN_ARGS'] = [] + for key in proxy_keys: if os.environ.get(key, '') != '': value = os.environ[key] From 7d6ee2bbaffd444f55a28135d7ff1bc207454878 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:38:28 +0530 Subject: [PATCH 14/39] clean the contents rather than the main submission folder --- script/generate-mlperf-inference-submission/customize.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/customize.py b/script/generate-mlperf-inference-submission/customize.py index f82893e39a..665a889088 100644 --- a/script/generate-mlperf-inference-submission/customize.py +++ b/script/generate-mlperf-inference-submission/customize.py @@ -70,7 +70,13 @@ def generate_submission(i): print ('=================================================') print ('Cleaning {} ...'.format(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'])) if os.path.exists(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): - shutil.rmtree(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']) + # delete the content keeping the main folder intact + for items in os.listdir(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): + item_path = os.path.join(folder_path, item) + if os.path.isdir(item_path): + shutil.rmtree(item_path) + else: + os.remove(item_path) print ('=================================================') if not os.path.isdir(submission_dir): From cb818165307f84f6ce05be70757317b3075e0701 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 22:02:59 +0530 Subject: [PATCH 15/39] update-prevent deletion of entire directory --- .../customize.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/script/preprocess-mlperf-inference-submission/customize.py b/script/preprocess-mlperf-inference-submission/customize.py index 03bca7cd9b..216d7e77bf 100644 --- a/script/preprocess-mlperf-inference-submission/customize.py +++ b/script/preprocess-mlperf-inference-submission/customize.py @@ -37,7 +37,22 @@ def postprocess(i): submission_processed = submission_dir + "_processed" shutil.copytree(submission_dir, submission_backup) - shutil.rmtree(submission_dir) - os.rename(submission_processed, submission_dir) - + + # clean the submission directory + for item in os.listdir(submission_dir): + item_path = os.path.join(submission_dir, item) + if os.path.isdir(item_path): + shutil.rmtree(item_path) + else: + os.remove(item_path) + + # copy the files from submission processed directory to submission directory + for item in os.listdir(submission_processed): + source = os.path.join(submission_processed, item) + destination = os.path.join(submission_dir, item) + if os.path.isdir(source): + shutil.copytree(source, destination) # Copy entire directory + else: + shutil.copy2(source, destination) # Copy individual files + return {'return':0} From fc4fea3ccb27e5a0a673ee81e2945aeaa99ffd86 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 22:20:59 +0530 Subject: [PATCH 16/39] test commit --- script/preprocess-mlperf-inference-submission/customize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/preprocess-mlperf-inference-submission/customize.py b/script/preprocess-mlperf-inference-submission/customize.py index 216d7e77bf..b370370f50 100644 --- a/script/preprocess-mlperf-inference-submission/customize.py +++ b/script/preprocess-mlperf-inference-submission/customize.py @@ -53,6 +53,6 @@ def postprocess(i): if os.path.isdir(source): shutil.copytree(source, destination) # Copy entire directory else: - shutil.copy2(source, destination) # Copy individual files + shutil.copy(source, destination) # Copy individual files return {'return':0} From fd70fcfe0c98900fce91fe7004ddd5ffec486d1c Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Fri, 1 Nov 2024 23:56:00 +0530 Subject: [PATCH 17/39] bug fix --- script/generate-mlperf-inference-submission/customize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/customize.py b/script/generate-mlperf-inference-submission/customize.py index 665a889088..ef6e97c7b2 100644 --- a/script/generate-mlperf-inference-submission/customize.py +++ b/script/generate-mlperf-inference-submission/customize.py @@ -72,7 +72,7 @@ def generate_submission(i): if os.path.exists(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): # delete the content keeping the main folder intact for items in os.listdir(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): - item_path = os.path.join(folder_path, item) + item_path = os.path.join(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'], item) if os.path.isdir(item_path): shutil.rmtree(item_path) else: From 8cf8d56dd67339bac93c021a416dc3958e32773e Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Sat, 2 Nov 2024 00:11:02 +0530 Subject: [PATCH 18/39] bug fix --- script/generate-mlperf-inference-submission/customize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/customize.py b/script/generate-mlperf-inference-submission/customize.py index ef6e97c7b2..10fde422a2 100644 --- a/script/generate-mlperf-inference-submission/customize.py +++ b/script/generate-mlperf-inference-submission/customize.py @@ -71,7 +71,7 @@ def generate_submission(i): print ('Cleaning {} ...'.format(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'])) if os.path.exists(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): # delete the content keeping the main folder intact - for items in os.listdir(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): + for item in os.listdir(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): item_path = os.path.join(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'], item) if os.path.isdir(item_path): shutil.rmtree(item_path) From 941efef8f8e4c2f5249cfca48f7e04a11a8ad4c4 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Sat, 2 Nov 2024 00:50:14 +0530 Subject: [PATCH 19/39] added mount for submission processed --- script/generate-mlperf-inference-submission/_cm.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 8a755379a2..d4859f475a 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -72,7 +72,8 @@ }, "default_env": { "CM_RUN_MLPERF_ACCURACY": "on", - "CM_MLPERF_RUN_STYLE": "valid" + "CM_MLPERF_RUN_STYLE": "valid", + "CM_MLPERF_INFERENCE_SUBMISSION_PROCESSED_DIR": "<<>>_processed" }, "post_deps": [ { @@ -150,7 +151,8 @@ ], "mounts": [ "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", - "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" + "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}", + "${{ CM_MLPERF_INFERENCE_SUBMISSION_PROCESSED_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_PROCESSED_DIR }}" ], "extra_run_args": " --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined", "os": "ubuntu", From 893530e7797f54d25fd516cfd22a1c94b35bbd97 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:30:16 +0530 Subject: [PATCH 20/39] code clean --- automation/script/module_misc.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/automation/script/module_misc.py b/automation/script/module_misc.py index 210557af03..0a5f283ea8 100644 --- a/automation/script/module_misc.py +++ b/automation/script/module_misc.py @@ -1932,9 +1932,6 @@ def docker(i): if env.get('+ CM_DOCKER_BUILD_ARGS', []) == []: env['+ CM_DOCKER_BUILD_ARGS'] = [] - if env.get('+ CM_DOCKER_RUN_ARGS', []) == []: - env['+ CM_DOCKER_RUN_ARGS'] = [] - for key in proxy_keys: if os.environ.get(key, '') != '': value = os.environ[key] @@ -1944,12 +1941,10 @@ def docker(i): docker_use_host_group_id = i.get('docker_use_host_group_id', docker_settings.get('use_host_group_id')) if str(docker_use_host_group_id).lower() not in ['false', 'no', '0'] and os.name != 'nt': env['+ CM_DOCKER_BUILD_ARGS'].append("{}={}".format('GID', '\\" $(id -g $USER) \\"')) - env['+ CM_DOCKER_RUN_ARGS'].append("{}={}".format('GID', '\\" $(id -g $USER) \\"')) docker_use_host_user_id = i.get('docker_use_host_user_id', docker_settings.get('use_host_user_id')) if str(docker_use_host_user_id).lower() not in ['false', 'no', '0'] and os.name != 'nt': env['+ CM_DOCKER_BUILD_ARGS'].append("{}={}".format('UID', '\\" $(id -u $USER) \\"')) - env['+ CM_DOCKER_RUN_ARGS'].append("{}={}".format('UID', '\\" $(id -u $USER) \\"')) docker_base_image = i.get('docker_base_image', docker_settings.get('base_image')) docker_os = i.get('docker_os', docker_settings.get('os', 'ubuntu')) From de29f11529aa56c361cd0bfafcc68e61f21a7ee1 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:31:31 +0530 Subject: [PATCH 21/39] code clean --- script/run-docker-container/customize.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/script/run-docker-container/customize.py b/script/run-docker-container/customize.py index 5b4a1b1c05..00ab63c978 100644 --- a/script/run-docker-container/customize.py +++ b/script/run-docker-container/customize.py @@ -120,8 +120,6 @@ def postprocess(i): port_map_cmds = [] run_opts = '' - CM_DOCKER_RUN_ARGS = env.get('+ CM_DOCKER_RUN_ARGS', []) - if env.get('CM_DOCKER_PRE_RUN_COMMANDS', []): for pre_run_cmd in env['CM_DOCKER_PRE_RUN_COMMANDS']: run_cmds.append(pre_run_cmd) @@ -248,7 +246,7 @@ def postprocess(i): x2 = " && bash ) || bash" - CONTAINER="docker run " + x1 + " --entrypoint " + x + x + " " + CM_DOCKER_RUN_ARGS + " " + run_opts + " " + docker_image_repo + "/" + docker_image_name + ":" + docker_image_tag + CONTAINER="docker run " + x1 + " --entrypoint " + x + x + " " + run_opts + " " + docker_image_repo + "/" + docker_image_name + ":" + docker_image_tag CMD = CONTAINER + " bash -c " + x + run_cmd_prefix + run_cmd + x2 + x print ('') From 324df6cb56c463a4d0ff216076cfbc7ff13d2daf Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:16:51 +0530 Subject: [PATCH 22/39] code clean --- .../customize.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/script/preprocess-mlperf-inference-submission/customize.py b/script/preprocess-mlperf-inference-submission/customize.py index b370370f50..a4bb876622 100644 --- a/script/preprocess-mlperf-inference-submission/customize.py +++ b/script/preprocess-mlperf-inference-submission/customize.py @@ -4,6 +4,14 @@ from os.path import exists import shutil +def clean_dir(dir_name): + for item in os.listdir(dir_name): + item_path = os.path.join(dir_name, item) + if os.path.isdir(item_path): + shutil.rmtree(item_path) + else: + os.remove(item_path) + def preprocess(i): os_info = i['os_info'] @@ -18,7 +26,7 @@ def preprocess(i): submission_processed = submission_dir + "_processed" if os.path.exists(submission_processed): - shutil.rmtree(submission_processed) + clean_dir(submission_processed) os.system("rm -rf " + submission_dir + "_processed") @@ -37,14 +45,8 @@ def postprocess(i): submission_processed = submission_dir + "_processed" shutil.copytree(submission_dir, submission_backup) - - # clean the submission directory - for item in os.listdir(submission_dir): - item_path = os.path.join(submission_dir, item) - if os.path.isdir(item_path): - shutil.rmtree(item_path) - else: - os.remove(item_path) + + clean_dir(submission_dir) # copy the files from submission processed directory to submission directory for item in os.listdir(submission_processed): From 569dc1200bdd798b60050632519792bcc810eaf9 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:18:09 +0530 Subject: [PATCH 23/39] Handle dynamic env variables --- automation/script/module.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/automation/script/module.py b/automation/script/module.py index e383653d38..addaddd2eb 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -3982,6 +3982,19 @@ def update_deps(self, i): return {'return':0} + ############################################################################## + def update_state_from_meta(self, meta, env, state, const, const_state, deps, post_deps, prehook_deps, posthook_deps, new_env_keys, new_state_keys, i): + """ + Updates state and env from meta + Args: + """ + + r = update_state_from_meta(meta, env, state, const, const_state, deps, post_deps, prehook_deps, posthook_deps, new_env_keys, new_state_keys, i) + if r['return']>0: + return r + + return {'return':0} + ############################################################################## def get_default_path_list(self, i): default_path_env_key = i.get('default_path_env_key', '') @@ -5235,6 +5248,11 @@ def update_state_from_meta(meta, env, state, const, const_state, deps, post_deps if input_mapping: update_env_from_input_mapping(env, i['input'], input_mapping) + # handle dynamic env values + r = update_env_with_values(env) + if r['return']>0: + return r + # Possibly restrict this to within docker environment add_deps_info = meta.get('ad', i.get('ad', {})) #we need to see input here if not add_deps_info: From 18c284cec72f95f4fffb426ce09ddafd94fecc4e Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:20:31 +0530 Subject: [PATCH 24/39] update state from meta --- automation/script/module_misc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automation/script/module_misc.py b/automation/script/module_misc.py index 0a5f283ea8..400021594b 100644 --- a/automation/script/module_misc.py +++ b/automation/script/module_misc.py @@ -1802,6 +1802,10 @@ def docker(i): state['docker'] = docker_settings add_deps_recursive = i.get('add_deps_recursive', {}) + r = script_automation.update_state_from_meta(meta, env, state, const, const_state, deps = [], post_deps = [], prehook_deps = [], posthook_deps = [], new_env_keys = [], new_state_keys = [], i = i) + if r['return'] > 0: + return r + r = script_automation._update_state_from_variations(i, meta, variation_tags, variations, env, state, const, const_state, deps = [], post_deps = [], prehook_deps = [], posthook_deps = [], new_env_keys_from_meta = [], new_state_keys_from_meta = [], add_deps_recursive = add_deps_recursive, run_state = {}, recursion_spaces='', verbose = False) if r['return'] > 0: return r From 659aeccaf3b5f2df6f10bb0c480174379f91ab66 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:28:01 +0530 Subject: [PATCH 25/39] Added submission base directory --- script/generate-mlperf-inference-submission/_cm.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index d4859f475a..e72916df61 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -53,6 +53,7 @@ "run_style": "CM_MLPERF_RUN_STYLE", "skip_truncation": "CM_SKIP_TRUNCATE_ACCURACY", "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", + "submission_base_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", "clean": "CM_MLPERF_CLEAN_SUBMISSION_DIR", "hw_name": "CM_HW_NAME", "sw_notes_extra": "CM_MLPERF_SUT_SW_NOTES_EXTRA", @@ -72,8 +73,7 @@ }, "default_env": { "CM_RUN_MLPERF_ACCURACY": "on", - "CM_MLPERF_RUN_STYLE": "valid", - "CM_MLPERF_INFERENCE_SUBMISSION_PROCESSED_DIR": "<<>>_processed" + "CM_MLPERF_RUN_STYLE": "valid" }, "post_deps": [ { @@ -150,9 +150,8 @@ "cm pull repo" ], "mounts": [ - "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", - "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}", - "${{ CM_MLPERF_INFERENCE_SUBMISSION_PROCESSED_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_PROCESSED_DIR }}" + "${{ CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR }}", + "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" ], "extra_run_args": " --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined", "os": "ubuntu", From 536b9ffc401902833f7f15016ed785903dcb352e Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:35:47 +0530 Subject: [PATCH 26/39] seperated inp through cm.access --- automation/script/module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/automation/script/module.py b/automation/script/module.py index addaddd2eb..7a47da86ce 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -5244,9 +5244,12 @@ def update_state_from_meta(meta, env, state, const, const_state, deps, post_deps r4 = update_deps(posthook_deps, add_deps_info, True, env) if r1['return']>0 and r2['return']>0 and r3['return'] > 0 and r4['return'] > 0: return r1 + # i would have 'input' when called through cm.access + input_update_env = i.get('input', i) + input_mapping = meta.get('input_mapping', {}) if input_mapping: - update_env_from_input_mapping(env, i['input'], input_mapping) + update_env_from_input_mapping(env, input_update_env, input_mapping) # handle dynamic env values r = update_env_with_values(env) From 3f521c6435112d89aaeb402d8652ecbcc59ee6e0 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:37:49 +0530 Subject: [PATCH 27/39] fix typo --- script/generate-mlperf-inference-submission/_cm.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index e72916df61..6f7e484bd0 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -53,7 +53,7 @@ "run_style": "CM_MLPERF_RUN_STYLE", "skip_truncation": "CM_SKIP_TRUNCATE_ACCURACY", "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", - "submission_base_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", + "submission_base_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", "clean": "CM_MLPERF_CLEAN_SUBMISSION_DIR", "hw_name": "CM_HW_NAME", "sw_notes_extra": "CM_MLPERF_SUT_SW_NOTES_EXTRA", @@ -140,7 +140,7 @@ "tags": "get,mlperf,inference,submission,dir,local", "names": "get-mlperf-inference-submission-dir", "skip_if_env": { - "CM_MLPERF_INFERENCE_SUBMISSION_DIR": [ + "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR": [ "on" ] } From 2377572b2ec9dd7e7082c6bf4c47122207df4623 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:46:50 +0530 Subject: [PATCH 28/39] Supports submission base dir --- .../customize.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/script/generate-mlperf-inference-submission/customize.py b/script/generate-mlperf-inference-submission/customize.py index 10fde422a2..3c03a2dda0 100644 --- a/script/generate-mlperf-inference-submission/customize.py +++ b/script/generate-mlperf-inference-submission/customize.py @@ -65,18 +65,19 @@ def generate_submission(i): env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'] = os.path.join(user_home, "mlperf_submission") submission_dir = env.get('CM_MLPERF_INFERENCE_SUBMISSION_DIR', '') + if submission_dir == '': + submission_base_dir = env.get('CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR', '') + if submission_base_dir == '': + return {'return':1, 'error':f"Both CM_MLPERF_INFERENCE_SUBMISSION_DIR and CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR can not be empty!"} + else: + submission_dir = os.path.join(submission_base_dir, "mlperf_inference_submission") + env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'] = submission_dir if env.get('CM_MLPERF_CLEAN_SUBMISSION_DIR','')!='': print ('=================================================') print ('Cleaning {} ...'.format(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'])) - if os.path.exists(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): - # delete the content keeping the main folder intact - for item in os.listdir(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR']): - item_path = os.path.join(env['CM_MLPERF_INFERENCE_SUBMISSION_DIR'], item) - if os.path.isdir(item_path): - shutil.rmtree(item_path) - else: - os.remove(item_path) + if os.path.exists(submission_dir): + shutil.rmtree(submission_dir) print ('=================================================') if not os.path.isdir(submission_dir): From 5fabd94627dedabec5483c643b380db6a536ff11 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:50:04 +0530 Subject: [PATCH 29/39] code clean --- .../customize.py | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/script/preprocess-mlperf-inference-submission/customize.py b/script/preprocess-mlperf-inference-submission/customize.py index a4bb876622..c5669338be 100644 --- a/script/preprocess-mlperf-inference-submission/customize.py +++ b/script/preprocess-mlperf-inference-submission/customize.py @@ -4,14 +4,6 @@ from os.path import exists import shutil -def clean_dir(dir_name): - for item in os.listdir(dir_name): - item_path = os.path.join(dir_name, item) - if os.path.isdir(item_path): - shutil.rmtree(item_path) - else: - os.remove(item_path) - def preprocess(i): os_info = i['os_info'] @@ -26,7 +18,7 @@ def preprocess(i): submission_processed = submission_dir + "_processed" if os.path.exists(submission_processed): - clean_dir(submission_processed) + shutil.rmtree(submission_processed) os.system("rm -rf " + submission_dir + "_processed") @@ -45,16 +37,7 @@ def postprocess(i): submission_processed = submission_dir + "_processed" shutil.copytree(submission_dir, submission_backup) - - clean_dir(submission_dir) - - # copy the files from submission processed directory to submission directory - for item in os.listdir(submission_processed): - source = os.path.join(submission_processed, item) - destination = os.path.join(submission_dir, item) - if os.path.isdir(source): - shutil.copytree(source, destination) # Copy entire directory - else: - shutil.copy(source, destination) # Copy individual files + shutil.rmtree(submission_dir) + os.rename(submission_processed, submission_dir) return {'return':0} From c95819c7f807992990062cae70b56eb97ed74ef8 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:16:46 +0530 Subject: [PATCH 30/39] consider base submission dir as output dir --- script/tar-my-folder/customize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/tar-my-folder/customize.py b/script/tar-my-folder/customize.py index d405e76fdb..3f8760d567 100644 --- a/script/tar-my-folder/customize.py +++ b/script/tar-my-folder/customize.py @@ -11,7 +11,7 @@ def preprocess(i): input_dir = env.get("CM_TAR_INPUT_DIR", "") if input_dir == "": return {'return': 1, 'error': 'Please set CM_TAR_INPUT_DIR'} - output_dir = env.get("CM_TAR_OUTPUT_DIR", "") + output_dir = env.get("CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", env.get("CM_TAR_OUTPUT_DIR", "")) if output_dir == "": output_dir = os.getcwd() output_file = env.get("CM_TAR_OUTFILE", "") From 4ee37338c0a68a1b2533a862472e42f457308d33 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:21:23 +0530 Subject: [PATCH 31/39] fix typo --- script/generate-mlperf-inference-submission/_cm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 6f7e484bd0..6cfb98ce41 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -159,7 +159,7 @@ "cm_repo_branch": "mlperf-inference", "os_version": "22.04", "docker_input_mapping": { - "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", + "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", "results_dir": "CM_MLPERF_INFERENCE_RESULTS_DIR_" } } From 1df3eb1ade2e5d5b7f173cb0e3a040f8ba2bf45a Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:31:06 +0530 Subject: [PATCH 32/39] bug fix --- script/generate-mlperf-inference-submission/_cm.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 6cfb98ce41..d8f3293190 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -139,9 +139,12 @@ { "tags": "get,mlperf,inference,submission,dir,local", "names": "get-mlperf-inference-submission-dir", - "skip_if_env": { + "skip_if_any_env": { "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR": [ "on" + ], + "CM_MLPERF_INFERENCE_SUBMISSION_DIR": [ + "on" ] } } @@ -150,6 +153,7 @@ "cm pull repo" ], "mounts": [ + "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", "${{ CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR }}", "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" ], @@ -160,6 +164,7 @@ "os_version": "22.04", "docker_input_mapping": { "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", + "submission_base_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", "results_dir": "CM_MLPERF_INFERENCE_RESULTS_DIR_" } } From a96d211fd28cb1eae889461016d6ee8d0598050a Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:33:25 +0530 Subject: [PATCH 33/39] fix typo --- script/generate-mlperf-inference-submission/_cm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index d8f3293190..af5a61c399 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -163,7 +163,7 @@ "cm_repo_branch": "mlperf-inference", "os_version": "22.04", "docker_input_mapping": { - "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", + "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", "submission_base_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", "results_dir": "CM_MLPERF_INFERENCE_RESULTS_DIR_" } From 87ccbe0383bf4e3ebfa6f947ace07af3fbd4e725 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:22:09 +0530 Subject: [PATCH 34/39] submission base dir -> tar output --- script/run-mlperf-inference-submission-checker/_cm.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/run-mlperf-inference-submission-checker/_cm.json b/script/run-mlperf-inference-submission-checker/_cm.json index ab57623799..53129a7eca 100644 --- a/script/run-mlperf-inference-submission-checker/_cm.json +++ b/script/run-mlperf-inference-submission-checker/_cm.json @@ -68,6 +68,9 @@ "yes" ] }, + "env": { + "CM_TAR_OUTPUT_DIR": "<<>>" + }, "tags": "run,tar" } ], From 152712fad8ab04a4793417c09f779de93c68f31c Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:23:07 +0530 Subject: [PATCH 35/39] revert commit https://github.com/mlcommons/cm4mlops/pull/486/commits/c95819c7f807992990062cae70b56eb97ed74ef8 --- script/tar-my-folder/customize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/tar-my-folder/customize.py b/script/tar-my-folder/customize.py index 3f8760d567..d405e76fdb 100644 --- a/script/tar-my-folder/customize.py +++ b/script/tar-my-folder/customize.py @@ -11,7 +11,7 @@ def preprocess(i): input_dir = env.get("CM_TAR_INPUT_DIR", "") if input_dir == "": return {'return': 1, 'error': 'Please set CM_TAR_INPUT_DIR'} - output_dir = env.get("CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", env.get("CM_TAR_OUTPUT_DIR", "")) + output_dir = env.get("CM_TAR_OUTPUT_DIR", "") if output_dir == "": output_dir = os.getcwd() output_file = env.get("CM_TAR_OUTFILE", "") From a89fa43fb247621581af431845bb9f16a7867d20 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:27:14 +0530 Subject: [PATCH 36/39] get submission directory if base dir not specified - docker --- script/generate-mlperf-inference-submission/_cm.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index af5a61c399..96e9e6ca87 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -142,9 +142,6 @@ "skip_if_any_env": { "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR": [ "on" - ], - "CM_MLPERF_INFERENCE_SUBMISSION_DIR": [ - "on" ] } } From bfe6cb64a1dc75007e8f50798ba432a2dfae593d Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:45:17 +0530 Subject: [PATCH 37/39] add tar output dir --- script/run-mlperf-inference-submission-checker/customize.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/run-mlperf-inference-submission-checker/customize.py b/script/run-mlperf-inference-submission-checker/customize.py index 1781385c59..c0e943c75e 100644 --- a/script/run-mlperf-inference-submission-checker/customize.py +++ b/script/run-mlperf-inference-submission-checker/customize.py @@ -95,6 +95,9 @@ def postprocess(i): if x!='': env['CM_TAR_OUTFILE']=x + if env.get('CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR', '') != '': + env['CM_TAR_OUTPUT_DIR'] = env['CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR'] + x=env.get('MLPERF_INFERENCE_SUBMISSION_SUMMARY','') if x!='': for y in ['.csv', '.json', '.xlsx']: From 6e48bdd1d631b0258410c971393abe725e9c1f80 Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:45:35 +0530 Subject: [PATCH 38/39] Update _cm.json --- script/run-mlperf-inference-submission-checker/_cm.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/script/run-mlperf-inference-submission-checker/_cm.json b/script/run-mlperf-inference-submission-checker/_cm.json index 53129a7eca..ab57623799 100644 --- a/script/run-mlperf-inference-submission-checker/_cm.json +++ b/script/run-mlperf-inference-submission-checker/_cm.json @@ -68,9 +68,6 @@ "yes" ] }, - "env": { - "CM_TAR_OUTPUT_DIR": "<<>>" - }, "tags": "run,tar" } ], From ab2f5283a08b01f1efc0cc45906c0d7b6376192e Mon Sep 17 00:00:00 2001 From: ANANDHU S <71482562+anandhu-eng@users.noreply.github.com> Date: Tue, 5 Nov 2024 22:21:34 +0530 Subject: [PATCH 39/39] code clean --- script/generate-mlperf-inference-submission/_cm.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/script/generate-mlperf-inference-submission/_cm.json b/script/generate-mlperf-inference-submission/_cm.json index 96e9e6ca87..2a51f764b3 100644 --- a/script/generate-mlperf-inference-submission/_cm.json +++ b/script/generate-mlperf-inference-submission/_cm.json @@ -150,17 +150,15 @@ "cm pull repo" ], "mounts": [ - "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}", "${{ CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR }}", "${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR_ }}" ], - "extra_run_args": " --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined", + "extra_run_args": " --cap-add SYS_ADMIN", "os": "ubuntu", "cm_repo": "mlcommons@cm4mlops", "cm_repo_branch": "mlperf-inference", "os_version": "22.04", "docker_input_mapping": { - "submission_dir": "CM_MLPERF_INFERENCE_SUBMISSION_DIR", "submission_base_dir": "CM_MLPERF_INFERENCE_SUBMISSION_BASE_DIR", "results_dir": "CM_MLPERF_INFERENCE_RESULTS_DIR_" }