diff --git a/.github/workflows/test-mlperf-inference-mil-cpp-resnet50.yml b/.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml similarity index 82% rename from .github/workflows/test-mlperf-inference-mil-cpp-resnet50.yml rename to .github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml index 6a499d5a41..a28e86825f 100644 --- a/.github/workflows/test-mlperf-inference-mil-cpp-resnet50.yml +++ b/.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml @@ -1,13 +1,13 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: MLPerf inference MIL C++ ResNet50 +name: MLPerf inference MLCommons C++ ResNet50 on: pull_request: branches: [ "master", "dev" ] paths: - - '.github/workflows/test-mlperf-inference-mil-cpp-resnet50.yml' + - '.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml' - 'cm-mlops/**' - '!cm-mlops/**.md' @@ -33,6 +33,6 @@ jobs: cm pull repo --url=${{ github.event.pull_request.head.repo.html_url }} --checkout=${{ github.event.pull_request.head.ref }} cm run script --quiet --tags=get,sys-utils-cm cm run script --quiet --tags=install,prebuilt,llvm --version=${{ matrix.llvm-version }} - - name: Test MLPerf Inference MIL C++ ResNet50 + - name: Test MLPerf Inference MLCommons C++ ResNet50 run: | - cmr "app mlperf inference cpp" -v --quiet + cmr "app mlperf inference mlcommons cpp" -v --quiet diff --git a/cm-mlops/script/app-mlperf-inference-nvidia/_cm.yaml b/cm-mlops/script/app-mlperf-inference-nvidia/_cm.yaml index fcd72d446f..20adcb0a0b 100644 --- a/cm-mlops/script/app-mlperf-inference-nvidia/_cm.yaml +++ b/cm-mlops/script/app-mlperf-inference-nvidia/_cm.yaml @@ -440,13 +440,13 @@ variations: gptj_,build: deps: - - tags: install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1-gptj + - tags: install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1 - tags: get,cmake version_min: "3.25.0" gptj_,build_engine: deps: - - tags: install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1-gptj + - tags: install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1 - tags: get,cmake version_min: "3.25.0" diff --git a/cm-mlops/script/app-mlperf-inference-nvidia/customize.py b/cm-mlops/script/app-mlperf-inference-nvidia/customize.py index 4983e45fe3..2d995af9c4 100644 --- a/cm-mlops/script/app-mlperf-inference-nvidia/customize.py +++ b/cm-mlops/script/app-mlperf-inference-nvidia/customize.py @@ -175,6 +175,9 @@ def preprocess(i): return {'return':0} elif make_command == "preprocess_data": + if env['CM_MODEL'] == "rnnt": + cmds.append(f"rm -rf {os.path.join(env['MLPERF_SCRATCH_PATH'], 'preprocessed_data', 'rnnt_dev_clean_500_raw')}") + cmds.append(f"rm -rf {os.path.join(env['MLPERF_SCRATCH_PATH'], 'preprocessed_data', 'rnnt_train_clean_512_wav')}") cmds.append(f"make preprocess_data BENCHMARKS='{model_name}'") else: diff --git a/cm-mlops/script/app-mlperf-inference/_cm.yaml b/cm-mlops/script/app-mlperf-inference/_cm.yaml index 01f00a526b..5ce89d9608 100644 --- a/cm-mlops/script/app-mlperf-inference/_cm.yaml +++ b/cm-mlops/script/app-mlperf-inference/_cm.yaml @@ -237,9 +237,18 @@ variations: nvidia-original: docker: + interactive: True extra_run_args: ' --runtime=nvidia --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined' base_image: nvcr.io/nvidia/mlperf/mlperf-inference:mlpinf-v3.1-cuda12.2-cudnn8.9-x86_64-ubuntu20.04-l4-public docker:os_version: "20.04" + deps: + - tags: get,mlperf,inference,nvidia,scratch,space + - tags: get,nvidia-docker + mounts: + - "${{ CM_CUDNN_TAR_FILE_PATH }}:${{ CM_CUDNN_TAR_FILE_PATH }}" + - "${{ CM_TENSORRT_TAR_FILE_PATH }}:${{ CM_TENSORRT_TAR_FILE_PATH }}" + - "${{ CUDA_RUN_FILE_LOCAL_PATH }}:${{ CUDA_RUN_FILE_LOCAL_PATH }}" + - "${{ MLPERF_SCRATCH_PATH }}:${{ MLPERF_SCRATCH_PATH }}" default_variations: backend: tensorrt device: cuda @@ -271,7 +280,7 @@ variations: - nvidia-original-mlperf-inference - nvidia-harness - mlperf-inference-implementation - tags: reproduce,mlperf,nvidia,inference + tags: reproduce,mlperf,nvidia,inference,_run_harness skip_if_env: CM_SKIP_RUN: - yes @@ -301,6 +310,8 @@ variations: - yes env: CM_MLPERF_IMPLEMENTATION: intel + docker: + interactive: True qualcomm: alias: kilt @@ -322,6 +333,8 @@ variations: - yes env: CM_MLPERF_IMPLEMENTATION: qualcomm + docker: + interactive: True kilt,qualcomm,resnet50: default_variations: @@ -1161,12 +1174,21 @@ gui: title: "CM GUI for the MLPerf inference benchmark" docker: + deps: + - tags: get,mlperf,inference,results,dir + - tags: get,mlperf,inference,submission,dir + mounts: + - "${{ IMAGENET_PATH }}:/data/imagenet-val" + - "${{ CM_MLPERF_INFERENCE_RESULTS_DIR }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR }}" + - "${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ CM_MLPERF_INFERENCE_SUBMISSION_DIR }}" + - "${{ RESULTS_DIR }}:/home/cmuser/results_dir" + - "${{ SUBMISSION_DIR }}:/home/cmuser/submission_dir" + - "${{ DLRM_DATA_PATH }}:/home/mlperf_inf_dlrmv2" skip_run_cmd: 'no' shm_size: '32gb' extra_run_args: ' --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined' docker_os: ubuntu docker_real_run: False - interactive: True docker_os_version: '22.04' docker_input_mapping: imagenet_path: IMAGENET_PATH diff --git a/cm-mlops/script/app-mlperf-inference/customize.py b/cm-mlops/script/app-mlperf-inference/customize.py index a086c4f357..23a7f75ce8 100644 --- a/cm-mlops/script/app-mlperf-inference/customize.py +++ b/cm-mlops/script/app-mlperf-inference/customize.py @@ -15,7 +15,7 @@ def preprocess(i): env = i['env'] state = i['state'] - if env.get('CM_MLPERF_IMPLEMENTATION', '') == 'nvidia-original': + if env.get('CM_MLPERF_IMPLEMENTATION', '') == 'nvidia': if env.get('CM_NVIDIA_GPU_NAME', '') in [ "rtx_4090", "a100", "t4", "l4", "orin", "custom" ]: env['CM_NVIDIA_HARNESS_GPU_VARIATION'] = "_" + env['CM_NVIDIA_GPU_NAME'] env['CM_NVIDIA_GPU_MEMORY'] = '' diff --git a/cm-mlops/script/build-mlperf-inference-server-nvidia/_cm.yaml b/cm-mlops/script/build-mlperf-inference-server-nvidia/_cm.yaml index 2322bfb346..6dd5ebe8e3 100644 --- a/cm-mlops/script/build-mlperf-inference-server-nvidia/_cm.yaml +++ b/cm-mlops/script/build-mlperf-inference-server-nvidia/_cm.yaml @@ -204,9 +204,14 @@ versions: tags: _version.4_0 deps: - tags: install,nccl,libs,_cuda - - tags: install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1-gptj + - tags: install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1 names: - pytorch + - torch + - tags: install,torchvision,from.src,_for-nvidia-mlperf-inference-v3.1 + names: + - pytorchvision + - torchvision docker: skip_run_cmd: 'no' @@ -235,8 +240,8 @@ docker: - tags: get,mlperf,inference,submission,dir - tags: get,nvidia-docker pre_run_cmds: - - cm pull repo mlcommons@ck - run_cmd_prefix: sudo apt remove -y cmake && cm pull repo mlcommons@ck + - cm pull repo + run_cmd_prefix: sudo apt remove -y cmake mounts: - "${{ IMAGENET_PATH }}:/data/imagenet-val" - "${{ CM_MLPERF_INFERENCE_RESULTS_DIR }}:${{ CM_MLPERF_INFERENCE_RESULTS_DIR }}" diff --git a/cm-mlops/script/get-generic-python-lib/_cm.json b/cm-mlops/script/get-generic-python-lib/_cm.json index ebc29943d0..5e09924692 100644 --- a/cm-mlops/script/get-generic-python-lib/_cm.json +++ b/cm-mlops/script/get-generic-python-lib/_cm.json @@ -883,7 +883,7 @@ } ], "default_env": { - "CM_GENERIC_PYTHON_PIP_UNINSTALL_DEPS": "torch" + "CM_GENERIC_PYTHON_PIP_UNINSTALL_DEPS1": "torch" }, "env": { "CM_GENERIC_PYTHON_PACKAGE_NAME": "torch", diff --git a/cm-mlops/script/get-generic-python-lib/install.sh b/cm-mlops/script/get-generic-python-lib/install.sh index 5d2614bf24..517a4e7288 100644 --- a/cm-mlops/script/get-generic-python-lib/install.sh +++ b/cm-mlops/script/get-generic-python-lib/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [[ ${CM_GENERIC_PYTHON_PACKAGE_VARIANT} == "nvidia-apex" ]]; then +if [[ ${CM_GENERIC_PYTHON_PACKAGE_VARIANT} == "nvidia-apex-depreciated" ]]; then cd ${CM_GIT_REPO_CHECKOUT_PATH} cmd="${CM_PYTHON_BIN_WITH_PATH} -m pip install -v --disable-pip-version-check --global-option=\"--cpp_ext\" --global-option=\"--cuda_ext\" ./" echo $cmd diff --git a/cm-mlops/script/install-pytorch-from-src/_cm.json b/cm-mlops/script/install-pytorch-from-src/_cm.json index f22b09fbfa..75f15a5018 100644 --- a/cm-mlops/script/install-pytorch-from-src/_cm.json +++ b/cm-mlops/script/install-pytorch-from-src/_cm.json @@ -220,7 +220,7 @@ } ] }, - "for-nvidia-mlperf-inference-v3.1-gptj": { + "for-nvidia-mlperf-inference-v3.1": { "base": [ "sha.b5021ba9", "cuda" diff --git a/cm-mlops/script/install-pytorch-from-src/run.sh b/cm-mlops/script/install-pytorch-from-src/run.sh index 56c4b4f506..3d76b8efd1 100644 --- a/cm-mlops/script/install-pytorch-from-src/run.sh +++ b/cm-mlops/script/install-pytorch-from-src/run.sh @@ -1,17 +1,22 @@ #!/bin/bash CUR_DIR=$PWD -rm -rf pytorch -cp -r ${CM_PYTORCH_SRC_REPO_PATH} pytorch -cd pytorch -git submodule sync -git submodule update --init --recursive -rm -rf build +if [[ ! -e pytorch/dist/torch*.whl ]]; then + rm -rf pytorch + cp -r ${CM_PYTORCH_SRC_REPO_PATH} pytorch + cd pytorch + git submodule sync + git submodule update --init --recursive + rm -rf build + + ${CM_PYTHON_BIN_WITH_PATH} -m pip install -r requirements.txt + test $? -eq 0 || exit $? + ${CM_PYTHON_BIN_WITH_PATH} setup.py bdist_wheel + test $? -eq 0 || exit $? +else + cd pytorch +fi -${CM_PYTHON_BIN_WITH_PATH} -m pip install -r requirements.txt -if [ "${?}" != "0" ]; then exit $?; fi -${CM_PYTHON_BIN_WITH_PATH} setup.py bdist_wheel -test $? -eq 0 || exit $? cd dist ${CM_PYTHON_BIN_WITH_PATH} -m pip install torch-2.*linux_x86_64.whl test $? -eq 0 || exit $? diff --git a/cm-mlops/script/install-torchvision-from-src/_cm.json b/cm-mlops/script/install-torchvision-from-src/_cm.json new file mode 100644 index 0000000000..a474bb484a --- /dev/null +++ b/cm-mlops/script/install-torchvision-from-src/_cm.json @@ -0,0 +1,140 @@ +{ + "alias": "install-torchvision-from-src", + "automation_alias": "script", + "automation_uid": "5b4e0237da074764", + "cache": true, + "category": "Compiler automation", + "deps": [ + { + "tags": "detect,os" + }, + { + "tags": "detect,cpu" + }, + { + "names": [ + "python", + "python3" + ], + "skip_if_env": { + "CM_CONDA_ENV": [ + "yes" + ] + }, + "tags": "get,python3" + }, + { + "env": { + "CM_GIT_CHECKOUT_PATH_ENV_NAME": "CM_PYTORCH_VISION_SRC_REPO_PATH" + }, + "extra_cache_tags": "pytorchvision,torchvision,torchvision-src,src,pytorchvision-src,pytorchvision-src-repo", + "names": [ + "pytorchision-src-repo", + "torchision-src-repo" + ], + "tags": "get,git,repo", + "update_tags_from_env_with_prefix": { + "_branch.": [ + "CM_GIT_CHECKOUT" + ], + "_repo.": [ + "CM_GIT_URL" + ], + "_sha.": [ + "CM_GIT_CHECKOUT_SHA" + ], + "_tag.": [ + "CM_GIT_CHECKOUT_TAG" + ] + } + } + ], + "env": { + "CM_GIT_URL": "https://github.com/pytorch/vision" + }, + "name": "Build pytorchvision from sources", + "new_env_keys": [ + "CM_PYTORCHVISION_*" + ], + "prehook_deps": [], + "sort": 1000, + "tags": [ + "install", + "get", + "src", + "from.src", + "pytorchvision", + "torchvision", + "src-pytorchvision" + ], + "uid": "68b855780d474546", + "variations": { + "branch.#": { + "env": { + "CM_GIT_CHECKOUT": "#" + } + }, + "cuda": { + "deps": [ + { + "names": [ + "cuda" + ], + "tags": "get,cuda,_cudnn" + } + ], + "env": { + "CUDA_HOME": "<<>>", + "CUDA_NVCC_EXECUTABLE": "<<>>", + "CUDNN_INCLUDE_PATH": "<<>>", + "CUDNN_LIBRARY_PATH": "<<>>", + "USE_CUDA": "1", + "USE_CUDNN": "1", + "TORCH_CUDA_ARCH_LIST": "Ampere Ada Hopper", + "TORCH_CXX_FLAGS": "-D_GLIBCXX_USE_CXX11_ABI=1" + } + }, + "for-nvidia-mlperf-inference-v3.1": { + "base": [ + "sha.657027f3", + "cuda" + ], + "deps": [ + { + "tags": "install,pytorch,from.src,_for-nvidia-mlperf-inference-v3.1" + } + ], + "env": { + } + }, + "repo.#": { + "env": { + "CM_GIT_URL": "#" + }, + "group": "repo" + }, + "repo.https://github.com/pytorch/vision": { + "default": true, + "env": { + "CM_GIT_URL": "https://github.com/pytorch/vision" + }, + "group": "repo" + }, + "sha.#": { + "env": { + "CM_GIT_CHECKOUT_SHA": "#" + } + }, + "tag.#": { + "ad": { + "pytorch-src-repo": { + "tags": "_no-recurse-submodules,_full-history" + } + }, + "env": { + "CM_GIT_CHECKOUT_TAG": "#" + } + } + }, + "versions": {} +} diff --git a/cm-mlops/script/install-torchvision-from-src/customize.py b/cm-mlops/script/install-torchvision-from-src/customize.py new file mode 100644 index 0000000000..a4963cca9a --- /dev/null +++ b/cm-mlops/script/install-torchvision-from-src/customize.py @@ -0,0 +1,26 @@ +from cmind import utils +import os + +def preprocess(i): + + os_info = i['os_info'] + + if os_info['platform'] == 'windows': + return {'return':1, 'error': 'Windows is not supported in this script yet'} + + env = i['env'] + + if env.get('CM_MLPERF_INFERENCE_INTEL', '') == "yes": + i['run_script_input']['script_name'] = "run-intel-mlperf-inference-v3_1" + run_cmd="CC=clang CXX=clang++ USE_CUDA=OFF python -m pip install -e . " + + env['CM_RUN_CMD'] = run_cmd + + automation = i['automation'] + + recursion_spaces = i['recursion_spaces'] + + return {'return':0} + +def postprocess(i): + return {'return':0} diff --git a/cm-mlops/script/install-torchvision-from-src/run.sh b/cm-mlops/script/install-torchvision-from-src/run.sh new file mode 100644 index 0000000000..06de574ada --- /dev/null +++ b/cm-mlops/script/install-torchvision-from-src/run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +CUR_DIR=$PWD +rm -rf pytorchvision +cp -r ${CM_PYTORCH_VISION_SRC_REPO_PATH} pytorchvision +cd pytorchvision +test "${?}" -eq "0" || exit $? +rm -rf build + +python setup.py bdist_wheel +test "${?}" -eq "0" || exit $? +cd dist +python3 -m pip install torchvision*linux_x86_64.whl +test "${?}" -eq "0" || exit $? diff --git a/cm-mlops/script/run-docker-container/customize.py b/cm-mlops/script/run-docker-container/customize.py index cfaa7d7730..8348ce0ce6 100644 --- a/cm-mlops/script/run-docker-container/customize.py +++ b/cm-mlops/script/run-docker-container/customize.py @@ -113,6 +113,7 @@ def postprocess(i): run_cmds.append(post_run_cmd) run_cmd = " && ".join(run_cmds) + run_cmd = run_cmd.replace("--docker_run_deps", "") if mount_cmds: for mount_cmd in mount_cmds: diff --git a/cm-mlops/script/run-mlperf-inference-app/_cm.yaml b/cm-mlops/script/run-mlperf-inference-app/_cm.yaml index 8456e195cb..f7c25071bf 100644 --- a/cm-mlops/script/run-mlperf-inference-app/_cm.yaml +++ b/cm-mlops/script/run-mlperf-inference-app/_cm.yaml @@ -97,11 +97,17 @@ new_state_keys: deps: - tags: detect,os + skip_if_env: + CM_MLPERF_USE_DOCKER: [ on ] - tags: detect,cpu + skip_if_env: + CM_MLPERF_USE_DOCKER: [ on ] - names: - python - python3 tags: get,python3 + skip_if_env: + CM_MLPERF_USE_DOCKER: [ on ] - names: - inference-src tags: get,mlcommons,inference,src @@ -110,6 +116,8 @@ deps: - tags: get,mlperf,inference,results,dir names: - get-mlperf-inference-results-dir + enable_if_env: + CM_MLPERF_USE_DOCKER: [ off ] skip_if_env: OUTPUT_BASE_DIR: [ on ] - tags: install,pip-package,for-cmind-python,_package.tabulate diff --git a/cm-mlops/script/run-mlperf-inference-app/customize.py b/cm-mlops/script/run-mlperf-inference-app/customize.py index 039b6d2410..74e7b8c67a 100644 --- a/cm-mlops/script/run-mlperf-inference-app/customize.py +++ b/cm-mlops/script/run-mlperf-inference-app/customize.py @@ -40,11 +40,6 @@ def preprocess(i): if os.path.isfile(z): os.remove(z) - if str(env.get('CM_MLPERF_USE_DOCKER', '')).lower() in [ "1", "true", "yes"]: - action = "docker" - else: - action = "run" - if env.get('CM_MLPERF_SUBMISSION_SYSTEM_TYPE', '') != '': system_type = env['CM_MLPERF_SUBMISSION_SYSTEM_TYPE'] system_meta['system_type'] = system_type @@ -152,6 +147,18 @@ def preprocess(i): print ('=========================================================') + if str(env.get('CM_MLPERF_USE_DOCKER', '')).lower() in [ "1", "true", "yes"]: + action = "docker" + del(env['OUTPUT_BASE_DIR']) + state = {} + docker_extra_input = {} + for k in inp: + if k.startswith("docker_"): + docker_extra_input[k] = inp[k] + inp = {} + else: + action = "run" + #local_keys = [ 'CM_MLPERF_SKIP_RUN', 'CM_MLPERF_LOADGEN_QUERY_COUNT', 'CM_MLPERF_LOADGEN_TARGET_QPS', 'CM_MLPERF_LOADGEN_TARGET_LATENCY' ] for scenario in env['CM_MLPERF_LOADGEN_SCENARIOS']: @@ -178,6 +185,9 @@ def preprocess(i): ii = {'action':action, 'automation':'script', 'tags': scenario_tags, 'quiet': 'true', 'env': copy.deepcopy(env), 'input': inp, 'state': state, 'add_deps': copy.deepcopy(add_deps), 'add_deps_recursive': copy.deepcopy(add_deps_recursive), 'ad': ad, 'adr': copy.deepcopy(adr), 'v': verbose, 'print_env': print_env, 'print_deps': print_deps, 'dump_version_info': dump_version_info} + if action == "docker": + for k in docker_extra_input: + ii[k] = docker_extra_input[k] r = cm.access(ii) if r['return'] > 0: return r @@ -186,9 +196,13 @@ def preprocess(i): for test in test_list: env['CM_MLPERF_LOADGEN_COMPLIANCE_TEST'] = test env['CM_MLPERF_LOADGEN_MODE'] = "compliance" - r = cm.access({'action':action, 'automation':'script', 'tags': scenario_tags, 'quiet': 'true', + ii = {'action':action, 'automation':'script', 'tags': scenario_tags, 'quiet': 'true', 'env': copy.deepcopy(env), 'input': inp, 'state': state, 'add_deps': copy.deepcopy(add_deps), 'add_deps_recursive': - copy.deepcopy(add_deps_recursive), 'adr': copy.deepcopy(adr), 'ad': ad, 'v': verbose, 'print_env': print_env, 'print_deps': print_deps, 'dump_version_info': dump_version_info}) + copy.deepcopy(add_deps_recursive), 'adr': copy.deepcopy(adr), 'ad': ad, 'v': verbose, 'print_env': print_env, 'print_deps': print_deps, 'dump_version_info': dump_version_info} + if action == "docker": + for k in docker_extra_input: + ii[k] = docker_extra_input[k] + r = cm.access(ii) if r['return'] > 0: return r diff --git a/cm/CHANGES.md b/cm/CHANGES.md index 6e051b9b70..8202e9477c 100644 --- a/cm/CHANGES.md +++ b/cm/CHANGES.md @@ -1,3 +1,13 @@ +## V2.0.2 + - added support to update all CM Git repos in one go: "cm pull repo" + - added support to show extra info about CM Git repos: "cm show repo" + - added explicit support for Private Access Token (PAT) when pulling private CM repos: + cm pull repo ctuning@mlcommons-ck-reproduce-inference-v4.0 --pat={GITHUB PAT} + - added support to remove CM repositories via "cm rm repo" even if read only + (required for Windows) + - added support to self-fix CM repo list if repository was manually deleted + + ## V2.0.1 - added setuptools as dependency to detect package versions diff --git a/cm/cmind/__init__.py b/cm/cmind/__init__.py index b92f3fb794..a6fb1ed29a 100644 --- a/cm/cmind/__init__.py +++ b/cm/cmind/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.0.1.1" +__version__ = "2.0.2" from cmind.core import access from cmind.core import error diff --git a/cm/cmind/repo/automation/repo/module.py b/cm/cmind/repo/automation/repo/module.py index b1c3caa68a..907ea3a2d1 100644 --- a/cm/cmind/repo/automation/repo/module.py +++ b/cm/cmind/repo/automation/repo/module.py @@ -24,6 +24,7 @@ def pull(self, i): (artifact) (str): repository name (alias) (url) (str): URL of a repository + (pat) (str): Personal Access Token (if supported and url=='') (branch) (str): Git branch (checkout) (str): Git checkout (depth) (int): Git depth @@ -45,6 +46,7 @@ def pull(self, i): url = i.get('url','') desc = i.get('desc','') prefix = i.get('prefix','') + pat = i.get('pat','') if url == '': if alias != '': @@ -54,6 +56,9 @@ def pull(self, i): alias = self.cmind.cfg['repo_url_org'] + '@' + alias url += alias.replace('@','/') + + if pat != '' and url.startswith('https://'): + url = url[:8]+pat+'@'+url[8:] else: if alias == '': # Get alias from URL @@ -74,37 +79,90 @@ def pull(self, i): alias = alias[j1+1:].replace('/','@') if url == '': - return {'return':1, 'error':'TBD: no URL - need to update all Git repos'} + pull_repos = [] + + for repo in sorted(self.cmind.repos.lst, key = lambda x: x.meta.get('alias','')): + meta = repo.meta + + if meta.get('git', False): + # Note that internal repo alias may not be the same as the real pulled alias since it can be a fork + # Pick it up from the path + + repo_path = repo.path + + pull_repos.append({'alias': os.path.basename(repo_path), + 'path_to_repo': repo_path}) + else: + pull_repos = [{'alias':alias, + 'url':url, + 'branch': i.get('branch', ''), + 'checkout': i.get('checkout', ''), + 'depth': i.get('depth', '')}] - # Branch and checkout - branch = i.get('branch','') - checkout = i.get('checkout','') - depth = i.get('depth','') - if console: - print (self.cmind.cfg['line']) - print ('Alias: {}'.format(alias)) - print ('URL: {}'.format(url)) - print ('Branch: {}'.format(branch)) - print ('Checkout: {}'.format(checkout)) - if depth!='' and depth!=None: - print ('Depth: {}'.format(str(depth))) - print ('') + # Go through repositories and pull + repo_meta = {} + repo_metas = {} + + for repo in pull_repos: + alias = repo['alias'] + url = repo.get('url', '') + branch = repo.get('branch','') + checkout = repo.get('checkout','') + depth = repo.get('depth','') + path_to_repo = repo.get('path_to_repo', None) + + if console: + print (self.cmind.cfg['line']) + print ('Alias: {}'.format(alias)) + if url!='': + print ('URL: {}'.format(url)) + if branch!='': + print ('Branch: {}'.format(branch)) + if checkout!='': + print ('Checkout: {}'.format(checkout)) + if depth!='' and depth!=None: + print ('Depth: {}'.format(str(depth))) + print ('') + + # Prepare path to repo + repos = self.cmind.repos + + r = repos.pull(alias = alias, url = url, branch = branch, checkout = checkout, console = console, + desc=desc, prefix=prefix, depth=depth, path_to_repo=path_to_repo) + if r['return']>0: return r + + repo_meta = r['meta'] + + repo_metas[alias] = repo_meta + + if len(pull_repos)>0 and self.cmind.use_index: + if console: + print (self.cmind.cfg['line']) - # Prepare path to repo - repos = self.cmind.repos + ii = {'out':'con'} if console else {} + rx = self.reindex(ii) - r = repos.pull(alias = alias, url = url, branch = branch, checkout = checkout, console = console, desc=desc, prefix=prefix, depth=depth) - if r['return']>0: return r + return {'return':0, 'meta':repo_meta, 'metas': repo_metas} - repo_meta = r['meta'] + ############################################################ + def show(self, i): + """ + Show verbose info about registered CM repos. - if self.cmind.use_index: - ii = {'out':'con'} if console else {} - rx = self.reindex(ii) + Args: + See "search" action + + Returns: + See "search" action + """ + + i['verbose'] = True + + return self.search(i) - return {'return':0, 'meta':repo_meta} + ############################################################ def search(self, i): """ @@ -178,14 +236,62 @@ def search(self, i): if min_out: print (path) else: - if i.get('verbose',False): + if i.get('verbose', False): uid = meta['uid'] - desc = meta.get('desc','') - git = meta.get('git',False) - + desc = meta.get('desc', '') + git = meta.get('git', False) + prefix = meta.get('prefix', '') + + local_alias = os.path.basename(path) + + if alias == 'local' or alias == 'internal' or local_alias == 'ck': + local_alias = '' + + print (self.cmind.cfg['line']) + print ('Path: {}'.format(path)) + if prefix != '': + print (' CM sub-directory: {}'.format(prefix)) + + if alias != local_alias: + if local_alias!='': + print (' Alias: {}'.format(local_alias)) + print (' Original alias: {}'.format(alias)) + else: + print (' Alias: {}'.format(alias)) + else: + print (' Alias: {}'.format(alias)) + + print (' UID: {}'.format(uid)) + if desc != '': + print ('Description: {}'.format(desc)) + print ('Git: {}'.format(str(git))) + + if git: + url = '' + branch = '' + checkout = '' + + r = self.cmind.access({'action':'system', 'automation':'utils', 'path':path, 'cmd':'git config --get remote.origin.url'}) + if r['return'] == 0 and r['ret'] == 0: + url = r['stdout'] + + r = self.cmind.access({'action':'system', 'automation':'utils', 'path':path, 'cmd':'git rev-parse --abbrev-ref HEAD'}) + if r['return'] == 0 and r['ret'] == 0: + branch = r['stdout'] + + r = self.cmind.access({'action':'system', 'automation':'utils', 'path':path, 'cmd':'git rev-parse HEAD'}) + if r['return'] == 0 and r['ret'] == 0: + checkout = r['stdout'] + + + if url!='': + print (' URL: {}'.format(url)) + if branch!='': + print (' Branch: {}'.format(branch)) + if checkout!='': + print (' Checkout: {}'.format(checkout)) - print ('{},{} "{}" {}'.format(alias, uid, desc, path)) else: print ('{},{} = {}'.format(alias, uid, path)) diff --git a/cm/cmind/repos.py b/cm/cmind/repos.py index 5b31cc6145..fa064aba4f 100644 --- a/cm/cmind/repos.py +++ b/cm/cmind/repos.py @@ -116,6 +116,7 @@ def load(self, init = False): self.paths.insert(0, path_local_repo) # Check that repository exists and load meta description + checked_self_paths = [] for path_to_repo in self.paths: # First try concatenated path and then full path (if imported) found = False @@ -143,9 +144,21 @@ def load(self, init = False): break # Repo path exists but repo itself doesn't exist - fail - if not found: - return {'return':1, 'error': 'repository path {} not found (check file {})'.format(path_to_repo, full_path_to_repo_paths)} + if found: + checked_self_paths.append(path_to_repo) + else: + print ('WARNING: repository path {} not found (check file {})'.format(path_to_repo, full_path_to_repo_paths)) + + # Save with correct paths + if len(checked_self_paths)!=len(self.paths): + self.paths = checked_self_paths + + print ('WARNING: fixed repo list file {}'.format(full_path_to_repo_paths)) + + r = utils.save_json(full_path_to_repo_paths, meta = self.paths) + if r['return']>0: return r + return {'return':0} ############################################################ @@ -233,7 +246,7 @@ def process(self, repo_path, mode='add'): return {'return':0} ############################################################ - def pull(self, alias, url = '', branch = '', checkout = '', console = False, desc = '', prefix = '', depth = None): + def pull(self, alias, url = '', branch = '', checkout = '', console = False, desc = '', prefix = '', depth = None, path_to_repo = None): """ Clone or pull CM repository @@ -246,6 +259,7 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des (console) (bool): if True, print some info to console (desc) (str): optional repository description (prefix) (str): sub-directory to be used inside this CM repository to store artifacts + (path_to_repo) (str): force path to repo (useful to pull imported repos with non-standard path) Returns: (CM return dict): @@ -258,7 +272,8 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des """ # Prepare path - path_to_repo = os.path.join(self.full_path_to_repos, alias) + if path_to_repo == None: + path_to_repo = os.path.join(self.full_path_to_repos, alias) if console: print ('Local path: '+path_to_repo) @@ -610,9 +625,27 @@ def delete(self, lst, remove_all = False, console = False, force = False): if console: print (' Deleting repository content ...') - shutil.rmtree(path_to_repo) + shutil.rmtree(path_to_repo, onerror=rm_read_only) else: if console: print (' CM repository was unregistered from CM but its content was not deleted ...') return {'return':0} + +############################################################################## +def rm_read_only(f, p, e): + """ + Internal aux function to remove files and dirs even if read only + particularly on Windows + """ + + import os + import stat + import errno + + ex = e[1] + + os.chmod(p, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + f(p) + + return diff --git a/docs/mlperf/inference/rnnt/README_nvidia.md b/docs/mlperf/inference/rnnt/README_nvidia.md index 65779a2e1d..8c8acc6b90 100644 --- a/docs/mlperf/inference/rnnt/README_nvidia.md +++ b/docs/mlperf/inference/rnnt/README_nvidia.md @@ -12,7 +12,7 @@ cm docker script --tags=build,nvidia,inference,server ### Do a test run to detect and record the system performance ``` -cmr "run-mlperf inference _find-performance _all-scenarios" \ +cmr "run-mlperf inference _find-performance" --scenario=Offline \ --model=rnnt --implementation=nvidia-original --device=cuda --backend=tensorrt \ --category=edge --division=open --quiet ``` @@ -24,23 +24,13 @@ cmr "run-mlperf inference _find-performance _all-scenarios" \ ``` cmr "run-mlperf inference _submission _all-scenarios" --model=rnnt \ --device=cuda --implementation=nvidia-original --backend=tensorrt \ ---execution-mode=valid --results_dir=$HOME/results_dir \ ---category=edge --division=open --quiet +--execution-mode=valid --category=edge --division=open --quiet ``` * Use `--power=yes` for measuring power. It is ignored for accuracy and compliance runs * Use `--division=closed` to run all scenarios for the closed division including the compliance tests * `--offline_target_qps`, `--server_target_qps`, and `--singlestream_target_latency` can be used to override the determined performance numbers -### Populate the README files describing your submission - -``` -cmr "run-mlperf inference _populate-readme _all-scenarios" \ ---model=rnnt --device=cuda --implementation=nvidia-original --backend=tensorrt \ ---execution-mode=valid --results_dir=$HOME/results_dir \ ---category=edge --division=open --quiet -``` - ### Generate and upload MLPerf submission Follow [this guide](../Submission.md) to generate the submission tree and upload your results.