newbie question: howto prepare data for processing (i.e.: conv/deconv)

53 views
Skip to first unread message

h....@web.de

unread,
May 18, 2015, 2:15:41 PM5/18/15
to nt2...@googlegroups.com
Hi all,

I try to compile some testcode with Win7 Pro, Visual Studio 2010 Pro, boost 1.58.0 and Boost.NT² 3.1.0. Sadly, it fails to compile.

The testcode is based on the following MATLAB example:

What am I doing wrong?

#include "stdafx.h"

#undef min
#undef max

#include <boost/simd/memory/allocator.hpp>
#include <vector>

#include <nt2/table.hpp>
#include <nt2/core/functions/tie.hpp>
#include <nt2/polynom/functions/conv.hpp>
#include <nt2/polynom/functions/deconv.hpp>

#include "de_conv.h"

void de_conv()
{
typedef std::vector<double, boost::simd::allocator<double>> aligned_vector;

aligned_vector vu(4);

vu[0] = 1.0;
vu[1] = 2.0;
vu[2] = 3.0;
vu[3] = 4.0;

aligned_vector vv(3);

vv[0] = 10.0;
vv[1] = 20.0;
vv[2] = 30.0;

nt2::table<double> tu(&vu[0], &vu[0] + vu.size());
nt2::table<double> tv(&vv[0], &vv[0] + vv.size());
nt2::table<double> tq, tr, tc;

NT2_DISPLAY(tu);
NT2_DISPLAY(tv);

tc = nt2::conv(tu, tv);

nt2::tie(tq, tr) = nt2::deconv(tc, tu);

NT2_DISPLAY(tc);
NT2_DISPLAY(tq);
NT2_DISPLAY(tr);
}

The error is as follows: (cannot switch to english language, but the error looks like a usual stupid newbie mistake:)

