Skip to content

morapi_DnnProf Struct Reference

dnn » prof

Dnn profiler and profiling data.
More...

#include <morapi_softneuro.h>

Public Member Functions


Primary functions

morapi_DnnProf morapi_create_DnnProf (morapi_Env *io_env)
morapi_Result  morapi_destroy_DnnProf (morapi_Env *io_env, morapi_DnnProf *self)
morapi_Result  morapi_DnnProf_init (morapi_DnnProf *self, morapi_Dnn *i_dnn)
const morapi_Dnn morapi_DnnProf_getDnn (const morapi_DnnProf *self)
morapi_Bool  morapi_DnnProf_canAdd (morapi_DnnProf *self, const morapi_Char *i_routine, const morapi_DnnLayer *i_layer, morapi_Bool i_is_for_another_device)
morapi_Result  morapi_DnnProf_add (morapi_DnnProf *self, const morapi_Char *i_routine, const morapi_DnnLayer *i_layer)
morapi_Result  morapi_DnnProf_remove (morapi_DnnProf *self, const morapi_Char *i_routine, const morapi_DnnLayer *i_layer)
morapi_Result  morapi_DnnProf_reset (morapi_DnnProf *self, const morapi_Char *i_routine, const morapi_DnnLayer *i_layer)
morapi_Result  morapi_DnnProf_profile (morapi_DnnProf *self, morapi_DnnProfProgressedCB i_cbfunc, void *i_cbobj)
morapi_Result  morapi_DnnProf_save (const morapi_DnnProf *self, const morapi_Char *i_filename, morapi_Bool i_is_ascii)
morapi_Result  morapi_DnnProf_load (morapi_DnnProf *self, const morapi_Char *i_filename, const morapi_Char *i_dnn_filename, const void *i_password, morapi_Int32 i_password_len)

Optional settings

morapi_Bool  morapi_DnnProf_isAscii (const morapi_DnnProf *self)
morapi_Result  morapi_DnnProf_setThreadNum (morapi_DnnProf *self, morapi_Int32 i_thread_num)
morapi_Int32  morapi_DnnProf_getThreadNum (const morapi_DnnProf *self)
morapi_Result  morapi_DnnProf_setAffinityMask (morapi_DnnProf *self, morapi_Int32 i_index, const morapi_Char *i_text)
morapi_Int32  morapi_DnnProf_getAffinityMaskNum (const morapi_DnnProf *self)
const morapi_Char morapi_DnnProf_getAffinityMask (const morapi_DnnProf *self, morapi_Int32 i_index)
morapi_Int32  morapi_DnnProf_getSchemaNum (const morapi_DnnProf *self)
const morapi_Char morapi_DnnProf_getSchema (const morapi_DnnProf *self, morapi_Int32 i_index)
morapi_Result  morapi_DnnProf_setEstimateMode (morapi_DnnProf *self, morapi_DnnProfEstimateMode i_estimate_mode)
morapi_DnnProfEstimateMode  morapi_DnnProf_getEstimateMode (const morapi_DnnProf *self)
morapi_Result  morapi_DnnProf_setRunNum (morapi_DnnProf *self, morapi_Int32 i_run_num)
morapi_Int32  morapi_DnnProf_getRunNum (const morapi_DnnProf *self)
morapi_Result  morapi_DnnProf_cancel (morapi_DnnProf *self)
morapi_Bool  morapi_DnnProf_isCanceled (const morapi_DnnProf *self)
morapi_Bool  morapi_DnnProf_isPreparing (const morapi_DnnProf *self)
morapi_Real  morapi_DnnProf_getProgress (const morapi_DnnProf *self)
morapi_Real  morapi_DnnProf_getElapsedSec (const morapi_DnnProf *self)


Detailed Description

Dnn profiler and profiling data.


test_prof_api.c.


Member Function Documentation


morapi_create_DnnProf()

morapi_DnnProf * morapi_create_DnnProf (morapi_Env * io_env)

Creates a profiler.

Parameters

  • io_env : environment object

test_prof_api.c.


morapi_destroy_DnnProf()

morapi_Result morapi_destroy_DnnProf (morapi_Env * io_env,
                                      morapi_DnnProf * self)

Destroys the profiler.

Parameters

  • io_env : environment object that used to create the profiler object
  • self : the profiler object to destroy

test_prof_api.c.


morapi_DnnProf_init()

morapi_Result morapi_DnnProf_init (morapi_DnnProf * self,
                                   morapi_Dnn * i_dnn)

