Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Best ways to use MKL's Vector Math Library of function composition

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

zer0nes

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-31-2013
09:54 PM

190 Views

Best ways to use MKL's Vector Math Library of function composition

Should I use VML to compute the sigmoid function of a vector?

If yes, is there a better way than doing 4 loops:

- Negate the vector
- Compute the exp of the vector
- Add 1 to the vector
- Compute the inverse of the vector

?

Thanks.

Link Copied

2 Replies

Bernard

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-01-2013
12:37 AM

190 Views

Andrey_N_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-01-2013
01:14 AM

190 Views

Choice of approach for implementation of the vector sigmoid function could rely on several considerations including vector size, accuracy, and performance. Intel MKL Manual recommends to use VML, if vector size is larger than 40 elements. If vector size in your application is less than 40, Intel(R)R C/C++ compiler might be better choice. Vector math functions support three level of accuracy: high accuracy (HA), low accuracy (LA), and enhanced performance (EP). See additional details in "Data types, Accuracy Modes, and Performance tips" section in"Vector Math Functions" chapter of Intel MKL Manual. Start with EP version of VML functions, which is the fastest. If accuracy of EP VML functions is not sufficient, please try LA or HA versions of VML. Data available at http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/vml/vmldata.htm gives idea about "accuracy vs performance" aspects of Vector Math functions. If size of your vector is significant, you would get additional performance benefit from threading supported by VML (see, for example, performance graph for the exponent function at http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/vml/functions/exp.html)

Eventually, it makes sense to experiment with two versions of the sigmoid function, VML based, and compiler based, and to choose the one which meets your requirements. Combining math functions of Intel(R) MKLand Intel compiler for the development of the vector sigmoid function may be another option.

Andrey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.