From b39317dcadd9dfda26dc86a494635e1bbcc60037 Mon Sep 17 00:00:00 2001
From: Armin <armin.co@hs-bochum.de>
Date: Sat, 6 Mar 2021 10:00:18 +0100
Subject: [PATCH] New benchmarking configurations

Fixed GPU disabling.
---
 environment_wrapper.py    |  4 ----
 networks.py               |  4 ++++
 run_scripts/benchmarks.py | 12 ++++++++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/environment_wrapper.py b/environment_wrapper.py
index cf39665..fb80069 100644
--- a/environment_wrapper.py
+++ b/environment_wrapper.py
@@ -31,10 +31,6 @@ class Config:
 
 
     def conf_to_name(self):
-        # 0. Allow GPU usage or force tensorflow to use the CPU.
-        if self.force_cpu:
-            os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
-            os.environ["CUDA_VISIBLE_DEVICES"] = ""
         self.name = self.env_type + '_' + self.name
         for layer in self.net_layout:
             self.name += '_' + str(layer) + '_'
diff --git a/networks.py b/networks.py
index 0492454..7e16615 100644
--- a/networks.py
+++ b/networks.py
@@ -1,3 +1,4 @@
+import os
 from keras import Sequential
 from keras.models import load_model
 from keras.layers import Dense
@@ -10,6 +11,9 @@ class QNet:
     learn_rate = 0.0005
 
     def __init__(self, conf):
+        if conf.force_cpu:
+            os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
+            os.environ["CUDA_VISIBLE_DEVICES"] = ""
         self.net = None    
         self.net = Sequential()
         self.compile_net(conf)
diff --git a/run_scripts/benchmarks.py b/run_scripts/benchmarks.py
index a18117c..28382e6 100644
--- a/run_scripts/benchmarks.py
+++ b/run_scripts/benchmarks.py
@@ -23,9 +23,9 @@ smallNet.net_layout = [128, 32]
 smallNet.conf_to_name()
 
 smallNetSlow = copy.deepcopy(c)
-smallNetSlow.name = 'SmallNetSlow'
+smallNetSlow.name = 'SmallNet'
 smallNetSlow.net_layout = [128, 32]
-smallNetSlow.learn_rate = 0.0005
+smallNetSlow.eps_decay = 0.9996
 smallNetSlow.conf_to_name()
 
 smallNetDeep = copy.deepcopy(c)
@@ -92,6 +92,12 @@ verryLittleNetDeep.name = 'VerryLittleNetDeep'
 verryLittleNetDeep.net_layout = [64, 32, 32]
 verryLittleNetDeep.conf_to_name()
 
+ThisHasToBeTooBig = copy.deepcopy(c)
+ThisHasToBeTooBig.name = 'ThisHasToBeTooBig'
+ThisHasToBeTooBig.force_cpu = False
+ThisHasToBeTooBig.net_layout = [4096, 2048]
+ThisHasToBeTooBig.conf_to_name()
+
 lun = copy.deepcopy(c)
 lun.run_episodes = 500
 lun.name = 'NormalLunarDoubleNotSoMoreLearn'
@@ -114,6 +120,8 @@ configuration = smallNetSlow
 # configuration = deepNetSlowLearn
 # configuration = smallNetDeepSlowLearn
 # configuration = lun
+configuration = ThisHasToBeTooBig
+
 print(configuration.name)
 configuration.agent = QAgent(configuration)
 main.run(configuration)
-- 
GitLab