[GitHub] eric-haibin-lin commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2018-03-14 Thread GitBox
eric-haibin-lin commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r174623231
 
 

 ##
 File path: python/mxnet/profiler.py
 ##
 @@ -35,13 +68,16 @@ def profiler_set_config(mode='symbolic', 
filename='profile.json'):
 filename : string, optional
 The name of output trace file. Defaults to 'profile.json'.
 """
-mode2int = {'symbolic': 0, 'all': 1}
-check_call(_LIB.MXSetProfilerConfig(
-ctypes.c_int(mode2int[mode]),
-c_str(filename)))
+warnings.warn('profiler.profiler_set_config() is deprecated. ' \
+  'Please use profiler.set_config() instead')
+keys = c_str_array([key for key in ["profile_" + mode, "filename"]])
+values = c_str_array([str(val) for val in [True, filename]])
+assert len(keys) == len(values)
+check_call(_LIB.MXSetProfilerConfig(len(keys), keys, values))
+
 
-def profiler_set_state(state='stop'):
 
 Review comment:
   @piiswrong we should keep backward compatibility 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] eric-haibin-lin commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2018-03-13 Thread GitBox
eric-haibin-lin commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r174309219
 
 

 ##
 File path: python/mxnet/profiler.py
 ##
 @@ -35,13 +68,16 @@ def profiler_set_config(mode='symbolic', 
filename='profile.json'):
 filename : string, optional
 The name of output trace file. Defaults to 'profile.json'.
 """
-mode2int = {'symbolic': 0, 'all': 1}
-check_call(_LIB.MXSetProfilerConfig(
-ctypes.c_int(mode2int[mode]),
-c_str(filename)))
+warnings.warn('profiler.profiler_set_config() is deprecated. ' \
+  'Please use profiler.set_config() instead')
+keys = c_str_array([key for key in ["profile_" + mode, "filename"]])
+values = c_str_array([str(val) for val in [True, filename]])
+assert len(keys) == len(values)
+check_call(_LIB.MXSetProfilerConfig(len(keys), keys, values))
+
 
-def profiler_set_state(state='stop'):
 
 Review comment:
   This is a breaking change. The previous API should not be removed. At least 
an alias should be kept. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] eric-haibin-lin commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2018-03-13 Thread GitBox
eric-haibin-lin commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r174309219
 
 

 ##
 File path: python/mxnet/profiler.py
 ##
 @@ -35,13 +68,16 @@ def profiler_set_config(mode='symbolic', 
filename='profile.json'):
 filename : string, optional
 The name of output trace file. Defaults to 'profile.json'.
 """
-mode2int = {'symbolic': 0, 'all': 1}
-check_call(_LIB.MXSetProfilerConfig(
-ctypes.c_int(mode2int[mode]),
-c_str(filename)))
+warnings.warn('profiler.profiler_set_config() is deprecated. ' \
+  'Please use profiler.set_config() instead')
+keys = c_str_array([key for key in ["profile_" + mode, "filename"]])
+values = c_str_array([str(val) for val in [True, filename]])
+assert len(keys) == len(values)
+check_call(_LIB.MXSetProfilerConfig(len(keys), keys, values))
+
 
-def profiler_set_state(state='stop'):
 
 Review comment:
   This is a breaking change. The previous API should not be renamed. At least 
an alias should be kept. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] eric-haibin-lin commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2017-12-20 Thread GitBox
eric-haibin-lin commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r158164957
 
 

 ##
 File path: include/mxnet/c_api.h
 ##
 @@ -227,10 +228,131 @@ MXNET_DLL int MXSetProfilerConfig(int mode, const char* 
filename);
  */
 MXNET_DLL int MXSetProfilerState(int state);
 
-/*! \brief Save profile and stop profiler */
+/*!
+ * \brief Save profile and stop profiler
+ * \param append true if appending to current profile file, false for truncate
+ * \return
+ */
 MXNET_DLL int MXDumpProfile();
 
-/*! \brief Set the number of OMP threads to use */
+/*!
+ * \brief Set whether to continuously write the profiling data to a file
+ * \param continuous_dump true to continuously write profiling data to a file
+ * \param delay_in_seconds Number of seconds (or fraction of seconds) to delay 
between writes
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXSetContinuousProfileDump(int continuous_dump, float 
delay_in_seconds);
+
+/*!
+ * \brief Pause profiler tuning collection
+ * \param paused If nonzero, profiling pauses. Otherwise, profiling 
resumes/continues
+ * \return 0 when success, -1 when failure happens.
+ * \note pausing and resuming is global and not recursive
+ */
+MXNET_DLL int MXProfilePause(int paused);
+
+/*!
+ * \brief Create profiling domain
+ * \param domain String representing the domain name to create
+ * \param out Return domain object
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileCreateDomain(const char *domain, ProfileHandle *out);
+
+/*!
+ * \brief Create profile task
+ * \param name Name of the task
+ * \param domain Domain of the task
+ * \param out Output handle
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileCreateTask(ProfileHandle domain,
+  const char *task_name,
+  ProfileHandle *out);
+
+/*!
+ * \brief Create profile frame
+ * \param name Name of the frame
+ * \param domain Domain of the frame
+ * \param out Output handle
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileCreateFrame(ProfileHandle domain,
+   const char *frame_name,
+   ProfileHandle *out);
+
+/*!
+ * \brief Create profile event
+ * \param name Name of the event
+ * \param out Output handle
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileCreateEvent(const char *event_name, ProfileHandle *out);
+
+/*!
+ * \brief Create profile counter
+ * \param name Name of the counter
+ * \param domain Domain of the counter
+ * \param out Output handle
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileCreateCounter(ProfileHandle domain,
+ const char *counter_name,
+ ProfileHandle *out);
+
+/*!
+ * \brief Destroy a frame
+ * \param frame_handle Handle to frame to destroy
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileDestroyHandle(ProfileHandle frame_handle);
+
+/*!
+ * \brief Start timing the duration of a profile duration object such as an 
event, task or frame
+ * \param duration_handle handle to the duration object
+ * \return 0 when success, -1 when failure happens.
+ */
+MXNET_DLL int MXProfileDurationStart(ProfileHandle duration_handle);
+
+/*!
+ * \brief Stoptiming the duration of a profile duration object such as an 
event, task or frame
 
 Review comment:
   nit: `Stoptiming` -> `Stop timing `


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services