Skip to content

Fix for dmidecode + support mounting filepaths in docker #344

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

Merged
merged 17 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions automation/script/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ def update_container_paths(path, mounts=None, force_target_path=''):
if not path:
return '', '' # Return empty paths if no path is provided.

# Normalize and resolve the absolute path.
host_path = os.path.abspath(path)
host_path = path
container_path = host_path # Default to the same path for containers.

# Handle Windows-specific path conversion for Docker.
Expand Down Expand Up @@ -392,7 +391,7 @@ def get_docker_default(key):

def get_host_path(value):
# convert relative path to absolute path
value = convert_to_abs_path(value)
value = os.path.dirname(convert_to_abs_path(value))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if it's a folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path.dirname does not change the value if folder is directly supplied.

sample output:

>>> import os
>>> os.path.dirname("/home/anandhu/")
'/home/anandhu'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's only if / is at the end right? I think we should explicitly check for a file here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct, to be safe, commit 5fb35f3 uses pathlib library to process the paths


path_split = value.split(os.sep)

Expand All @@ -419,6 +418,7 @@ def get_container_path_script(i):

def get_container_path(value, username="mlcuser"):
# convert relative path to absolute path
# if we are trying to mount a file, mount the parent folder.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative path was already been converted to absolute path here. But I guess that should be done in get_container_value itself as there is a chance that the relative path of a folder in MLC cache could also be supplied by user which would not be handled properly here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in commit 5e9f7e4

value = convert_to_abs_path(value)

path_split = value.split(os.sep)
Expand All @@ -434,4 +434,4 @@ def get_container_path(value, username="mlcuser"):
return "/".join(new_path_split1), "/".join(new_path_split2)
else:
orig_path, target_path = update_container_paths(path=value)
return target_path, target_path
return os.path.dirname(target_path), target_path
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
if [[ ${MLC_SUDO_USER} == "yes" ]]; then
${MLC_SUDO} dmidecode -t memory > ${MLC_MEMINFO_FILE}
fi
test $? -eq 0 || return $?
test $? -eq 0 || echo "Warning: Memory info is not recorded"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dmidecode exits with error no device error. Maybe due to permission error with dmidecode inside docker containers. Would it be okay if we just print warnings instead of exiting.

4 changes: 4 additions & 0 deletions script/get-mlperf-inference-sut-description/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ deps:
MLC_HOST_OS_TYPE:
- linux
tags: detect,sudo
- skip_if_env:
MLC_SUDO_USER:
- 'no'
tags: get,sys-util,generic,_dmidecode
- env:
MLC_CACHE_DIR_ENV_NAME: MLC_MLPERF_INFERENCE_SUT_DESC_PATH
extra_cache_tags: mlperf,inference,sut,descriptions
Expand Down
29 changes: 29 additions & 0 deletions script/run-mlperf-inference-submission-checker/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@ deps:
MLC_TMP_MLPERF_INFERENCE_PREPROCESS_SUBMISSION:
- 'on'
tags: preprocess,mlperf,inference,submission
docker:
mlc_repo: mlcommons@mlperf-automations
mlc_repo_branch: dev
extra_run_args: ' --cap-add SYS_ADMIN'
os: ubuntu
os_version: '22.04'
pre_run_cmds:
- mlc pull repo
real_run: false
use_host_group_id: true
use_host_user_id: true
deps:
- names:
- get-mlperf-submission-dir
skip_if_env:
MLC_MLPERF_INFERENCE_SUBMISSION_DIR:
- 'on'
tags: get,mlperf,submission,dir
- enable_if_env:
MLC_TMP_MLPERF_INFERENCE_PREPROCESS_SUBMISSION:
- 'on'
tags: preprocess,mlperf,inference,submission
input_mapping:
submission_dir: MLC_MLPERF_INFERENCE_SUBMISSION_DIR
submission_tar_file: MLPERF_INFERENCE_SUBMISSION_TAR_FILE
mounts:
- ${{ MLC_MLPERF_INFERENCE_SUBMISSION_DIR }}:${{ MLC_MLPERF_INFERENCE_SUBMISSION_DIR }}
- ${{ MLPERF_INFERENCE_SUBMISSION_TAR_FILE }}:${{ MLPERF_INFERENCE_SUBMISSION_TAR_FILE }}
input_mapping:
extra_args: MLC_MLPERF_SUBMISSION_CHECKER_EXTRA_ARGS
extra_checker_args: MLC_MLPERF_SUBMISSION_CHECKER_EXTRA_ARGS
Expand All @@ -60,6 +88,7 @@ input_mapping:
submission_dir: MLC_MLPERF_INFERENCE_SUBMISSION_DIR
submitter: MLC_MLPERF_SUBMITTER
submitter_id: MLC_MLPERF_SUBMITTER_ID
submission_tar_file: MLPERF_INFERENCE_SUBMISSION_TAR_FILE
tar: MLC_TAR_SUBMISSION_DIR
post_deps:
- enable_if_env:
Expand Down
Loading