Okay, this approach has a problem at the OP() stage because *_expression
will store a reference to a temporary object, and because it creates
problem for the *element* part of the statement. On the other-hand,
scalar_expression<VectorType, VectorType, reduce_type<OP> >(v,v) would need
to be converted to the same end-tree anyway, which will lead to the same
problem inside the statement...
Philippe
2013/10/18 Philippe Tillet <phil.til...@gmail.com>
> Hey,
>
> While we're at it. I'm implementing reductions, now.
> There are two options here :
>
> template<class OP, class VectorType> reduce(VectorType const & v) {
> return scalar_expression<VectorType, OP, reduce_type>(v, OP());
> }
>
> or
>
> template<class OP, class VectorType> reduce(VectorType const & v) {
> return scalar_expression<VectorType, VectorType, reduce_type<OP>
> >(v,v);
> }
>
> the first one is scheduler-friendly, but the second one is more
> meta-programming friendly. I'm really confused here, any advice on which
> one to choose? I would prefer the first one, since handling the second one
> in the scheduler would clearly be a pain, considering that I don't want to
> introduce REDUCE_ADD, REDUCE_MAX, etc..., but just a single REDUCE,
> operator, and reuse the existing ones. I think several other similar cases
> will arise, such as three arguments function, where it is preferable to
> create the appropriate tree structure directly from the function call. Am I
> right?
>
> Philippe
>
>
> 2013/10/18 Karl Rupp <r...@iue.tuwien.ac.at>
>
>> Hey,
>>
>> > OPERATION_FUNCTION_SUB_TYPE_FAMILY (norm, prod, inner_prod, etc...)
>> > OPERATION_ELEMENT_FUNCTION_SUB_TYPE_FAMILY (abs, pow, etc)
>> > OPERATION_ELEMENT_OPERATOR_SUB_TYPE_FAMILY(+, ==, >, etc...)
>>
>> I assume they are all within the same enum -> go for it :-)
>>
>> Best regards,
>> Karli
>>
>>
>>
>> ------------------------------------------------------------------------------
>> October Webinars: Code for Performance
>> Free Intel webinars can help you accelerate application performance.
>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
>> from
>> the latest Intel processors and coprocessors. See abstracts and register >
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
>> _______________________________________________
>> ViennaCL-devel mailing list
>> ViennaCL-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/viennacl-devel
>>
>
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel