Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Troels Henriksen
    @athas
    Cool!
    Can that be used for visualisation?
    Orestis
    @omhepia:matrix.org
    [m]
    it creates a triangularized iso-surface of a scalar field
    Snektron
    @snektron:matrix.org
    [m]
    Oh thats pretty cool :)
    Troels Henriksen
    @athas
    By the way, if any of you have problems or ideas for things that can be solved with automatic differentiation, let me know. (Preferably not deep learning/backprop.) We're building a hammer and looking for some nails.
    2 replies
    Snektron
    @snektron:matrix.org
    [m]
    What does automatic differentiation entail? Just an expression and then computing a value regarding of its derivative?
    Troels Henriksen
    @athas
    At a high level, yes. Computing derivatives of (in principle) arbitrary functions at some point.
    Including functions that are not differentiable everywhere.
    Snektron
    @snektron:matrix.org
    [m]
    My first thought would be some physics application
    Troels Henriksen
    @athas
    It's historically used a lot for optimisation problems in engineering. You can also use it to convert distance functions into surface normal functions.
    1 reply
    Lots of cool things.
    Orestis
    @omhepia:matrix.org
    [m]
    I was wondering can one compute spatial derivatives of a discrete scalar field?
    Snektron
    @snektron:matrix.org
    [m]
    You could calculate normals when ray marching using automatic differentiation
    Troels Henriksen
    @athas
    Yeah, I'll certainly do that, but that's more of a fun toy than something people need, I think.
    Snektron
    @snektron:matrix.org
    [m]
    I'm running into this situation where my program uses 8.4 GB vram using the opencl backend, but only 5 using the cuda backend (running on different machines)
    are they using different kinds of allocators?
    Troels Henriksen
    @athas
    They shouldn't, but the amount of exploited parallelism can vary.
    They do not interrogate the hardware about its needs in the same way.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    I think I have a one use where AD would be useful. I have some interaction models for rigid bodies that are in scalar form (aka a potential energy) but finding the gradient seems really awkward for. What does it work on at this point?
    Troels Henriksen
    @athas
    Scalar funtions with control flow, but no loops.
    Also some sequential use of arrays.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    so no multivariate stuff yet?
    ok
    Troels Henriksen
    @athas
    Depends on your definition. It works fine with records and tuples, and you can have maps on top. But it'll be a week or two before we can handle most parallelism.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    tuples are fine, in my case anyway
    I'll probably try it later. Is everything based on analytical gradients?
    Troels Henriksen
    @athas
    What do you mean?
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    Maybe the word is different in english, but I mean like D(sin x) -> cos x
    not using numerical diffrentiation
    I mean you could use (f(x+h)-f(x) )/h numerically
    My understanding of AD is that it works based known gradients of the 'basic' functions at compile time. And the compiler makes an expression of the gradient of the composed function.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    But I don't know if that's the case for all cases.
    A quick look at the wikipedia page for AD tells me that everything is indeed 'analytical', which is nice.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    It's mostly just fancy use of the chain rule as far as I can tell.
    Orestis
    @omhepia:matrix.org
    [m]
    Well its much more than that. Finite difference are incredibly less accurate and much more prone to numerical error.
    And by numerical I mean the limited accuracy of computing machines as well as discretization errors.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    Mostly at least. I guess there are some edgecases.
    It would have saved me a lot of time if Futhark had this feature a year ago. Really nice to see it coming anyhow.
    Troels Henriksen
    @athas
    AD is not numerical differentiation, but neither is it completely analytical. It is regarded as a mix. Operationally, it's analytical gradients at the primitive, combined with the chain rule.
    It tends to have excellent numerical properties; typically as good as the original computation.
    Snektron
    @snektron:matrix.org
    [m]
    I spent some more time optimizing and improving the parser stuff, on a 2080 TI it now parses and constructs an inverted parse tree in 401us for a 5.1 KB input, 28ms for 18 MB and 143 ms for 92 MB. For reference, the cpp parser which only validates the input requires about 19us, 62ms and 334ms respectively (running on a Ryzen 3700X), so thats pretty promesing :)
    The grammar i tested with is relatively simple, though that shouldn't have a lot of impact
    Troels Henriksen
    @athas
    I still think Futhark is an odd choice for a parser, but I am happy whenever it is faster than C++.
    Snektron
    @snektron:matrix.org
    [m]
    Beats writing cuda/opencl by hand
    Wasnt that the intended purpose?
    Troels Henriksen
    @athas
    Indeed! And soon it will also beat writing gradients by hand.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    Does Futhark have a specified 'endianess'? I came to think of it in the context of image encoding, as done in futhark literate. I wanted to do a similar interpretation of []u32 in Haskell, but the library I used read the pixel values in big-endian order. This was of course easy to fix, but is this behaviour hardware dependent?
    Troels Henriksen
    @athas
    Futhark assumes that the host and device will have the same endianness. The binary data format always uses little endian.
    And I guess futhark literate does the same. I actually didn't give it any thought, and it probably isn't documented.
    Gusten Theodor Isfeldt
    @Gusten_Isfeldt_gitlab
    Ok, I guess it's probably a non-issue in most cases since most modern hardware is either little-endian or bi-endian. I think the Haskell library read it as a byte-array of rgbargba... and since I don't think about endianness that often this gave me some rather confusing results...