Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added predeps function, removed unused dirs #629

Merged
merged 11 commits into from
Nov 29, 2024
14 changes: 10 additions & 4 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@ jobs:
python3 -m pip install autopep8
for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.py$')
do
autopep8 --in-place -a $FILE
git add $FILE
# Check if the file still exists in the working tree
if [ -f "$FILE" ]; then
autopep8 --in-place -a "$FILE"
git add "$FILE"
fi
done

- name: Format modified C++ files
run: |
for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.(cc|cpp|h|hpp)$')
do
clang-format -i -style=file $FILE
git add $FILE
# Check if the file still exists in the working tree
if [ -f "$FILE" ]; then
clang-format -i -style=file $FILE
git add $FILE
fi
done

- name: Commit and create PR
Expand Down
1 change: 1 addition & 0 deletions automation/script/README-extra.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# CM "script" automation


<details>
<summary>Click here to see the table of contents.</summary>

Expand Down
85 changes: 82 additions & 3 deletions automation/script/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ def _run(self, i):

r = self._call_run_deps(prehook_deps, self.local_env_keys, local_env_keys_from_meta, env, state, const, const_state, add_deps_recursive,
recursion_spaces + extra_recursion_spaces,
remembered_selections, variation_tags_string, found_cached, debug_script_tags, verbose, show_time, extra_recursion_spaces, run_state)
remembered_selections, variation_tags_string, True, debug_script_tags, verbose, show_time, extra_recursion_spaces, run_state)
if r['return'] > 0:
return r

Expand Down Expand Up @@ -1372,7 +1372,7 @@ def _run(self, i):

r = self._call_run_deps(posthook_deps, self.local_env_keys, clean_env_keys_post_deps, env, state, const, const_state, add_deps_recursive,
recursion_spaces + extra_recursion_spaces,
remembered_selections, variation_tags_string, found_cached, debug_script_tags, verbose, show_time, extra_recursion_spaces, run_state)
remembered_selections, variation_tags_string, True, debug_script_tags, verbose, show_time, extra_recursion_spaces, run_state)
if r['return'] > 0:
return r

Expand All @@ -1383,7 +1383,7 @@ def _run(self, i):
# Check chain of post dependencies on other CM scripts
r = self._call_run_deps(post_deps, self.local_env_keys, clean_env_keys_post_deps, env, state, const, const_state, add_deps_recursive,
recursion_spaces + extra_recursion_spaces,
remembered_selections, variation_tags_string, found_cached, debug_script_tags, verbose, show_time, extra_recursion_spaces, run_state)
remembered_selections, variation_tags_string, True, debug_script_tags, verbose, show_time, extra_recursion_spaces, run_state)
if r['return'] > 0:
return r

Expand Down Expand Up @@ -1605,6 +1605,82 @@ def _run(self, i):
if r['return'] > 0:
return r

# Prepare common input to prepare and run script
run_script_input = {
'path': path,
'bat_ext': bat_ext,
'os_info': os_info,
'const': const,
'state': state,
'const_state': const_state,
'reuse_cached': reuse_cached,
'recursion': recursion,
'recursion_spaces': recursion_spaces,
'remembered_selections': remembered_selections,
'tmp_file_run_state': self.tmp_file_run_state,
'tmp_file_run_env': self.tmp_file_run_env,
'tmp_file_state': self.tmp_file_state,
'tmp_file_run': self.tmp_file_run,
'local_env_keys': self.local_env_keys,
'local_env_keys_from_meta': local_env_keys_from_meta,
'posthook_deps': posthook_deps,
'add_deps_recursive': add_deps_recursive,
'remembered_selections': remembered_selections,
'found_script_tags': found_script_tags,
'variation_tags_string': variation_tags_string,
'found_cached': False,
'debug_script_tags': debug_script_tags,
'verbose': verbose,
'meta': meta,
'self': self
}

# Check if pre-process and detect
if str(meta.get('predeps', 'True')).lower() not in ["0", "false", "no"] and os.path.isfile(
path_to_customize_py): # possible duplicate execution - needs fix
r = utils.load_python_module(
{'path': path, 'name': 'customize'})
if r['return'] > 0:
return r

customize_code = r['code']

customize_common_input = {
'input': i,
'automation': self,
'artifact': script_artifact,
'customize': script_artifact.meta.get('customize', {}),
'os_info': os_info,
'recursion_spaces': recursion_spaces,
'script_tags': script_tags,
'variation_tags': variation_tags
}
run_script_input['customize_code'] = customize_code
run_script_input['customize_common_input'] = customize_common_input

if repro_prefix != '':
run_script_input['repro_prefix'] = repro_prefix
if ignore_script_error:
run_script_input['ignore_script_error'] = True
if 'predeps' in dir(customize_code) and not fake_run:

logging.debug(
recursion_spaces +
' - Running preprocess ...')

run_script_input['run_state'] = run_state

ii = copy.deepcopy(customize_common_input)
ii['env'] = env
ii['state'] = state
ii['meta'] = meta
# may need to detect versions in multiple paths
ii['run_script_input'] = run_script_input

r = customize_code.predeps(ii)
if r['return'] > 0:
return r

# Check chain of dependencies on other CM scripts
if len(deps) > 0:
logging.debug(recursion_spaces +
Expand All @@ -1626,6 +1702,8 @@ def _run(self, i):
# Clean some output files
clean_tmp_files(clean_files, recursion_spaces)

# Repeated code
'''
# Prepare common input to prepare and run script
run_script_input = {
'path': path,
Expand Down Expand Up @@ -1655,6 +1733,7 @@ def _run(self, i):
'meta': meta,
'self': self
}
'''
if os.path.isfile(
path_to_customize_py): # possible duplicate execution - needs fix
r = utils.load_python_module(
Expand Down
32 changes: 0 additions & 32 deletions challenge/add-derived-metrics-to-mlperf-inference/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions challenge/add-derived-metrics-to-mlperf-inference/_cm.json

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions challenge/automate-mlperf-inference-v3.1-and-v4.0-2024/_cm.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions challenge/connect-mlperf-with-medperf/README.md

This file was deleted.

26 changes: 0 additions & 26 deletions challenge/connect-mlperf-with-medperf/_cm.json

This file was deleted.

Loading
Loading