diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h
index c91c5b9cc314df9536f2d5efc61c29032cca2c1a..f859b83e94ecc2b4e103792b977279613f119d71 100644
--- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h
+++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h
@@ -58,4 +58,6 @@ extern std::string profile_data;
 extern PerfParamSet *perfParamSet;
 extern SampParamSet *sampParamSet;
 
+extern unsigned int currentTensorID;
+
 #endif
diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc
index 61e37ed9a3dd5a7a40b170660e164d7ae9965344..4902043b7ce6a1240981224d98dc7dac70361500 100644
--- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc
+++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc
@@ -46,3 +46,6 @@ std::string profile_data = "";
 
 PerfParamSet *perfParamSet;
 SampParamSet *sampParamSet;
+
+unsigned int currentTensorID = -1;
+
diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu
index a592ae8591e488e60c0fd8d009653383c5298afb..6759ab3b8eb340ff136238a6643c9e38a7621c7d 100644
--- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu
+++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu
@@ -840,6 +840,8 @@ extern "C"{
 
   void* tensor_set_node_id(unsigned int node_id){
 
+    currentTensorID = node_id;
+
     return NULL;
   }