Skip to content

Commit 4ffeb19

Browse files
V2.3.9: improved "cm init" and added support to set CLI flags to False (#1298)
- added `--min` == `--skip` to `cm init` for readability - added `--checkout` to `cm init` to handle checkout - added support to set CLI parameter to False if it ends with `-`, i.e. `--no-cache-` -> `i['no_cache'] = False` `--no-cache` -> `i['no_cache'] = True`
2 parents 07e3ac5 + 2b7fe5d commit 4ffeb19

File tree

11 files changed

+101
-15
lines changed

11 files changed

+101
-15
lines changed

COPYRIGHT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2021-2024 MLCommons
22

3-
The cTuning foundation and OctoML donated this project to MLCommons to benefit everyone.
3+
Grigori Fursin, the cTuning foundation and OctoML donated this project to MLCommons to benefit everyone.
44

55
Copyright (c) 2014-2021 cTuning foundation

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ CK consists of several ongoing sub-projects:
5555

5656
### Incubator
5757

58-
We are preparing new projects based on user feedback:
58+
We are preparing new projects based on user feedback - please contact [Grigori Fursin](https://cKnowledge.org/gfursin) for more details:
5959
* [The next generation of CM](_incubator/cm-next-gen) *(prototyping stage)*
60-
* [The crowd-testing infrastructure for CM4MLOps and CM4MLPerf](_incubator/cm4mlops-testing) *(brainstorming stage)*
60+
* [Collaborative testing of MLPerf benchmarks](_incubator/cm4mlops-testing) *(brainstorming stage)*
6161

6262

6363
### License
@@ -72,8 +72,7 @@ We are preparing new projects based on user feedback:
7272

7373
### Documentation
7474

75-
**MLCommons is updating the CM documentation based on user feedback - please check stay tuned for more details**.
76-
75+
* [CM installation GUI](https://access.cknowledge.org/playground/?action=install)
7776
* [CM Getting Started Guide and FAQ](docs/getting-started.md)
7877
* [Common CM interface to run MLPerf inference benchmarks](docs/mlperf/inference)
7978
* [Common CM interface to re-run experiments from ML and Systems papers including MICRO'23 and the Student Cluster Competition @ SuperComputing'23](docs/tutorials/common-interface-to-reproduce-research-projects.md)

ck/COPYRIGHT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2021-2022 MLCommons
22

3-
cTuning foundation and OctoML donated this project to MLCommons to benefit everyone.
3+
Grigori Fursin, the cTuning foundation and OctoML donated this project to MLCommons to benefit everyone.
44

55
Copyright (c) 2014-2021 cTuning foundation

cm-mlops/COPYRIGHT.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Copyright (c) 2022-2023 MLCommons
2+
3+
Grigori Fursin, the cTuning foundation and OctoML donated this project to MLCommons to benefit everyone.
4+
5+
Since 2024, we use a separate Github repository for further developments: https://github.com/mlcommons/cm4mlops

cm/CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## V2.3.9
2+
- added `--min` == `--skip` to `cm init` for readability
3+
- added `--checkout` to `cm init` to handle checkout
4+
- added support to set CLI parameter to False if it ends with `-`,
5+
i.e. `--no-cache-` -> `i['no_cache'] = False`
6+
`--no-cache` -> `i['no_cache'] = True`
7+
18
## V2.3.8
29
- added `--skip` and `--url` flags to `cm init`
310
- added support to pull CM repos using --url with "git@"

cm/COPYRIGHT.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
Copyright (c) 2022-2024 MLCommons
22

3+
Grigori Fursin, the cTuning foundation and OctoML
4+
donated CM and CM4MLOps to MLCommons to benefit everyone.

cm/cmind/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Written by Grigori Fursin
44

5-
__version__ = "2.3.8"
5+
__version__ = "2.3.9"
66

77
from cmind.core import access
88
from cmind.core import error

cm/cmind/cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,12 @@ def parse(cmd):
233233
key = a[:j].strip()
234234
value = a[j+1:].strip()
235235
else:
236-
key=a
237-
value=True
236+
if a.endswith('-'):
237+
key=a[:-1]
238+
value=False
239+
else:
240+
key=a
241+
value=True
238242

239243
if key.startswith('-'): key=key[1:]
240244
if key.startswith('-'): key=key[1:]

cm/cmind/repo/automation/core/module.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
class CMInit():
1717
###############################################################
18-
def run(self, quiet = False, skip = False, repo_name = 'mlcommons@cm4mlops', repo_url = '', repo_branch = ''):
18+
def run(self, quiet = False, skip = False, repo_name = 'mlcommons@cm4mlops', repo_url = '',
19+
repo_branch = '', repo_checkout = ''):
1920
import cmind
2021

2122
print ('Checking platform information ...')
@@ -47,6 +48,9 @@ def run(self, quiet = False, skip = False, repo_name = 'mlcommons@cm4mlops', rep
4748
if repo_branch !='':
4849
ii['branch'] = repo_branch
4950

51+
if repo_checkout !='':
52+
ii['checkout'] = repo_checkout
53+
5054
rr = cmind.access(ii)
5155

5256
return rr
@@ -228,7 +232,9 @@ def init(self, i):
228232
(repo) (str): main automation repository to pull ('mlcommons@cm4mlops' by default)
229233
(url) (str): main automation repository to pull via url (can use git@ instead of https)
230234
(branch) (str): branch to use ('' by default)
235+
(checkout) (str): Git checkout ('' by default)
231236
(skip) (bool): skip pulling main automation repository
237+
(min) (bool): the same as `skip`
232238
233239
Returns:
234240
(CM return dict):
@@ -242,15 +248,23 @@ def init(self, i):
242248
quiet = i.get('quiet', False)
243249

244250
skip = i.get('skip', False)
251+
if not skip:
252+
skip = i.get('min', False)
245253

246254
repo_name = i.get('repo', '').strip()
247255
repo_url = i.get('url', '').strip()
248256
if repo_url == '' and repo_name == '':
249257
repo_name = 'mlcommons@cm4mlops'
250258

251259
repo_branch = i.get('branch', '')
252-
253-
r = cm_init.run(quiet = quiet, skip = skip, repo_name = repo_name, repo_url = repo_url, repo_branch = repo_branch)
260+
repo_checkout = i.get('checkout', '')
261+
262+
r = cm_init.run(quiet = quiet,
263+
skip = skip,
264+
repo_name = repo_name,
265+
repo_url = repo_url,
266+
repo_branch = repo_branch,
267+
repo_checkout = repo_checkout)
254268
if r['return']>0: return r
255269

256270
warning = r.get('warning', '')

cm/cmind/utils.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,3 +1792,35 @@ def check_if_none_false_no_off(env, key):
17921792

17931793
return str(env.get(key, '')).lower() in ['none', 'false', 'no', 'off']
17941794

1795+
##############################################################################
1796+
def convert_dictionary(d, key, sub = True):
1797+
"""
1798+
Grigori added to gradually clean up very complex "cm docker scrpit" implementation
1799+
1800+
Convert dictionary into flat dictionary with key prefix
1801+
1802+
Example input:
1803+
d = {'cfg':True, 'no-cache':True}
1804+
key = 'docker'
1805+
sub = True
1806+
Example output:
1807+
d = {'docker_cfg': True, 'docker_no_cache': True}
1808+
1809+
Args:
1810+
1811+
d (dict): dictionary
1812+
key (str): key
1813+
1814+
Returns:
1815+
True if str(env.get(key, '')).lower() in ['false', 'no', 'off']:
1816+
"""
1817+
1818+
dd = {}
1819+
1820+
for k in d:
1821+
kk = k.replace('-', '_') if sub else k
1822+
1823+
dd[key + '_' + kk] = d[k]
1824+
1825+
return dd
1826+

docs/installation.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,25 @@
1717

1818
</details>
1919

20-
21-
***Check our new [online installation GUI](https://access.cknowledge.org/playground/?action=install)***.
20+
**Last revision of this document: September 29, 2024**
2221

2322

2423
# CM installation
2524

2625

2726

28-
2927
MLCommons Collective Mind framework requires minimal dependencies to run on any platform: `python 3+, pip, git, git-lfs, wget`.
3028
However, most CM automation recipes shared by the community and MLCommons require Python 3.7+ .
3129

3230
***By default, CM will pull Git repositories and cache installations and downloaded files in your `$HOME/CM` directory (Linux/MacOS).
3331
You can change it to any another directory using the `CM_REPOS` environment variable, for example `export CM_REPOS=/scratch/CM`.***
3432

33+
***We suggest you not to install `cm4mlops` package via PIP since you can't control installation of the CM framework and repositories
34+
and it doesn't handle CM errors properly - use a newer version of `cm init` after installing `cmind` package as described below.***
35+
36+
***Feel free to use the [online installation GUI](https://access.cknowledge.org/playground/?action=install)***.
37+
38+
3539
Here are typical installation procedures across different operating systems:
3640

3741
* [Ubuntu, Debian](#ubuntu-debian)
@@ -173,6 +177,7 @@ python -m pip install cmind
173177
*We plan to provide a self-sustained package in the future to simplify CM installation on Windows.*
174178

175179

180+
176181
# CM CLI testing
177182

178183
If the installation is successful, you can run the CM CLI as follows:
@@ -205,6 +210,24 @@ Reporting issues and ideas: https://github.com/mlcommons/ck/issues
205210
Joining the open MLPerf workgroup: https://cKnowledge.org/mlcommons-taskforce
206211
```
207212

213+
# CM init
214+
215+
Use the following command to test CM system dependencies (git, wget, curl, etc):
216+
217+
```bash
218+
cm init
219+
```
220+
221+
Note that it will also install stable `cm4mlops` repository with the automation recipes
222+
for MLOps and MLPerf.
223+
224+
You can skip installation of this repository and use the standard CM command to pull this repo
225+
as follows:
226+
```bash
227+
cm init --min
228+
cm pull repo mlcommons@cm4mlops
229+
```
230+
208231
# CUDA installation
209232

210233
If you plan to use CUDA for your experiments, please follow [this guide](installation-cuda.md)

0 commit comments

Comments
 (0)