Software Archive
Read-only legacy content
17061 Discussions

Approximate math library for Linux? Or exp function algorithm?

jamesqf
Beginner
438 Views
Hi,
I'm working on a project for which I need a very fast & vectorizableapproximation of the exp function, accurate to say 0.1% or so. I've tried to use the approximate math library, but that appears to be Windows-specific. (I did hack around a bit and get a version that would compile, but it causes a segfault sometime after the am_exp_ps call returns.)
Would anyone know if a) there's a Linux version around somewhere; b) what needs to be done to convert the Windows code; or c) the source of the algorithm used, so I can code it myself?
Thanks,
James
0 Kudos
4 Replies
Todd_R_Intel
Employee
438 Views

James,

Have you ever checked out the Intel Math Kernel Library? Intel MKL contains vecter math functions including exp as part of its Vector Math Library (VML). You can read more at the product website (http://www.intel.com/software/products/mkl/) or look at the documentation online (http://www.intel.com/software/products/mkl/docs/manuals.htm).

Todd

Intel MKL forum: http://softwareforums.intel.com/ids/board?board.id=MKL

0 Kudos
jamesqf
Beginner
438 Views

Todd,

I've been trying to download the VML library demo, but haven't had much luck. (The registration page said it'd send me a key, but hasn't so far.) However, I think the exp function in it would compute the result to full float precision, no? I don't absolutely need that much accuracy for my project, since a) the measurements from which the code is derived are only accurate to a few percent, and b) there's a random distribution being applied to it anyway.

I wouldlike to be able to trade off that excess accuracy for increased speed. Presently I'm using a 7-term McLaurin series approximation (your basic calculus one), but the code in the AM library looks as though it might be a bit faster.

0 Kudos
jamesqf
Beginner
438 Views
I've looked at that, butI don't think it'ssuitable for what I'm doing. I'm not simply computing a vector of exps, I'm writing vector routines to compute various complicated equations,some factors inwhichare exps. So if I were to use the vector routines, I'd have to make several passes, storing intermediate results. Not only would that slow down the computation, it would require extra memory. We don't have a lot to spare - I've spent a lot of time trying to sweat the code down to fit in themere 256 GBytes available at present.
Not to mention that I'd still like to save time with a fast approximation rather than a slower but unnecessarily precise routine.
0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
438 Views
James,
If you are having difficulty installing the Intel MKL evaluation version please file an issue at premier.intel.com so we can look into it. The "key" you mention might be a license file which should be emailed to you within an hour or two of registering. If you file an issue we can investigate what the problem might be and get you a license file.
Thanks,
0 Kudos
Reply