Skip to content

Layer/Routine Operation Commands

Layer and routine related SoftNeuro commands. It is possible to verify routine information per layer, such as available devices and parameters.

plugins

Manages plugins for additional routines. User can view the list of installed plugins, install/uninstall plugins, and view the list of all avalable plugins with their status.

Usage
softneuro plugins [--help] [-i PLUGIN|auto] [-u PLUGIN|all] [-s]

Flags

Flag Description
-h, --help Shows the command help.
-i, --install PLUGIN Installs a plugin PLUGIN. If auto is provieded, it installs all appropriate plugins automatically.
-u, --uninstall PLUGIN Uninstall a plugin PLUGIN. If all is provided, it uninstalls all plugins.
-s, --status Lists available plugins and their status. The meaning of staus symbols is shown below.
Symbol Status
I Installed successfully
C Installed but conflicted with other plugins
? Installed but may not be loaded on run time
(space) Not installed

Example
Running without any options, you can view the installed plugins.

$ softneuro plugins
plugin_avx2    AVX routines.
plugin_opencl  OpenCL routines.

You may check if other plugins are available. The following result shows plugin_cuda is avalable.

$ softneuro plugins -s
I plugin_avx2
I plugin_opencl
  plugin_cuda

Then you can install plugin_cuda by the following command.

$ softneuro plugin -i plugin_cuda
`plugin_cuda` is installed.

layers

List all available layers.

Usage
usage: softneuro layers [--help]

Flags

Flag Description
-h, --help Shows the command help.

Example

$ softneuro layers
adaptive_unit_scale
add
ave_pool2
batch_norm
box_filter
 :

lparams

Shows the available paramters and their default values for a given layer.

Usage
usage: softneuro lparams [--help] LAYER

Arguments

Argument Description
LAYER Layer to have its parameters shown.

Flags

Flag Description
-h, --help Shows the command help.

Example

$ softneuro lparams conv2
{'padding': 'valid', 'pads': 0, 'dilations': 1, 'strides': 1, 'has_relu': false, 'relu_max_value': -1.0}

routines

Shows the available execution routines in the current environment. Shows the available execution schemas in the current environment.

Usage
usage: softneuro routines [--help] LAYER

Arguments

Argument Description
LAYER Layer to have its routines shown. Shows schemas when no layer was set.

Flags

Flag Description
-h, --help Shows the command help.

Example

$ softneuro routines conv2
cpu/naive
cpu/naive/wg2
cpu:chf/naive
cpu:qint8:pt_sym/naive
cpu:qint8:pt_asym/naive
cpu:qint8:pc_sym/naive
cpu:qint8:pc_asym/naive
cpu:qint8/naive
cpu/wg2
 :

rparams

Show a recipe for routine parameters.

Usage
usage: softneuro rparams [--help] LAYER

Arguments

Argument Description
LAYER Layer that has the routine for which parameters will be shown.
ROUTINE Routine to have its parameters shown.

Flags

Flag Description
-h, --help Shows the command help.

Example

$ softneuro rparams conv2 cpu/wg3x3_nxn_avx
{'cache': [8192, 16384, 32768], 'task_unit': [4, 8, 16], 'tile_size': [2, 4, 6, 8]}

test

Does a test run of the given layer.

Usage

usage: softneuro test [-o OUTPUT]... [--weight WNAME TENSOR]...[--thread NTHREADS]
                      [--affinity MASK[@IDS]]
                      [--params PARAMS][--routine ROUTINE] [--rparams RPARAMS]
                      [--loop NLOOPS] [--help]
                      LAYER [INPUT]...

Arguments

Argument Description
LAYER Layer to be tested.
INPUT Input numpy file or tensor specification.

Flags

Flag Description
-o OUTPUT, --output OUTPUT Filename for the output numpy file. Must be set.
--weight WNAME TENSOR Insert TENSOR data into the WNAME weight tensor. TENSOR can be a numpy file or tensor specification. If weights aren't set they are initialized to random numbers in [-1, 1].
--thread NTHREADS How many threads to be used on execution. Defaults to the amount of CPU cores.
--affinity MASK[@THREAD_INDICES] Use the affinity mask given by MASK on the threads given byTHREAD_INDICES.
MASK should be a little endian hexadecimal (0x..), binary (0b..), or decimal number.
If THREAD_INDICES isn't set all threads will use the given mask.
For more information on THREAD_INDICES use the softneuro help thread_indices command.
--params PARAMS Layer parameters in JSON format. Parameters can be checked with the lparams command.
-r ROUTINE, --routine ROUTINE Set the routine to be executed. Available routines can be checked with the routines command. Defaults to the best available.
--rparams RPARAMS Routine parameters in JSON format. Parameters can be cheked with the rparams command.
-l NLOOPS, --loop NLOOPS Amount of times to run the test. Useful for benchmarking.
-h, --help Shows the command help.

Example

$ softneuro test -o out.npy --weight kernel "shape=3x3x128x128" --weight bias "shape=128" --params '{"padding": "valid", "stride": 2}' --routine "cpu/fast"  conv2 "shape=1x64x64x128"

---------------------------------
Statistics
---------------------------------
FUNCTION       AVE(usec)  MIN(usec)  MAX(usec)  #CALL
Dnn_forward()      2,348      2,348      2,348      1

Used memory: 9,924,608 Bytes