You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/11/25 07:00:58 UTC

[GitHub] [tvm] merrymercy opened a new pull request #6972: [AutoScheduler] Print the time used for measurement

merrymercy opened a new pull request #6972:
URL: https://github.com/apache/tvm/pull/6972


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] FrozenGene commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
FrozenGene commented on a change in pull request #6972:
URL: https://github.com/apache/tvm/pull/6972#discussion_r530168355



##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       How about we define one macro to help the readability?
   
   ```cpp
   #define duration(x) std::chrono::duration_cast<std::chrono::duration<double>>(x).count()
   #define now() std::chrono::high_resolution_clock::now()
   
   auto elapsed_time = duration(now() - t_begin)
   
   PrintElapsedTime(elapsed_time, verbose);
   
   inline void PrintElapsedTime(double elapsed_time, int verbose) {
     StdCout(verbose) << "Time elapsed: " << std::fixed << std::setprecision(2) << elapsed_time << " s"
                      << std::endl;
   }
   ```

##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       How about we define one macro to help the readability?
   
   ```cpp
   #define duration(x) std::chrono::duration_cast<std::chrono::duration<double>>(x).count()
   #define now() std::chrono::high_resolution_clock::now()
   
   auto elapsed_time = duration(now() - t_begin);
   
   PrintElapsedTime(elapsed_time, verbose);
   
   inline void PrintElapsedTime(double elapsed_time, int verbose) {
     StdCout(verbose) << "Time elapsed: " << std::fixed << std::setprecision(2) << elapsed_time << " s"
                      << std::endl;
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6972:
URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560



##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       I feel that
   `
   double duration = std::chrono::duration_cast<std::chrono::duration<double>>(
                           std::chrono::high_resolution_clock::now() - t_begin)
                           .count();
   `
   is too long and makes the readbility worse. This is the reason for creating `PrintElapsedTime`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] FrozenGene commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
FrozenGene commented on a change in pull request #6972:
URL: https://github.com/apache/tvm/pull/6972#discussion_r530162124



##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       I think it is a little strange to pass the `t_begin` and elapse the duration time. I would suggest we pass the `duration` to `PrintElapsedTime` (this name should be better, but current fn name is ok too).
   
   i.e. 
   ```cpp
   double duration = std::chrono::duration_cast<std::chrono::duration<double>>(
                           std::chrono::high_resolution_clock::now() - t_begin)
                           .count();
   inline void PrintElapsedTime(double duration, int verbose) {
     StdCout(verbose) << "Time elapsed: " << std::fixed << std::setprecision(2) << duration << " s"
                      << std::endl;
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6972:
URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560



##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       I feel that
   ```
   double duration = std::chrono::duration_cast<std::chrono::duration<double>>(
                           std::chrono::high_resolution_clock::now() - t_begin)
                           .count();
   ```
   is too long and harms the readbility. So I created `PrintElapsedTime`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] merrymercy merged pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
merrymercy merged pull request #6972:
URL: https://github.com/apache/tvm/pull/6972


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6972:
URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560



##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       I feel that
   ```
   double duration = std::chrono::duration_cast<std::chrono::duration<double>>(
                           std::chrono::high_resolution_clock::now() - t_begin)
                           .count();
   ```
   is too long and makes the readbility worse. This is the reason for creating `PrintElapsedTime`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] merrymercy commented on a change in pull request #6972: [AutoScheduler] Print the time used for measurement

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6972:
URL: https://github.com/apache/tvm/pull/6972#discussion_r530163560



##########
File path: src/auto_scheduler/utils.h
##########
@@ -253,6 +254,16 @@ inline std::string Chars(const char& str, int times) {
   return ret.str();
 }
 
+/*! \brief Print the time elapsed */
+inline void PrintTimeElapsed(std::chrono::time_point<std::chrono::high_resolution_clock> t_begin,

Review comment:
       I feel that
   ```c++
   double duration = std::chrono::duration_cast<std::chrono::duration<double>>(
                           std::chrono::high_resolution_clock::now() - t_begin)
                           .count();
   ```
   is too long and harms the readbility. So I created `PrintElapsedTime`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org