From 461c1c6a4fee55ba9c34c234c90b8c7dd7d4729a Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Sat, 13 Mar 2021 22:34:48 -0600
Subject: [PATCH] Updated hpvm rt to avoid printing profile when there's none

---
 .../tensor_runtime/src/hpvm-rt-controller.cpp               | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
index e1634be3a8..02d1747328 100644
--- a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
+++ b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
@@ -273,10 +273,12 @@ double ProfileInfo::getCurrentIterationComputeEnergy() {
 void ProfileInfo::set_out_file_name(std::string &str) { out_file_name = str; }
 
 void ProfileInfo::printToFile() {
-
   INFO("Writing Runtime Profile Info File...\n");
-  std::ofstream s_out(out_file_name.c_str());
 
+  if (control_time_info.size() == 0)
+    return;
+
+  std::ofstream s_out(out_file_name.c_str());
   if (!s_out) {
     ERROR("Failed to open output file.");
     abort();
-- 
GitLab