Skip to content

Commit

Permalink
added generation of a list of all CM scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gfursin committed Nov 7, 2022
1 parent 9fa6c92 commit 1445341
Show file tree
Hide file tree
Showing 104 changed files with 1,641 additions and 20 deletions.
56 changes: 49 additions & 7 deletions cm-mlops/automation/script/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2414,6 +2414,7 @@ def doc(self, i):

toc_category = {}
toc_category_sort = {}
script_meta = {}

for artifact in sorted(lst, key = lambda x: x.meta.get('alias','')):
path = artifact.path
Expand All @@ -2425,17 +2426,30 @@ def doc(self, i):
alias = meta.get('alias','')
uid = meta.get('uid','')

script_meta[alias]=meta

name = meta.get('name','')
developers = meta.get('developers','')

category = meta.get('category','').strip()
category_sort = meta.get('category_sort',0)
tags = sorted(meta.get('tags',[]))

variation_keys = sorted(list(meta.get('variations',{}).keys()))
version_keys = sorted(list(meta.get('versions',{}).keys()))

default_variation = meta.get('default_variation','')
default_version = meta.get('default_version','')



category = meta.get('category', '').strip()
category_sort = meta.get('category_sort', 0)
if category != '':
if category not in toc_category:
toc_category[category]=[]
toc_category_sort[category]=category_sort

if category not in toc_category_sort or category_sort>0:
toc_category_sort[category]=category_sort

if alias not in toc_category[category]:
toc_category[category].append(alias)

Expand All @@ -2445,6 +2459,7 @@ def doc(self, i):
repo_alias = repo_meta.get('alias','')
repo_uid = repo_meta.get('uid','')


# Check URL
url = ''
url_repo = ''
Expand Down Expand Up @@ -2488,20 +2503,47 @@ def doc(self, i):

md.append('* CM script meta description: *[GitHub]({})*'.format(meta_url))
md.append('* CM automation "script": *[Docs]({})*'.format('https://github.com/octoml/ck/blob/master/docs/list_of_automations.md#script'))
md.append('* CM script tags: *cm run script --tags="{}"*'.format(','.join(tags)))

if len(variation_keys)>0:
md.append('* CM script variations: *{}*'.format('; '.join(variation_keys)))

if default_variation!='':
md.append('* CM script default variation: *{}*'.format(default_variation))

if len(version_keys)>0:
md.append('* CM script versions: *{}*'.format('; '.join(version_keys)))

if default_version!='':
md.append('* CM script default version: *{}*'.format(default_version))




md.append('\n')




# Recreate TOC with categories
toc2 = []

for category in sorted(toc_category, key = lambda x: toc_category_sort[x]):
for category in sorted(toc_category, key = lambda x: -toc_category_sort[x]):
toc2.append('### '+category)
toc2.append('\n')

for script in toc_category[category]:
toc2.append('* '+script)
toc2.append('\n')
for script in sorted(toc_category[category]):

meta = script_meta[script]

name = meta.get('name','')

x = '* [{}](#{})'.format(script, script)
if name !='': x+=' *('+name+')*'

toc2.append(x)

toc2.append('\n')

