Add more functions into Paddle MKL lib

lmvvr0a8  于 2021-11-30  发布在  Java
关注(0)|答案(6)|浏览(207)

MKL lib in Paddle is a smaller version and lack following functions that users now would like to use.

DFT
VSLStreamStatePtr stream;
vslNewStream(&stream, VSL_BRNG_MCG31, framework::GetSeed());
vslSkipAheadStream(stream, my_offset);
viRngBernoulli(VSL_RNG_METHOD_BERNOULLI_ICDF, stream, my_amount,
retValue + my_offset, 1.0 - dropout_prob);
vslDeleteStream(&stream);

随机数生辰验证

5hcedyr0

5hcedyr01#

@baoachun
Jacek checked the lib and found those functions are already in Paddle mkl lib. Are you able to get from customer some ready test demo or some new Paddle branch that contains usage of these functions (runnable). Jacek will test and debug.

z9ju0rcb

z9ju0rcb2#

I want to know which file is this function in? Or how to use this function? Should I include some related head files?

hkmswyz6

hkmswyz63#

We are implementing MKL-based fft using the functions documented here.
https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/fourier-transform-functions.html

It includes

DFTI_DESCRIPTOR
DftiCreateDescriptor
DftiCommitDescriptor
DftiSetValue
DftiGetValue
DftiComputeForward
DftiComputeBackward
DftiFreeDescriptor
etc

So mkl_dfti.h and libmkl_cdft_core.so and other necessary dependencies are needed.
We are currently using a complete oneMKL installation to use them.

But we did not find dft related functions in the mkl dependency of paddle (http://paddlepaddledeps.bj.bcebos.com/csrmm_mklml_lnx_2019.0.5.tgz).

9w11ddsr

9w11ddsr4#

@baoachun Please check this.

lskq00tm

lskq00tm5#

@lidanqing-intel The dft related functions no longer need to be introduced.

dm7nw8vv

dm7nw8vv6#

我们在使用MKL优化Dropout OP时发现当前Paddle中的MKL库不够完整,需要依赖MKL附加库才能实现MKL随机数生成函数,因此在优化过程中额外引入了如下文件。其中主要依赖的是libmkl_rt.so,但在需要引入下表中其他MKL库才能保证运行时不会报错。

Customer work on Dropout Op and found MKL lib is not complete, and need to add extra lib to implement MKL random generator. The extra lib is as follows:

libmkl_rt.so
libmkl_core.so
libmkl_vml_def.so
libmkl_intel_thread.so
libmkl_intel_lp64.so

Question: If there is any other way to avoide such introducing extra libs
Answer:

  • PaddlePaddle used a small version of MKL lib, which is required byBaidu and suffificient enough for common usage. If customer wants to use more functions, customer could introduce by including extra libs.
  • If Baidu require to add them into the small MKL package, Intel need reproduction demo and steps to work on.

@baoachun@wzzju

相关问题