Giter Site home page Giter Site logo

Comments (5)

jdgarciauc3m avatar jdgarciauc3m commented on July 20, 2024

@droccom has raised in comments at issue #290 if we should provide reduce either with an identity value or an initial value. Rationale is being aligned with std::reduce

We need to discuss this in detail to make a decision.

from grppi.

mdrocco avatar mdrocco commented on July 20, 2024

If the target is strict consistency with std::reduce, there should be no way to both avoiding the initial value and using a custom binary operator (only std::plus<> is supported).

I think this case is very specific, so I suggest to either:
a. avoid adding it to the GrPPI API;
b. extend it to support generic binary operators (relaxing consistency with std::reduce)

from grppi.

jdgarciauc3m avatar jdgarciauc3m commented on July 20, 2024

New proposed resolution:

Do not take initial value or identity for reduction operations and apply the following semantics:

  • reduce(ex, b, e, binop) -> if (distance(b,e) = 1) return *b
  • reduce(ex, b, e, binop) -> Apply reduction over range [b,e)
  • reduce(ex, b, e, binop) -> if (distance(b,e) <1) return default constructed value

Requirements:

  • value type must be default constructible
  • The result is indeterminate if either binop is not associative or not commutative.

from grppi.

mdrocco avatar mdrocco commented on July 20, 2024

This solution makes great sense to me.

from grppi.

jdgarciauc3m avatar jdgarciauc3m commented on July 20, 2024

We keep the requirement of having to provide identity_value.

Rationale: This is in-line with new reduction objects of parallelism TS in C++. Fastflow also requires an identity value.

from grppi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.