boost::simd log/exp/pow

30 views
Skip to first unread message

Engelbert Tijskens

unread,
Mar 27, 2014, 9:25:24 AM3/27/14
to nt2...@googlegroups.com
Hi all,

i am evaluating NT2 for building HPC applications. I really liked the idea of boost::simd being a header only library. i know the problematic lack of documentation has been raised before, but repeating it does no harm.

Basically i wrote a few tests which do computations on arrays of 2000 floats which fit entirely in L1 cache. really simple stuff like
z = x + y
z = x - y
z = x * y
z = x / y
z = sqrt(x)
once i took a look at nt2/demo/saxpy/simd/saxpy_simd.cpp i was able to find the necessary include files and got things working quickly. However, i got stuck on log, exp and pow functions. Apparently none of the .../log.hpp files could make the code compile.

basically a test looks like this:

typedef boost::simd::pack<float> svfloat_t;
size_t const svfloat_width = svfloat_t::static_size;

size_t const ne = 2000;

std::vector<float,boost::simd::allocator<float>> x_(ne);
std::vector<float,boost::simd::allocator<float>> y_(ne);
std::vector<float,boost::simd::allocator<float>> z_(ne);

#define OP log
for( size_t i=0; i<ne; i+=svfloat_width ) {
    svfloat_t sv_x( &x_[i] );      
    svfloat_t sv_y( &y_[i] )
    boost::simd::aligned_store( OP( sv_x ), &z_[i] );

when OP is defined as sqrt everthing goes fine, but not with log.
Reply all
Reply to author
Forward
0 new messages