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

set cuda devices for no-docker mode #1925

Merged
merged 6 commits into from
May 5, 2023
Merged
Changes from 5 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
20 changes: 19 additions & 1 deletion armory/eval/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,28 @@ def _gather_env_variables(self):
if not self.armory_global_config["verify_ssl"]:
self.extra_env_vars["VERIFY_SSL"] = "false"

cuda_var_exists = (
True if os.getenv("CUDA_VISIBLE_DEVICES") is not None else False
)
if cuda_var_exists and self.no_docker:
log.warning(
"CUDA_VISIBLE_DEVICES is set; any Armoy gpu instructions will be ignored"
)
# Existing value should override armory flags
swsuggs marked this conversation as resolved.
Show resolved Hide resolved

# Set visible gpus
if self.config["sysconfig"].get("use_gpu", None):
gpus = self.config["sysconfig"].get("gpus")
if gpus is not None:
self.extra_env_vars["NVIDIA_VISIBLE_DEVICES"] = gpus
if self.no_docker and not cuda_var_exists:
self.extra_env_vars["CUDA_VISIBLE_DEVICES"] = gpus
if not self.no_docker:
self.extra_env_vars["NVIDIA_VISIBLE_DEVICES"] = gpus
swsuggs marked this conversation as resolved.
Show resolved Hide resolved
else:
if self.no_docker and not cuda_var_exists:
# Block gpus for no-docker mode
self.extra_env_vars["CUDA_VISIBLE_DEVICES"] = "-1"

if self.config["sysconfig"].get("set_pythonhashseed"):
self.extra_env_vars["PYTHONHASHSEED"] = "0"

Expand Down