diff --git a/omnisafe/algorithms/algo_wrapper.py b/omnisafe/algorithms/algo_wrapper.py index 8293126d1..19d6c5c74 100644 --- a/omnisafe/algorithms/algo_wrapper.py +++ b/omnisafe/algorithms/algo_wrapper.py @@ -77,8 +77,6 @@ def learn(self): physical_cores = psutil.cpu_count(logical=False) use_number_of_threads = bool(self.parallel > physical_cores) - torch.set_num_threads(5) - cfgs = get_default_kwargs_yaml(self.algo, self.env_id, self.algo_type) exp_name = os.path.join(self.env_id, self.algo) cfgs.recurisve_update({'exp_name': exp_name, 'env_id': self.env_id}) @@ -87,6 +85,8 @@ def learn(self): # check_all_configs(cfgs, self.algo_type) + torch.set_num_threads(cfgs.num_threads) + if distributed.fork( self.parallel, use_number_of_threads=use_number_of_threads, device=cfgs.device ): diff --git a/omnisafe/configs/on-policy/CPO.yaml b/omnisafe/configs/on-policy/CPO.yaml index bf605bd2d..55385d558 100644 --- a/omnisafe/configs/on-policy/CPO.yaml +++ b/omnisafe/configs/on-policy/CPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/CPPOPid.yaml b/omnisafe/configs/on-policy/CPPOPid.yaml index 741f12196..e97b2e738 100644 --- a/omnisafe/configs/on-policy/CPPOPid.yaml +++ b/omnisafe/configs/on-policy/CPPOPid.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/CUP.yaml b/omnisafe/configs/on-policy/CUP.yaml index a9d93db4a..30865cc92 100644 --- a/omnisafe/configs/on-policy/CUP.yaml +++ b/omnisafe/configs/on-policy/CUP.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/FOCOPS.yaml b/omnisafe/configs/on-policy/FOCOPS.yaml index 4094af4e2..781942315 100644 --- a/omnisafe/configs/on-policy/FOCOPS.yaml +++ b/omnisafe/configs/on-policy/FOCOPS.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/IPO.yaml b/omnisafe/configs/on-policy/IPO.yaml index 2cf52f48a..4075f529b 100644 --- a/omnisafe/configs/on-policy/IPO.yaml +++ b/omnisafe/configs/on-policy/IPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/NaturalPG.yaml b/omnisafe/configs/on-policy/NaturalPG.yaml index 30c044d46..7adddf898 100644 --- a/omnisafe/configs/on-policy/NaturalPG.yaml +++ b/omnisafe/configs/on-policy/NaturalPG.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/OnCRPO.yaml b/omnisafe/configs/on-policy/OnCRPO.yaml index 5b7f0c999..e72419f35 100644 --- a/omnisafe/configs/on-policy/OnCRPO.yaml +++ b/omnisafe/configs/on-policy/OnCRPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/P3O.yaml b/omnisafe/configs/on-policy/P3O.yaml index ccb642043..398559068 100644 --- a/omnisafe/configs/on-policy/P3O.yaml +++ b/omnisafe/configs/on-policy/P3O.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PCPO.yaml b/omnisafe/configs/on-policy/PCPO.yaml index 97485d459..8654374d7 100644 --- a/omnisafe/configs/on-policy/PCPO.yaml +++ b/omnisafe/configs/on-policy/PCPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PDO.yaml b/omnisafe/configs/on-policy/PDO.yaml index f6cef7ac9..96c25641a 100644 --- a/omnisafe/configs/on-policy/PDO.yaml +++ b/omnisafe/configs/on-policy/PDO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPO.yaml b/omnisafe/configs/on-policy/PPO.yaml index 4df9beff5..cc8357ba2 100644 --- a/omnisafe/configs/on-policy/PPO.yaml +++ b/omnisafe/configs/on-policy/PPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOEarlyTerminated.yaml b/omnisafe/configs/on-policy/PPOEarlyTerminated.yaml index 71951d7d8..dd755b259 100644 --- a/omnisafe/configs/on-policy/PPOEarlyTerminated.yaml +++ b/omnisafe/configs/on-policy/PPOEarlyTerminated.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOLag.yaml b/omnisafe/configs/on-policy/PPOLag.yaml index cfd1d4ab5..0eac1c639 100644 --- a/omnisafe/configs/on-policy/PPOLag.yaml +++ b/omnisafe/configs/on-policy/PPOLag.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOLagEarlyTerminated.yaml b/omnisafe/configs/on-policy/PPOLagEarlyTerminated.yaml index 2823db932..3869b84fb 100644 --- a/omnisafe/configs/on-policy/PPOLagEarlyTerminated.yaml +++ b/omnisafe/configs/on-policy/PPOLagEarlyTerminated.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOLagSaute.yaml b/omnisafe/configs/on-policy/PPOLagSaute.yaml index e1b2b7362..0fb8d846a 100644 --- a/omnisafe/configs/on-policy/PPOLagSaute.yaml +++ b/omnisafe/configs/on-policy/PPOLagSaute.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOLagSimmerPid.yaml b/omnisafe/configs/on-policy/PPOLagSimmerPid.yaml index 7cb9236f7..094a06049 100644 --- a/omnisafe/configs/on-policy/PPOLagSimmerPid.yaml +++ b/omnisafe/configs/on-policy/PPOLagSimmerPid.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOLagSimmerQ.yaml b/omnisafe/configs/on-policy/PPOLagSimmerQ.yaml index feadad9e8..bb511e3bd 100644 --- a/omnisafe/configs/on-policy/PPOLagSimmerQ.yaml +++ b/omnisafe/configs/on-policy/PPOLagSimmerQ.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOSaute.yaml b/omnisafe/configs/on-policy/PPOSaute.yaml index ebfb57d4c..c2a29791b 100644 --- a/omnisafe/configs/on-policy/PPOSaute.yaml +++ b/omnisafe/configs/on-policy/PPOSaute.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOSimmerPid.yaml b/omnisafe/configs/on-policy/PPOSimmerPid.yaml index 59e18d221..8df2fb19e 100644 --- a/omnisafe/configs/on-policy/PPOSimmerPid.yaml +++ b/omnisafe/configs/on-policy/PPOSimmerPid.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PPOSimmerQ.yaml b/omnisafe/configs/on-policy/PPOSimmerQ.yaml index 9f0efeeb4..3e81d063a 100644 --- a/omnisafe/configs/on-policy/PPOSimmerQ.yaml +++ b/omnisafe/configs/on-policy/PPOSimmerQ.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/PolicyGradient.yaml b/omnisafe/configs/on-policy/PolicyGradient.yaml index b7b83b878..2395e6c7f 100644 --- a/omnisafe/configs/on-policy/PolicyGradient.yaml +++ b/omnisafe/configs/on-policy/PolicyGradient.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/RCPO.yaml b/omnisafe/configs/on-policy/RCPO.yaml index 7fb671f6a..13afd06ab 100644 --- a/omnisafe/configs/on-policy/RCPO.yaml +++ b/omnisafe/configs/on-policy/RCPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/TRPO.yaml b/omnisafe/configs/on-policy/TRPO.yaml index 1f359b864..5e613b820 100644 --- a/omnisafe/configs/on-policy/TRPO.yaml +++ b/omnisafe/configs/on-policy/TRPO.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/TRPOLag.yaml b/omnisafe/configs/on-policy/TRPOLag.yaml index 7fb671f6a..13afd06ab 100644 --- a/omnisafe/configs/on-policy/TRPOLag.yaml +++ b/omnisafe/configs/on-policy/TRPOLag.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb diff --git a/omnisafe/configs/on-policy/TRPOPid.yaml b/omnisafe/configs/on-policy/TRPOPid.yaml index ee26aa807..b34931071 100644 --- a/omnisafe/configs/on-policy/TRPOPid.yaml +++ b/omnisafe/configs/on-policy/TRPOPid.yaml @@ -18,6 +18,8 @@ defaults: ## -----------------------------Basic configurations for base class PG------------------------ ## # The random seed seed: 0 + # The number of threads used per experiment + num_threads: 1 # If use tensorboard use_tensorboard: True # if use wandb