1>C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/dsl/details/value/elementwise.hpp(41): error C2039: 'type': Ist kein Element von 'boost::dispatch::meta::call<Sig>'
1>          with
1>          [
1>              Sig=nt2::tag::conv_ (const double &,const double &)
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/dsl/value_type.hpp(39): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "nt2::details::value_type<Tag,Domain,N,Expr>".
1>          with
1>          [
1>              Tag=nt2::tag::conv_,
1>              Domain=nt2::container::domain,
1>              N=2,
1>              Expr=const boost::proto::exprns_::basic_expr<nt2::tag::conv_,boost::proto::argsns_::list2<nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>,nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>>,2>
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/dsl/details/generator.hpp(54): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "nt2::ext::value_type<Tag,Domain,N,Expr>".
1>          with
1>          [
1>              Tag=nt2::tag::conv_,
1>              Domain=nt2::container::domain,
1>              N=2,
1>              Expr=const boost::proto::exprns_::basic_expr<nt2::tag::conv_,boost::proto::argsns_::list2<nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>,nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>>,2>
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/dsl/details/trait_transform.hpp(39): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "nt2::details::generator<Tag,Domain,Arity,Expr>".
1>          with
1>          [
1>              Tag=nt2::tag::conv_,
1>              Domain=nt2::container::domain,
1>              Arity=2,
1>              Expr=const boost::proto::exprns_::basic_expr<nt2::tag::conv_,boost::proto::argsns_::list2<nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>,nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>>,2>
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\boost/proto/transform/impl.hpp(239): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "nt2::details::trait_transform<Trait,Domain>::impl<Expr,State,Data>".
1>          with
1>          [
1>              Trait=nt2::details::generator,
1>              Domain=nt2::container::domain,
1>              Expr=boost::proto::exprns_::basic_expr<nt2::tag::conv_,boost::proto::argsns_::list2<nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>,nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>>,2>,
1>              State=boost::proto::envns_::empty_state,
1>              Data=boost::proto::envns_::empty_env
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\boost/proto/transform/impl.hpp(255): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "boost::proto::detail::apply_transform<Sig>".
1>          with
1>          [
1>              Sig=nt2::container::generator_transform<nt2::container::domain> (boost::proto::exprns_::basic_expr<nt2::tag::conv_,boost::proto::argsns_::list2<nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>,nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>>,2>)
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\boost/proto/detail/preprocessed/make_expr_.hpp(73): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "boost::proto::transform<PrimitiveTransform>::result<Sig>".
1>          with
1>          [
1>              PrimitiveTransform=nt2::details::trait_transform<nt2::details::generator,nt2::container::domain>,
1>              Sig=nt2::container::generator_transform<nt2::container::domain> (boost::proto::exprns_::basic_expr<nt2::tag::conv_,boost::proto::argsns_::list2<nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>,nt2::container::view<nt2::tag::table_,const double,nt2::settings (void)>>,2>)
1>          ]
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\boost/proto/detail/preprocessed/make_expr_.hpp(91): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "boost::proto::detail::make_expr_<Tag,Domain,A0,A1>".
1>          with
1>          [
1>              Tag=nt2::tag::conv_,
1>              Domain=boost::proto::detail::common_domain2<nt2::container::domain,nt2::container::domain>::type,
1>              A0=const nt2::container::table<double> &,
1>              A1=const nt2::container::table<double> &
1>          ]
....


Kind regards,
Hanno Meyer-Thurow

Joel Falcou

unread,
May 18, 2015, 2:17:00 PM5/18/15
to nt2...@googlegroups.com
the includes :

#include <nt2/core/functions/tie.hpp>
#include <nt2/polynom/functions/conv.hpp>
#include <nt2/polynom/functions/deconv.hpp>

shoudl be

#include <nt2/include/functions/tie.hpp>
#include <nt2/include/functions/conv.hpp>
#include <nt2/include/functions/deconv.hpp>

As stated int he documentation, the first one are basically forward declaration. The second brings in the require dimplementation with respect to your machine settings.



--
You received this message because you are subscribed to the Google Groups "nt2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nt2-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

h....@web.de

unread,
May 19, 2015, 2:47:00 AM5/19/15
to nt2...@googlegroups.com
Arrr, this is embarassing. The next one as well. Thank you very much for your help and in advance!

Now, I am facing the following error:
(I guess the part about "konnte nicht spezialisiert werden" - "could not be specialized" means I miss another key.)

1>C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/table/table.hpp(84): error C2780: 'boost::dispatch::meta::result_of<boost::dispatch::meta::dispatch_call<nt2::tag::construct_(A0 &,const A1 &,const A2 &,const A3 &)>::type(A0 &,const A1 &,const A2 &,const A3 &)>::type nt2::construct(A0 &,const A1 &,const A2 &,const A3 &)': Erwartet 4 Argumente - 3 unterstützt
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/functions/construct.hpp(50): Siehe Deklaration von 'nt2::construct'
1>          de_conv.cpp(33): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "nt2::container::table<T>::table<T*,T*>(const A0 &,const A1 &)".
1>          with
1>          [
1>              T=double,
1>              A0=double *,
1>              A1=double *
1>          ]
1>C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/table/table.hpp(84): error C2893: Funktionsvorlage 'boost::dispatch::meta::result_of<boost::dispatch::meta::dispatch_call<nt2::tag::construct_(A0 &,const A1 &,const A2 &)>::type(A0 &,const A1 &,const A2 &)>::type nt2::construct(A0 &,const A1 &,const A2 &)' konnte nicht spezialisiert werden
1>          Mit den folgenden Vorlagenargumenten:
1>          'nt2::container::table<T>'
1>          with
1>          [
1>              T=double
1>          ]
1>          'double *'
1>          'double *'
1>C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/container/table/table.hpp(84): error C2780: 'boost::dispatch::meta::result_of<boost::dispatch::meta::dispatch_call<nt2::tag::construct_(A0 &,const A1 &)>::type(A0 &,const A1 &)>::type nt2::construct(A0 &,const A1 &)': Erwartet 2 Argumente - 3 unterstützt
1>          C:\Users\h.mth\Documents\Visual Studio 2010\Projects\simd\include\nt2/core/functions/construct.hpp(48): Siehe Deklaration von 'nt2::construct'


Kind regards,
Hanno Meyer-Thurow

Mathias Gaunard

unread,
May 21, 2015, 1:56:39 AM5/21/15
to nt2...@googlegroups.com
I think this kind of error is usually a problem with the compiler not
handling C++11 correctly.

Can you try with master?
> --
> You received this message because you are subscribed to the Google
> Groups "nt2-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to nt2-dev+u...@googlegroups.com
> <mailto:nt2-dev+u...@googlegroups.com>.

Joel FALCOU

unread,
May 21, 2015, 1:43:20 PM5/21/15
to nt2...@googlegroups.com
Your issue with construct is maybe related to the fact table constructor
from range expect a extent (ie a nD boundaries) object as first parameter :

float data[] = { 1,2,3, 4,5,6 };

table<float> x( of_size(3,2), &data[0], &data[0] + 6 );

h....@web.de

unread,
May 21, 2015, 1:43:40 PM5/21/15
to nt2...@googlegroups.com
Just for the record, I tried to compile my testcode with Visual Studio 2015 RC community edition instead.
The result is the very same error as with VS2010.

Is there somewhere a package for nightly builds?

If not, do I have to compile master and create a package myself?
If so, compilation failed with Visual Studio 2010 Win32/Release target at:

nt2-master\modules\boost\dispatch\include\boost/dispatch/meta/hierarchy_of.hpp(76)

And at another location. It does not like using-statements.

I will retry with Visual Studio 2015 RC. Let's see...


Kind regards,
Hanno Meyer-Thurow

h....@web.de

unread,
May 21, 2015, 2:09:36 PM5/21/15
to nt2...@googlegroups.com
Yes, I had a look at: nt2/core/functions/table/construct.hpp

And I guess this version looks ok to compile:

nt2::table<double> tu(vu.size(), &vu[0], &vu[0] + vu.size());

Another problem I just found is that my memory could be exhausted(4GB where windows uses nearly 2GB already).
I guess I better find a better system first before further testing ...

Thank you very much!


Kind regards,
Hanno Meyer-Thurow

Joel FALCOU

unread,
May 21, 2015, 2:19:01 PM5/21/15
to nt2...@googlegroups.com


On 21/05/2015 20:09, h....@web.de wrote:
> Yes, I had a look at: nt2/core/functions/table/construct.hpp
>
> And I guess this version looks ok to compile:
>
> nt2::table<double> tu(vu.size(), &vu[0], &vu[0] + vu.size());
>
>
> Another problem I just found is that my memory could be exhausted(4GB
> where windows uses nearly 2GB already).
> I guess I better find a better system first before further testing ...
>

The way you initialize the data make it so the vector data are copied
back into the table. Either just allocate the table and fill it in or
use the shared_ constructor that will just reference data :

table<float, nt2::shared_> tu(of_size(1,n), nt2::share(&vu[0], &vu[0] +
vu.size()));

h....@web.de

unread,
May 21, 2015, 3:19:27 PM5/21/15
to nt2...@googlegroups.com
Okay, that would be the next step. Thank you, again!

h....@web.de

unread,
May 21, 2015, 3:22:45 PM5/21/15
to nt2...@googlegroups.com
I just compiled master with Visual Studio 2015. Sadly, there are missing headers in nt2/include/...
For example, nt2.core.polynom is missing completely. Which would have shipped the functions conv/deconv.



Am Donnerstag, 21. Mai 2015 07:56:39 UTC+2 schrieb Mathias Gaunard:

Joel FALCOU

unread,
May 21, 2015, 3:25:18 PM5/21/15
to nt2...@googlegroups.com
did you rerun your cmake to regenerate the headers ?

h....@web.de

unread,
May 21, 2015, 4:57:58 PM5/21/15
to nt2...@googlegroups.com
I generated the project files for Visual Studio 2015, built the Win32/Release project map via 'F7',
60 projects succeeded and finally built the package.

How do I regenerate the headers?

h....@web.de

unread,
May 21, 2015, 5:07:10 PM5/21/15
to nt2...@googlegroups.com
Attached you find the current source file and compiler log for: Visual Studio 2015 and nt2 v3.1.0.

The tables are constructed but it chokes on conv/deconv functions. Any ideas?


Kind regards,
Hanno Meyer-Thurow


Am Donnerstag, 21. Mai 2015 20:19:01 UTC+2 schrieb Joel Falcou:
de_conv.cpp
simd.log

h....@web.de

unread,
May 23, 2015, 4:13:33 AM5/23/15
to nt2...@googlegroups.com, h....@web.de
I finally got around to test the code on my linux box.

The result is not any better, sadly. The specs are:

___
SYSTEM
Linux ana 3.18.3-gentoo #1 SMP PREEMPT Tue Jan 27 21:27:55 CET 2015 x86_64 Intel(R) Core(TM) i5-2500T CPU @ 2.30GHz GenuineIntel GNU/Linux

COMPILER
gcc version 4.9.2 (Gentoo 4.9.2 p1.0, pie-0.6.2)

LIBRARIES
boost 1.58.0 (compiled with --std=c++11)
nt2 3.1.0

COMMAND
$ g++ conv.cxx --std=c++11 -O3 -o conv -I nt2/include/ -static -L nt2/lib -lnt2 > /tmp/simd.log 2>&1
___


Attached there is the source code, ready to compile, and the gcc output, which chokes on 'NT2_DISPLAY(tc)'.


Am Montag, 18. Mai 2015 20:15:41 UTC+2 schrieb h....@web.de:
Hi all,

The testcode is based on the following MATLAB example:


Kind regards,
Hanno Meyer-Thurow
simd.log
conv.cxx

h....@web.de

unread,
May 23, 2015, 4:14:11 PM5/23/15
to nt2...@googlegroups.com
Finally got master built as it should on my linux box.
That, you do not want to do under Windows.

Looks much better! But now, I get gcc ICE with gcc-4.9.2 and gcc-5.1.0.

Log is attached.


Am Donnerstag, 21. Mai 2015 07:56:39 UTC+2 schrieb Mathias Gaunard:
gcc-ice.log

h....@web.de

unread,
May 25, 2015, 5:49:56 AM5/25/15
to nt2...@googlegroups.com, h....@web.de
Okay, gcc/c++11 does not like the boost type traits.
I changed the type traits of boost.simd.native header to c++11 ones and nt2::conv compiled and works(results as in MATLAB example).
nt2::deconv is not that trivial to fix; a simple replace failed to compile.

I guess I will retry once you changed the type traits to c++11 implementation.


Would be great if you notice me then.


Kind regards,
Hanno Meyer-Thurow

Joel FALCOU

unread,
May 25, 2015, 5:58:59 AM5/25/15
to nt2...@googlegroups.com
I'll gladly accept a patch for that. We din't put 4.9/5.x on our test
bot yet. We probably should.

h....@web.de

unread,
May 25, 2015, 12:25:49 PM5/25/15
to nt2...@googlegroups.com
Well, as soon as you go c++11-only you do simple sed/awk commands to switch, at least for type traits.

For now, I have done my tests and the nt2 library looks promising for my needs!


Kind regards,
Hanno Meyer-Thurow
Reply all
Reply to author
Forward
0 new messages