org.apache.sysds.utils

## Class NativeHelper

- java.lang.Object
- - org.apache.sysds.utils.NativeHelper

-     public class NativeHelper
      extends Object

  This class helps in loading native library. By default, it first tries to load Intel MKL, else tries to load OpenBLAS.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `NativeHelper.NativeBlasState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static NativeHelper.NativeBlasState` | `CURRENT_NATIVE_BLAS_STATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NativeHelper()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `conv2dBackwardDataDense(double[] filter, double[] dout, double[] ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static int` | `conv2dBackwardFilterDense(double[] input, double[] dout, double[] ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static boolean` | `conv2dBackwardFilterSparseDense(int apos, int alen, int[] aix, double[] avals, double[] rotatedDoutPtr, double[] ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static int` | `conv2dDense(double[] input, double[] filter, double[] ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static boolean` | `conv2dSparse(int apos, int alen, int[] aix, double[] avals, double[] filter, double[] ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static int` | `dconv2dBiasAddDense(double[] input, double[] bias, double[] filter, double[] ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static boolean` | `dmmdd(double[] m1, double[] m2, double[] ret, int m1rlen, int m1clen, int m2clen, int numThreads)`
    `static String` | `getCurrentBLAS()` Called by Statistics to print the loaded BLAS.
    `static int` | `getMaxNumThreads()`
    `static void` | `initialize(String customLibPath, String userSpecifiedBLAS)` Initialize the native library before executing the DML program
    `static boolean` | `isNativeLibraryLoaded()` Called by runtime to check if the BLAS is available for exploitation
    `static int` | `sconv2dBiasAddDense(FloatBuffer input, FloatBuffer bias, FloatBuffer filter, FloatBuffer ret, int N, int C, int H, int W, int K, int R, int S, int stride_h, int stride_w, int pad_h, int pad_w, int P, int Q, int numThreads)`
    `static boolean` | `smmdd(FloatBuffer m1, FloatBuffer m2, FloatBuffer ret, int m1rlen, int m1clen, int m2clen, int numThreads)`
    `static boolean` | `tsmm(double[] m1, double[] ret, int m1rlen, int m1clen, boolean leftTrans, int numThreads)`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CURRENT_NATIVE_BLAS_STATE

          public static NativeHelper.NativeBlasState CURRENT_NATIVE_BLAS_STATE

  - ### Constructor Detail

    - #### NativeHelper

          public NativeHelper()

  - ### Method Detail

    - #### getCurrentBLAS

          public static String getCurrentBLAS()

      Called by Statistics to print the loaded BLAS.
      Returns:
        empty string or the BLAS that is loaded

    - #### isNativeLibraryLoaded

          public static boolean isNativeLibraryLoaded()

      Called by runtime to check if the BLAS is available for exploitation
      Returns:
        true if CURRENT_NATIVE_BLAS_STATE is SUCCESSFULLY_LOADED_NATIVE_BLAS_AND_NOT_IN_USE else false

    - #### initialize

          public static void initialize(String customLibPath,
                                        String userSpecifiedBLAS)

      Initialize the native library before executing the DML program
      Parameters:
        `customLibPath` - specified by sysds.native.blas.directory
        `userSpecifiedBLAS` - specified by sysds.native.blas

    - #### getMaxNumThreads

          public static int getMaxNumThreads()

    - #### dmmdd

          public static boolean dmmdd(double[] m1,
                                      double[] m2,
                                      double[] ret,
                                      int m1rlen,
                                      int m1clen,
                                      int m2clen,
                                      int numThreads)

    - #### smmdd

          public static boolean smmdd(FloatBuffer m1,
                                      FloatBuffer m2,
                                      FloatBuffer ret,
                                      int m1rlen,
                                      int m1clen,
                                      int m2clen,
                                      int numThreads)

    - #### tsmm

          public static boolean tsmm(double[] m1,
                                     double[] ret,
                                     int m1rlen,
                                     int m1clen,
                                     boolean leftTrans,
                                     int numThreads)

    - #### conv2dDense

          public static int conv2dDense(double[] input,
                                        double[] filter,
                                        double[] ret,
                                        int N,
                                        int C,
                                        int H,
                                        int W,
                                        int K,
                                        int R,
                                        int S,
                                        int stride_h,
                                        int stride_w,
                                        int pad_h,
                                        int pad_w,
                                        int P,
                                        int Q,
                                        int numThreads)

    - #### dconv2dBiasAddDense

          public static int dconv2dBiasAddDense(double[] input,
                                                double[] bias,
                                                double[] filter,
                                                double[] ret,
                                                int N,
                                                int C,
                                                int H,
                                                int W,
                                                int K,
                                                int R,
                                                int S,
                                                int stride_h,
                                                int stride_w,
                                                int pad_h,
                                                int pad_w,
                                                int P,
                                                int Q,
                                                int numThreads)

    - #### sconv2dBiasAddDense

          public static int sconv2dBiasAddDense(FloatBuffer input,
                                                FloatBuffer bias,
                                                FloatBuffer filter,
                                                FloatBuffer ret,
                                                int N,
                                                int C,
                                                int H,
                                                int W,
                                                int K,
                                                int R,
                                                int S,
                                                int stride_h,
                                                int stride_w,
                                                int pad_h,
                                                int pad_w,
                                                int P,
                                                int Q,
                                                int numThreads)

    - #### conv2dBackwardFilterDense

          public static int conv2dBackwardFilterDense(double[] input,
                                                      double[] dout,
                                                      double[] ret,
                                                      int N,
                                                      int C,
                                                      int H,
                                                      int W,
                                                      int K,
                                                      int R,
                                                      int S,
                                                      int stride_h,
                                                      int stride_w,
                                                      int pad_h,
                                                      int pad_w,
                                                      int P,
                                                      int Q,
                                                      int numThreads)

    - #### conv2dBackwardDataDense

          public static int conv2dBackwardDataDense(double[] filter,
                                                    double[] dout,
                                                    double[] ret,
                                                    int N,
                                                    int C,
                                                    int H,
                                                    int W,
                                                    int K,
                                                    int R,
                                                    int S,
                                                    int stride_h,
                                                    int stride_w,
                                                    int pad_h,
                                                    int pad_w,
                                                    int P,
                                                    int Q,
                                                    int numThreads)

    - #### conv2dBackwardFilterSparseDense

          public static boolean conv2dBackwardFilterSparseDense(int apos,
                                                                int alen,
                                                                int[] aix,
                                                                double[] avals,
                                                                double[] rotatedDoutPtr,
                                                                double[] ret,
                                                                int N,
                                                                int C,
                                                                int H,
                                                                int W,
                                                                int K,
                                                                int R,
                                                                int S,
                                                                int stride_h,
                                                                int stride_w,
                                                                int pad_h,
                                                                int pad_w,
                                                                int P,
                                                                int Q,
                                                                int numThreads)

    - #### conv2dSparse

          public static boolean conv2dSparse(int apos,
                                             int alen,
                                             int[] aix,
                                             double[] avals,
                                             double[] filter,
                                             double[] ret,
                                             int N,
                                             int C,
                                             int H,
                                             int W,
                                             int K,
                                             int R,
                                             int S,
                                             int stride_h,
                                             int stride_w,
                                             int pad_h,
                                             int pad_w,
                                             int P,
                                             int Q,
                                             int numThreads)

Copyright © 2020 The Apache Software Foundation. All rights reserved.