# Load template
r = utils.load_txt(os.path.join(self.path, template_file))
Expand Down
2 changes: 1 addition & 1 deletion cm-mlops/script/activate-python-venv/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"alias": "activate-python-venv",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Python",
"category": "Python automation",
"category_sort": 1000,
"developers": "[Grigori Fursin](https://cKnowledge.io/@gfursin)",
"name": "Activate python virtual environment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular ML/AI applications",
"category_sort": 10000,
"deps": [
{
"tags": "detect,os"
Expand Down
1 change: 0 additions & 1 deletion cm-mlops/script/app-image-classification-onnx-py/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ automation_alias: script
automation_uid: 5b4e0237da074764

category: "Modular ML/AI applications"
category_sort: 10000

tags:
- app
Expand Down
1 change: 0 additions & 1 deletion cm-mlops/script/app-image-classification-torch-py/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular ML/AI applications",
"category_sort": 10000,
"default_env": {
"CM_BATCH_COUNT": "1",
"CM_BATCH_SIZE": "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular ML/AI applications",
"category_sort": 10000,
"default_env": {
"CM_BATCH_COUNT": "1",
"CM_BATCH_SIZE": "1"
Expand Down
1 change: 0 additions & 1 deletion cm-mlops/script/app-image-corner-detection-old/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular applications",
"category_sort": 9500,
"deps": [
{
"tags": "get,compiler"
Expand Down
2 changes: 1 addition & 1 deletion cm-mlops/script/app-mlperf-inference-cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ across diverse platforms with continuously changing software and hardware.

&copy; 2021-2022 [MLCommons](https://mlcommons.org)<br>

# Authors
# Developers

[Thomas Zhu](https://www.linkedin.com/in/hanwen-zhu-483614189),
[Arjun Suresh](https://www.linkedin.com/in/arjunsuresh)
Expand Down
5 changes: 3 additions & 2 deletions cm-mlops/script/app-mlperf-inference-cpp/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ uid: bf62405e6c7a44bf
automation_alias: script
automation_uid: 5b4e0237da074764

category: "Modular ML/AI benchmarks"
category_sort: 11000
category: "Modular MLPerf benchmarks"

developers: "[Thomas Zhu](https://www.linkedin.com/in/hanwen-zhu-483614189), [Arjun Suresh](https://www.linkedin.com/in/arjunsuresh), [Grigori Fursin](https://cKnowledge.io/@gfursin)"

# User-friendly tags to find this CM script
tags:
Expand Down
2 changes: 1 addition & 1 deletion cm-mlops/script/app-mlperf-inference-reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ across diverse platforms with continuously changing software and hardware.

&copy; 2021-2022 [MLCommons](https://mlcommons.org)<br>

# Authors
# Developers

[Arjun Suresh](https://www.linkedin.com/in/arjunsuresh),
[Grigori Fursin]( https://cKnowledge.io/@gfursin )
Expand Down
4 changes: 3 additions & 1 deletion cm-mlops/script/app-mlperf-inference-reference/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ uid: d775cac873ee4231
automation_alias: script
automation_uid: 5b4e0237da074764

category: "Modular ML/AI benchmarks"
category: "Modular MLPerf benchmarks"
category_sort: 11000

developers: "[Arjun Suresh](https://www.linkedin.com/in/arjunsuresh), [Grigori Fursin](https://cKnowledge.io/@gfursin)"

# User-friendly tags to find this CM script
tags:
- app
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/benchmark-program/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "benchmark-program",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Application automation",
"category_sort": 5000,
"default_env": {
"CM_ENABLE_NUMACTL": "0",
"CM_ENABLE_PROFILING": "0"
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/build-docker-image/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "build-docker-image",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Docker automation",
"category_sort": 6500,
"cache": false,
"input_mapping": {
"cache": "CM_DOCKER_CACHE",
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/build-dockerfile/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "build-dockerfile",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Docker automation",
"category_sort": 6500,
"cache": false,
"input_mapping": {
"build": "CM_BUILD_DOCKER_IMAGE",
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/compile-program/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "compile-program",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Application automation",
"category_sort": 5000,
"deps": [
{
"tags": "detect,cpu"
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/destroy-terraform/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "destroy-terraform",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Cloud automation",
"category_sort": 7000,
"tags": [
"destroy",
"terraform",
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/detect-cpu/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "detect-cpu",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Platform information",
"category_sort": 8300,
"clean_files": [
"tmp-lscpu.out"
],
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/detect-os/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"alias": "detect-os",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Platform information",
"clean_files": [
"tmp-run.out"
],
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/flash-tinyml-binary/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "flash-tinyml-binary",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "TinyML automation",
"category_sort": 7000,
"cache": false,
"default_version": "r1.0",
"deps": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"alias": "generate-mlperf-inference-submission",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular MLPerf benchmarks",
"cache": false,
"deps": [
{
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/generate-mlperf-tiny-submission/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "generate-mlperf-tiny-submission",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular MLPerf benchmarks",
"category_sort": 8500,
"cache": false,
"deps": [
{
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-aws-cli/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"automation_uid": "5b4e0237da074764",
"cache": true,
"clean_files": [],
"category": "Cloud automation",
"category_sort":8000,
"new_env_keys": [
"CM_AWS_*"
],
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-bazel/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"cache": true,
"category": "Detection or installation of tools and artifacts",
"clean_files": [],
"new_env_keys": [
"CM_BAZEL_*"
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-ck-repo-mlops/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"alias": "get-ck-repo-mlops",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Legacy CK support",
"deps": [
{
"tags": "get,ck"
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-ck/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "get-ck",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Legacy CK support",
"category_sort": 1000,
"cache": true,
"tags": [
"get",
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-cl/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"alias": "get-cl",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Compiler automation",
"cache": true,
"clean_files": [],
"name": "Use Microsoft C compiler",
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-cmake/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"cache": true,
"category": "Detection or installation of tools and artifacts",
"env": {
"CM_REQUIRE_INSTALL": "no"
},
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-cmsis_5/_cm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"alias": "get-cmsis_5",
"automation_alias": "script",
"category": "Detection or installation of tools and artifacts",
"automation_uid": "5b4e0237da074764",
"cache": true,
"default_version": "develop",
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-compiler-flags/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "get-compiler-flags",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Compiler automation",
"category_sort":8200,
"deps": [
{
"tags": "detect,cpu"
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-configs-sut-mlperf-inference/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"alias": "get-configs-sut-mlperf-inference",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "Modular MLPerf benchmarks",
"cache": false,
"new_env_keys": [
"CM_HW_*",
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/get-cuda-devices/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"alias": "get-cuda-devices",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "CUDA automation",
"clean_files": [
"tmp-run.out"
],
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-cuda/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "get-cuda",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "CUDA automation",
"category_sort": 7000,
"cache": true,
"clean_files": [],
"deps": [
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-dataset-criteo/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"alias": "get-dataset-criteo",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"category": "ML/AI datasets",
"category_sort":8500,
"cache": true,
"env": {
"CM_DATASET": "terabyte"
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-dataset-imagenet-aux/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"cache": true,
"category": "ML/AI datasets",
"category_sort":8500,
"default_variation": "from.dropbox",
"new_env_keys": [
"CM_DATASET_AUX_*"
Expand Down
Loading

0 comments on commit 1445341

Please sign in to comment.