Git Product home page Git Product logo

Comments (4)

denisalevi avatar denisalevi commented on June 3, 2024

Just saw that brian2 has an issue for clip in cpp standalone as well (brian-team/brian2#782). Just referencing it here since probably the only difference btwn cpp and cuda implementation will be the __host__ __device__ flags I suppose.

from brian2cuda.

denisalevi avatar denisalevi commented on June 3, 2024

Brian2 templates just the first arguments (value) and casts the other two (a_min and a_max) to double (merged in brian-team/brian2#810).
Makes sense, but we might want an option to cast to float when having #37 implemented, which then is not type save for large integers. If we still want it, it should produce a warning and can probably be implemented similar as done for #45.
Either way, we should update this when we next update brian2, which added tests for the clip function to return the same type as the value argument.

from brian2cuda.

moritzaugustin avatar moritzaugustin commented on June 3, 2024

now: only single precision
others move to wishlist

from brian2cuda.

denisalevi avatar denisalevi commented on June 3, 2024

I implemented a quick fix for single precision: Depending on precision mode (single/double), all argument of clip are now float or double

clip(float value, float min, float max){}
clip(double value, double min, double max){}

This means it is not type safe to pass int32 values in single precision mode. But it is not relevant for our benchmarks (we only pass 0 as integer literal in STDP).

brian2 has templated the value parameter and castst the other to double. brian2genn just used only float, which is not typesafe.

from brian2cuda.

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.