4

Libraries such as intel-MKL or amd-ACML provide easier interface to SIMD operations on vectors, but I want to chain several functions together. Are there readily available libraries where I can register a parse tree for an expression like

log( tanh(x) + exp(x) )

and then evaluate it on all members of an array ? What I want to avoid is to make a temporary arrays of tanh(x), exp(x) and tanh(x) + exp(x) by calling the mkl or acml functions for tanh(), exp() and +.

I can unroll the loop by hand and use the sse instructions directly, but was wondering if there are C++ libraries which does this for you, i.e.

1. Handles SIMD/SSE functions  
2. Allows building of parse trees out of SIMD/SSE functions.  

I am very much a newbie and have never used SSE or MKL/ACML before, just venturing out into new territory.

BЈовић
  • 62,405
  • 41
  • 173
  • 273
san
  • 4,144
  • 6
  • 32
  • 50
  • @VJo thanks for fixing the typos and reformatting the numbered list. – san Aug 10 '11 at 08:17
  • 1
    This is a bit of a tangent *snort, snort, ahem* but Wolfram Alpha has some optimization and simplification tools like `simplify log( tanh(x) + exp(x) )`] and they have an API too. Might be useful to some aspect of what you're doing, or not: http://blog.wolframalpha.com/2011/04/25/algebraic-simplification-simplifying-expressions-in-wolframalpha/ – HostileFork says dont trust SE Aug 10 '11 at 08:17

2 Answers2

2

It may not do exactly what you want, but I suggest you take a look at macstl. It's a SIMD valarray implementation which uses template metaprogramming, and which can combine expressions into a single loop. You may be able to use this as is or perhaps as a basis for something closer to what you need.

Paul R
  • 208,748
  • 37
  • 389
  • 560
1

Have a look at Intel ABB. It uses a just in time compilation approach IIRC. It can use vector instructions and multithreading depending on the sizes of the vectors you act upon.

Alexandre C.
  • 55,948
  • 11
  • 128
  • 197