浏览代码

Changes for experiment

/develop/adjust-cpu-settings-experiment
Ervin Teng 4 年前
当前提交
8cc75388
共有 2 个文件被更改,包括 11 次插入5 次删除
  1. 11
      ml-agents/mlagents/torch_utils/torch.py
  2. 5
      ml-agents/mlagents/trainers/learn.py

11
ml-agents/mlagents/torch_utils/torch.py


# Everywhere else is caught by the banned-modules setting for flake8
import torch # noqa I201
torch.set_num_interop_threads(2)
os.environ["KMP_AFFINITY"] = "granularity=fine,compact,1,0"
os.environ["KMP_BLOCKTIME"] = "0"
if "TORCH_NUM_THREADS" in os.environ:
torch.set_num_threads(int(os.environ.get('TORCH_NUM_THREADS')))
if "TORCH_NUM_INTEROP" in os.environ:
torch.set_num_threads(int(os.environ.get('TORCH_NUM_INTEROP')))
# torch.set_num_interop_threads(4)
# os.environ["KMP_AFFINITY"] = "granularity=fine,compact,1,0"
# os.environ["KMP_BLOCKTIME"] = "1"
# Known PyLint compatibility with PyTorch https://github.com/pytorch/pytorch/issues/701
# pylint: disable=E1101

5
ml-agents/mlagents/trainers/learn.py


import numpy as np
import json
from mlagents_envs.registry import default_registry
from typing import Callable, Optional, List
import mlagents.trainers

) -> UnityEnvironment:
# Make sure that each environment gets a different seed
env_seed = seed + worker_id
return UnityEnvironment(
file_name=env_path,
return default_registry["CrawlerStaticTarget"].make(
worker_id=worker_id,
seed=env_seed,
no_graphics=no_graphics,

正在加载...
取消
保存