Skip to content

Fixes for podman #88

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 8 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions automation/script/module_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,9 @@ def docker(i):

noregenerate_docker_file = i.get('docker_noregenerate', False)
norecreate_docker_image = i.get('docker_norecreate', True)
recreate_docker_image = i.get('docker_recreate', False)
if recreate_docker_image: # force recreate
norecreate_docker_image = False

if i.get('docker_skip_build', False):
noregenerate_docker_file = True
Expand Down
26 changes: 20 additions & 6 deletions script/app-mlperf-inference/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1775,13 +1775,27 @@ input_description:
debug:
desc: "Debug MLPerf script"

gui:
title: "CM GUI for the MLPerf inference benchmark"
update_meta_if_env:
- enable_if_env:
CM_CONTAINER_TOOL:
- podman
# podman maps the host userid to the root user inside the container
docker:
use_host_group_id: False
use_host_user_id: False
pass_user_group: False #useful if docker is run by a different user from the one who built it and under the same group
default_env:
CM_DOCKER_USE_DEFAULT_USER: 'yes'
- skip_if_env:
CM_CONTAINER_TOOL:
- podman
docker:
use_host_group_id: True
use_host_user_id: True
pass_user_group: True #useful if docker is run by a different user from the one who built it and under the same group


docker:
use_host_group_id: True
use_host_user_id: True
pass_user_group: True #useful if docker is run by a different user fromt he one who built it and under the same group
deps:
- tags: get,mlperf,inference,results,dir,local
names:
Expand Down Expand Up @@ -1816,7 +1830,7 @@ docker:
skip_run_cmd: 'no'
shm_size: '32gb'
interactive: True
extra_run_args: ' --dns 8.8.8.8 --dns 8.8.4.4 --ulimit memlock=-1 --cap-add SYS_ADMIN --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined'
extra_run_args: ' --dns 8.8.8.8 --dns 8.8.4.4 --cap-add SYS_ADMIN --ulimit=host --cap-add SYS_TIME --security-opt apparmor=unconfined --security-opt seccomp=unconfined'
os: ubuntu
cm_repo: mlcommons@mlperf-automations
cm_repo_branch: dev
Expand Down
5 changes: 5 additions & 0 deletions script/build-dockerfile/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ input_mapping:
new_env_keys:
- CM_DOCKERFILE_*

deps:
- tags: get,docker
names:
- docker

post_deps:
- enable_if_env:
CM_BUILD_DOCKER_IMAGE:
Expand Down
22 changes: 17 additions & 5 deletions script/build-dockerfile/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ def preprocess(i):
docker_user = get_value(env, config, 'USER', 'CM_DOCKER_USER')
docker_group = get_value(env, config, 'GROUP', 'CM_DOCKER_GROUP')

if docker_user:
if env.get('CM_CONTAINER_TOOL', '') == 'podman' and env.get(
'CM_DOCKER_USE_DEFAULT_USER', '') == '':
env['CM_DOCKER_USE_DEFAULT_USER'] = 'yes'

if docker_user and str(env.get('CM_DOCKER_USE_DEFAULT_USER', '')).lower() not in [
"yes", "1", "true"]:

f.write('RUN groupadd -g $GID -o ' + docker_group + EOL)

Expand All @@ -266,24 +271,31 @@ def preprocess(i):
' ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers' +
EOL)
f.write('USER ' + docker_user + ":" + docker_group + EOL)
f.write('ENV HOME=/home/cmuser' + EOL)

else:
f.write('ENV HOME=/root' + EOL)

dockerfile_env = env.get('CM_DOCKERFILE_ENV', {})
dockerfile_env_input_string = ""
for docker_env_key in dockerfile_env:
dockerfile_env_input_string = dockerfile_env_input_string + " --env." + \
docker_env_key + "=" + str(dockerfile_env[docker_env_key])

workdir = get_value(env, config, 'WORKDIR', 'CM_DOCKER_WORKDIR')
if workdir:
if workdir and ("/home/cmuser" not in workdir or str(env.get('CM_DOCKER_USE_DEFAULT_USER', '')).lower() not in [
"yes", "1", "true"]):
f.write('WORKDIR ' + workdir + EOL)

f.write(EOL + '# Install python packages' + EOL)
python = get_value(env, config, 'PYTHON', 'CM_DOCKERFILE_PYTHON')

docker_use_virtual_python = env.get('CM_DOCKER_USE_VIRTUAL_PYTHON', "yes")
if str(docker_use_virtual_python).lower() not in ["no", "0", "false"]:
f.write('RUN {} -m venv /home/cmuser/venv/cm'.format(python) + " " + EOL)
f.write('ENV PATH="/home/cmuser/venv/cm/bin:$PATH"' + EOL)
f.write('RUN {} -m venv $HOME/venv/cm'.format(python) + " " + EOL)
f.write('ENV PATH="$HOME/venv/cm/bin:$PATH"' + EOL)
# f.write('RUN . /opt/venv/cm/bin/activate' + EOL)

f.write(
'RUN {} -m pip install '.format(python) +
" ".join(
Expand All @@ -299,7 +311,7 @@ def preprocess(i):
f.write(EOL + '# Download CM repo for scripts' + EOL)

if use_copy_repo:
docker_repo_dest = "/home/cmuser/CM/repos/mlcommons@mlperf-automations"
docker_repo_dest = "$HOME/CM/repos/mlcommons@mlperf-automations"
f.write(
f'COPY --chown=cmuser:cm {relative_repo_path} {docker_repo_dest}' +
EOL)
Expand Down
1 change: 0 additions & 1 deletion script/get-ml-model-rgat/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ docker:
fake_run_deps: True
env:
CM_ML_MODEL: RGAT
CM_ML_MODEL_DATASET: ICBH
input_mapping:
checkpoint: RGAT_CHECKPOINT_PATH
new_env_keys:
Expand Down
1 change: 1 addition & 0 deletions script/run-docker-container/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ default_env:
CM_DOCKER_DETACHED_MODE: 'yes'
CM_DOCKER_REUSE_EXISTING_CONTAINER: 'no'
CM_DOCKER_PRIVILEGED_MODE: 'no'
CM_PODMAN_MAP_USER_ID: 'no'

input_mapping:
all_gpus: CM_DOCKER_ADD_ALL_GPUS
Expand Down
Loading