From ad72c18882100e36a922c2f29f377350a29cba6f Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu>
Date: Fri, 19 Mar 2021 23:56:58 -0500
Subject: [PATCH] Auto Handling of non-absolute data paths

---
 hpvm/test/dnn_benchmarks/keras/Benchmark.py | 23 +++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/hpvm/test/dnn_benchmarks/keras/Benchmark.py b/hpvm/test/dnn_benchmarks/keras/Benchmark.py
index 7e87a014e7..11f762d563 100644
--- a/hpvm/test/dnn_benchmarks/keras/Benchmark.py
+++ b/hpvm/test/dnn_benchmarks/keras/Benchmark.py
@@ -122,6 +122,9 @@ class Benchmark:
       if len(argv) > 2:
         if argv[2] == "frontend":
 
+          if not os.path.isabs(self.data_dir):
+              self.data_dir = os.getcwd() + "/" + self.data_dir
+           
           if argv[1] == "hpvm_reload": # If reloading HPVM weights use this as directory to load from in HPVM-C generated src
               self.data_dir = self.reload_dir
           
@@ -134,15 +137,17 @@ class Benchmark:
                                                 self.num_classes,
                                                 (argv[1] == "hpvm_reload")) # Do not redump HPVM weights if `hpvm_reload` used
 
-          if len(argv) > 3 and argv[3] == "compile":
-            self.compileSource(working_dir, "approxhpvm_src.cc", "HPVM_binary")
-          else:
-            self.printUsage()
-
-          if len(argv) > 4 and argv[4] == "compile_tuner":
-            self.compileSource(working_dir, "approxhpvm_tuner_src.cc", "HPVM_tuner_binary")
-          else:
-            self.printUsage()
+          if len(argv) > 3:
+            if argv[3] == "compile":
+              self.compileSource(working_dir, "approxhpvm_src.cc", "HPVM_binary")
+            else:
+              self.printUsage()
+
+          if len(argv) > 4:
+            if argv[4] == "compile_tuner":
+              self.compileSource(working_dir, "approxhpvm_tuner_src.cc", "HPVM_tuner_binary")
+            else:
+              self.printUsage()
 
 
         if argv[2] == "keras_dump":
-- 
GitLab