Initializes profiling data with a dnn.

Parameters

  • self : the dnn profiler
  • i_dnn : the dnn object to be profiled

test_prof_api.c.


morapi_DnnProf_getDnn()

const morapi_Dnn * morapi_DnnProf_getDnn (const morapi_DnnProf * self)

Gets the dnn that the DnnProf works on.

Parameters

  • self : the dnn profiler

Returns

the dnn


morapi_DnnProf_canAdd()

morapi_Bool morapi_DnnProf_canAdd (morapi_DnnProf * self,
                                   const morapi_Char * i_routine,
                                   const morapi_DnnLayer * i_layer,
                                   morapi_Bool i_is_for_another_device)

Checks whether a profiling routine can be added to a layer.

Parameters

  • self : the dnn profiler.
  • i_routine : the profiling routine.
  • i_layer : the layer to which the profiling routine is added. If NULL is given, checks whether the profiling routine can be added to any of layers in a main net.
  • i_is_for_another_device : whether the profiling routine is for another device or not.


morapi_DnnProf_add()

morapi_Result morapi_DnnProf_add (morapi_DnnProf * self,
                                  const morapi_Char * i_routine,
                                  const morapi_DnnLayer * i_layer)

Adds a profiling routine to a layer.

Parameters

  • self : the dnn profiler.
  • i_routine : the profiling routine.
  • i_layer : the layer to which the profiling routine is added. If NULL is given, the profiling routine is added to all layers in a main net.

test_prof_api.c.


morapi_DnnProf_remove()

morapi_Result morapi_DnnProf_remove (morapi_DnnProf * self,
                                     const morapi_Char * i_routine,
                                     const morapi_DnnLayer * i_layer)

Removes a profiling routine from a layer.

Parameters

  • self : the dnn profiler.
  • i_routine : the profiling routine. If NULL or an empty string ("") is given, all profiling routines are removed from the layer.
  • i_layer : the layer from which the profiling routine is removed. If NULL is given, the profiling routine is removed from all layers.


morapi_DnnProf_reset()

morapi_Result morapi_DnnProf_reset (morapi_DnnProf * self,
                                    const morapi_Char * i_routine,
                                    const morapi_DnnLayer * i_layer)

Resets profiling data.

It clears measured processing time for a profiling routine in a layer.

Parameters

  • self : the dnn profiler.
  • i_routine : the profiling routine to be reset. If NULL or an empty string ("") is given, all profiling routines are reset.
  • i_layer : the layer to be reset. If NULL is given, the routines in all layers are reset.


morapi_DnnProf_profile()

morapi_Result morapi_DnnProf_profile (morapi_DnnProf * self,
                                      morapi_DnnProfProgressedCB i_cbfunc,
                                      void * i_cbobj)

Runs profiling with a callback function for progress.

Parameters

  • self : the dnn profiler
  • i_cbfunc : a callback function for reporting progress
  • i_cbobj : an argument for the callback function

test_prof_api.c.


morapi_DnnProf_save()

morapi_Result morapi_DnnProf_save (const morapi_DnnProf * self,
                                   const morapi_Char * i_filename,
                                   morapi_Bool i_is_ascii)

Saves the profiling data to a file.

Parameters

  • self : the dnn profiler
  • i_filename : a file name to save the profiling data
  • i_is_ascii : a boolean. Specify true to save the profiling data as ASCII.


morapi_DnnProf_load()

morapi_Result morapi_DnnProf_load (morapi_DnnProf * self,
                                   const morapi_Char * i_filename,
                                   const morapi_Char * i_dnn_filename,
                                   const void * i_password,
                                   morapi_Int32 i_password_len)

Loads a profiling data from a file.

Parameters

  • self : the dnn profiler
  • i_filename : a file name for the profiling data
  • i_dnn_filename : a file name for dnn file used for profiling
  • i_password : a password string for the profiling data
  • i_password_len : the length of the i_password string.


morapi_DnnProf_isAscii()

morapi_Bool morapi_DnnProf_isAscii (const morapi_DnnProf * self)

Returns whether self is saved in ascii format or not.

Parameters

  • self : the dnn profiler

Returns

whether self is saved in ascii format or not


morapi_DnnProf_setThreadNum()

morapi_Result morapi_DnnProf_setThreadNum (morapi_DnnProf * self,
                                           morapi_Int32 i_thread_num)

Sets the number of threads.

It resets all profiling data and clears all affinity masks.

