Skip to content

hpcgarage/InTensLi

Repository files navigation

About InTensLi (Input-adaptive and in-place dense tensor-times-matrix multiply)

Overview

To compute a mode-n product: Y=X * U, where X and Y are dense tensors, U is a dense matrix. * represents mode-n product.
There are two stages: first is to generate ttm code according to input tensor and other parameters (gen_ttm); second is to use generated "ttm.cpp" to run ttm code and test its performance.
The tests use random generated dense tensors, users can specify the tensor dimension and maximum and minimum dimension sizes.

How to run?

Refer to script file "run_InTensLi.sh" to run InTensLi as a whole.
The input parameters for executable file "gen_ttm" and "ttm" are the same.
./gen_ttm (or ./ttm)

  • -dim=[Dimension]
  • -maxdimsize=[maximum dimension size]
  • -mindimsize=[minimum dimension size]
    Other dimension sizes are generated by evenly distributed betwee the max and min.
  • -mode=[mode-n product, the mode to be multiplied]
  • -R=[the low-rank value, size of dimension n of the generated tensor Y]
  • -strategy=[1, forward-strategy; 2: backward-strategy]
  • -degree=[number of dimensions used to build inner-most MM kernel]
  • -OMPNT=[number of threads used in for loops]
  • -MKLNT=[number of threads used in MM kernel]
    Parameters "degree", "OMPNT", and "MKLNT" can be specified by users, although InTensLi itself decides reasonable values for them.

Code structure

  • defines.h: use this file to define macros.
  • driver-gen.cpp: main file for the first stage.
  • gen_ttm.cpp: generate "ttm.cpp" for a particular input tensor.
  • decide_mc.cpp:
    1. function decide_component_mode: split tensor dimensions into two parts, modes used in inner matrix multiplication kernel (M_C) and modes used as loops (M_L).
    2. function decide_paras: determine "degree" value and threads used in for loops ("omp_nt"), in MM kernel ("mkl_nt").
  • driver-ttm.cpp: main file to the second stage.
  • util.cpp: auxiliary functions.
  • timer.cpp: timing functions.
  • hpcdefs.h: used in timer.cpp.

Note: Code is not pretty now. Welcome any feedback to improve it!
Contact: Jiajia Li ([email protected])

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published