Parameters

  • self : the dnn profiler
  • i_thread_num : the number of threads to use for profiling


morapi_DnnProf_getThreadNum()

morapi_Int32 morapi_DnnProf_getThreadNum (const morapi_DnnProf * self)

Gets the number of threads.

Parameters

  • self : the dnn profiler

Returns

the number of threads


morapi_DnnProf_setAffinityMask()

morapi_Result morapi_DnnProf_setAffinityMask (morapi_DnnProf * self,
                                              morapi_Int32 i_index,
                                              const morapi_Char * i_text)

Sets the i_index-th affinity mask.

It resets all profiling data.

Parameters

  • self : the dnn profiler
  • i_index : the index of the affinity mask
  • i_text : the text-based affinity mask (Hex, Bin, Dec are available)


morapi_DnnProf_getAffinityMaskNum()

morapi_Int32 morapi_DnnProf_getAffinityMaskNum (const morapi_DnnProf * self)

Gets the number of affinity masks.

Parameters

  • self : the dnn profiler

Returns

the number of affinity masks


morapi_DnnProf_getAffinityMask()

const morapi_Char * morapi_DnnProf_getAffinityMask (const morapi_DnnProf * self,
                                                    morapi_Int32 i_index)

Gets the i_idnex-th affinity mask.

Parameters

  • self : the dnn profiler
  • i_index : the index for affinity mask of the interest

Returns

the text-based affinity mask


morapi_DnnProf_getSchemaNum()

morapi_Int32 morapi_DnnProf_getSchemaNum (const morapi_DnnProf * self)

Gets the number of schemas to be profiled.

Parameters

  • self : the dnn profiler

Returns

the number of schemas to be profiled


morapi_DnnProf_getSchema()

const morapi_Char * morapi_DnnProf_getSchema (const morapi_DnnProf * self,
                                              morapi_Int32 i_index)

Gets the i_index-th schema to be profiled.

Parameters

  • self : the dnn profiler
  • i_index : the index of schemas in the profiler

Returns

the i_index-th schema to be profiled


morapi_DnnProf_setEstimateMode()

morapi_Result morapi_DnnProf_setEstimateMode (morapi_DnnProf * self,
                                              morapi_DnnProfEstimateMode i_estimate_mode)

Sets the estimation mode of profiling data.

Parameters

  • self : the dnn profiler
  • i_estimate_mode : the estimation mode by morapi_DnnProfEstimateMode enumeration


morapi_DnnProf_getEstimateMode()

morapi_DnnProfEstimateMode morapi_DnnProf_getEstimateMode (const morapi_DnnProf * self)

Gets the estimation mode of profiling data.

Parameters

  • self : the dnn profiler

Returns

the estimation mode of profiling data


morapi_DnnProf_setRunNum()

morapi_Result morapi_DnnProf_setRunNum (morapi_DnnProf * self,
                                        morapi_Int32 i_run_num)

Sets the number of iterations when profiling a routine.

The default is 10.

Parameters

  • self : the dnn profiler
  • i_run_num : the number of iterations to profile a single routine


morapi_DnnProf_getRunNum()

morapi_Int32 morapi_DnnProf_getRunNum (const morapi_DnnProf * self)

Gets the number of iterations when profiling a routine.

The default is 10.

Parameters

  • self : the dnn profiler

Returns

the number of iterations


morapi_DnnProf_cancel()

morapi_Result morapi_DnnProf_cancel (morapi_DnnProf * self)

Cancels profiling.

Parameters

  • self : the profiler object


morapi_DnnProf_isCanceled()

morapi_Bool morapi_DnnProf_isCanceled (const morapi_DnnProf * self)

Returns whether self is canceled or not.

Parameters

  • self : the profiler object

Returns

whether profiling is canceled or not


morapi_DnnProf_isPreparing()

morapi_Bool morapi_DnnProf_isPreparing (const morapi_DnnProf * self)

Returns whether preparing or not.

Parameters

  • self : the profiler object

Returns

whether profiler is preparing or not


morapi_DnnProf_getProgress()

morapi_Real morapi_DnnProf_getProgress (const morapi_DnnProf * self)

Gets the progress of profiling process.

Parameters

  • self : the profiler object

Returns

Progress rate between 0 and 1.


test_prof_api.c.


morapi_DnnProf_getElapsedSec()

morapi_Real morapi_DnnProf_getElapsedSec (const morapi_DnnProf * self)

Gets the elapsed sec.

Parameters

  • self : the profiler object

Returns

the elapsed time [sec]