Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Trevor L. McDonell
    @tmcdonell
    hey @fabricatedmath, long time no see, how have you been? yes, lots of changes, I’ll try and whip up an equivalent example for you with the new api shortly
    Charles Durham
    @fabricatedmath

    @tmcdonell Good! Keeping busy. Chasing a toddler around also now. How have you been?

    After I posted my question I did see a lot of the modules are still importable (I thought they were hidden from import because they were hidden from haddock). Is accelerate-fft the gold standard now for an cuda ffi?

    Trevor L. McDonell
    @tmcdonell
    @fabricatedmath whoa, congratulations! I bet a toddler will indeed keep you busy (: I’m okay, was mostly just busy with teaching before the summer break, taking a bit of time to recover
    yep accelerate-fft is a good one to look at, and also accelerate-blas, which has a few more examples
    Charles Durham
    @fabricatedmath

    @tmcdonell Hey, thanks! I seem to have gotten it all working based on those two templates, thanks for the help.

    I'm also trying to add a native implementation using MWC randoms and wrapping the call to randomArray into a "Par Native (Future (Vector Float))" but the Array types aren't working together. How do I move the Array from Data.Array.Accelerate into the one from Data.Array.Accelerate.Representation.Array?

    Trevor L. McDonell
    @tmcdonell
    oh I forgot to mention, I have this random number generator which might work for you? https://github.com/tmcdonell/sfc-random-accelerate
    the interface is pretty minimal at the moment…
    can you share the (non-working) code? might be easier for me to see
    Charles Durham
    @fabricatedmath

    I'll take a look, thanks.

    Hey, yeah, here's a gist https://gist.github.com/fabricatedmath/90e64295975288161c0bdbf8f5662692.

    The ptx part compiles and runs just fine, the native is giving the error in the gist

    Charles Durham
    @fabricatedmath
    sorry, forgot to @tmcdonell , but please don't mistake this for urgency, really appreciate the help
    Ignat Insarov
    @kindaro

    Hi~

    I want to wield Accelerate, but I am compiling my project with GHC 9.2.2 and I find that the latest version on Hackage is not up to date but the source repository it. (I infer that from looking at the bounds on base in the Cabal manifest.) What is the appropriate way for me to get a stable version? Should I clone the master branch?

    Is this chat alive?
    Last message was half a year ago…
    Trevor L. McDonell
    @tmcdonell
    Hi @kindaro, yes I hang around here a bit (:
    the master version should be stable and should work with 9.2 (I’m currently doing so)
    1 reply
    Ignat Insarov
    @kindaro
    Thanks Trevor!
    Ignat Insarov
    @kindaro
    Is CUDA the only GPU back end currently supported? Is there anything going on about supporting OpenCL and Vulkan?
    Trevor L. McDonell
    @tmcdonell
    CUDA is the only GPU backend right now. we have some plans to support other targets but it’s tough to find the time/person to do it
    Ignat Insarov
    @kindaro
    How much work would it be to add the support of Vulkan?
    Trevor L. McDonell
    @tmcdonell
    A few months work? the tricky part is also having enough experience with vulkaan to write efficient kernels. We are working on a new compiler pipeline that would reduce the cost of adding new backends though.
    Trevor L. McDonell
    @tmcdonell
    yes there is but not sure when I’ll get time to cut an actual release. my work-in-progress branch of accelerate is building with 9.2, but I haven’t updated any of the other packages yet
    Jacob Lagares Pozo
    @jlagarespo
    Hi there! Is there a way to do a data-parallel iterate in accelerate? I've tried to use awhile, but I'm not sure how should I implemented the counter. I've looked at the implementation of the iterate for Exps, but I am somewhat stuck because the awhile condition wants a Scalar Bool, and I'm not sure how to create that from the counter (which is packed in a tuple together with the actual array, just like in the iterate implementation.)
    2 replies
    Jacob Lagares Pozo
    @jlagarespo
    I tried doing plain recursion, but I run out of device memory very quickly.
    (In GHCI that is, not sure how well supported accelerate is in GHCI)
    I noticed that every time I run my function more GPU memory shows up as allocated in nvidia-smi, and doesn't seem to get cleaned up.
    Eventually I get an error like the following:
    *** Exception: 
    *** Internal error in package accelerate ***
    *** Please submit a bug report at https://github.com/AccelerateHS/accelerate/issues
    
    CUDA Exception: an illegal memory access was encountered
    
    CallStack (from HasCallStack):
      internalError: Data.Array.Accelerate.LLVM.PTX.State:53:9

    And besides, the docs recommend

    It is usually best to keep all intermediate computations in Acc, and only run the computation at the very end to produce the final result. This enables optimisations between intermediate results (e.g. array fusion) and, if the target architecture has a separate memory space, as is the case of GPUs, to prevent excessive data transfers.

    James Faure
    @jfaure
    Is it possible to return intermediate results and generally interact with computations running on GPU without having to copy all memory? I'm thinking if I return (pause) from 'run' then it's impossible to find gpu resident arrays again..(?)
    Trevor L. McDonell
    @tmcdonell
    It will only copy results back from “run” as needed
    and if you use that as input in a later run then the data doesn’t need to be copied back (it will be kept alive on the GPU, if there is space available)
    so yeah you can return intermediate results from a “run” and still use them (on the GPU) after.
    James Faure
    @jfaure
    :ok_hand: Also how viable is it to operate on a tree of arrays on GPU? Presumably I'll have to flatten the tree beforehand then run indexing computations that then fork from GPU code
    Trevor L. McDonell
    @tmcdonell
    yes that sounds along the right lines, unless the tree-traversal part is static and can be done as part of the haskell metaprogram
    Trevor L. McDonell
    @tmcdonell
    the quicksort program in containers-accelerate might provide some inspiration, it uses segmented arrays to do that sort of flattening
    James Faure
    @jfaure
    The tree is static but irregular, and I want to, in a loop, traverse it fully from root to leaves then back to root; So from a given node, I need access to both its parent and children
    Trevor L. McDonell
    @tmcdonell
    in that case you might be able to have the tree as a Haskell data type storing Acc arrays, rather than trying to flatten it to have an Acc tree. the Haskell program loops over the tree, building up an Acc expression that is then run afterwards. hopefully that makes sense...?
    CommodoreIsTaken
    @CommodoreIsTaken
    Hey, I'm relatively new to Haskell and I can't install the accelerate package for some reason
    it gives a build error when i try
    Kevin C
    @dataopt
    Are you using cabal or stack?
    CommodoreIsTaken
    @CommodoreIsTaken
    cabal
    let me copy the error, hold on
    Kevin C
    @dataopt
    Is it reporting conflicts?
    CommodoreIsTaken
    @CommodoreIsTaken
    can you put images in this? i've never used gitter before

    src\Data\Array\Accelerate\AST\Idx.hs:42:24: error:

    * Couldn't match type: Code m0 (Idx (env0, t0) t0)
                     with: Q (TExp (Idx (env2, t) t))
      Expected: Q (TExp (Idx env t))
        Actual: Code m0 (Idx (env0, t0) t0)
    * In the Template Haskell quotation [|| ZeroIdx ||]
      In the expression: [|| ZeroIdx ||]
      In an equation for `liftIdx': liftIdx ZeroIdx = [|| ZeroIdx ||]
    * Relevant bindings include
        liftIdx :: Idx env t -> Q (TExp (Idx env t))
          (bound at src\Data\Array\Accelerate\AST\Idx.hs:42:1)

    |
    42 | liftIdx ZeroIdx = [|| ZeroIdx ||]
    | ^^^^^^^^^^^^^^^

    src\Data\Array\Accelerate\AST\Idx.hs:43:24: error:

    * Couldn't match type: Code m1 (Idx (env1, s0) t1)
                     with: Q (TExp (Idx (env2, s) t))
      Expected: Q (TExp (Idx env t))
        Actual: Code m1 (Idx (env1, s0) t1)
    * In the Template Haskell quotation [|| SuccIdx $$(liftIdx ix) ||]
      In the expression: [|| SuccIdx $$(liftIdx ix) ||]
      In an equation for `liftIdx':
          liftIdx (SuccIdx ix) = [|| SuccIdx $$(liftIdx ix) ||]
    * Relevant bindings include
        ix :: Idx env2 t
          (bound at src\Data\Array\Accelerate\AST\Idx.hs:43:18)
        liftIdx :: Idx env t -> Q (TExp (Idx env t))
          (bound at src\Data\Array\Accelerate\AST\Idx.hs:42:1)

    |
    43 | liftIdx (SuccIdx ix) = [|| SuccIdx $$(liftIdx ix) ||]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    src\Data\Array\Accelerate\AST\Idx.hs:43:39: error:

    * Couldn't match expected type: Code m1 (Idx env1 t1)
                  with actual type: Q (TExp (Idx env2 t))
    * In the expression: liftIdx ix
      In the Template Haskell splice $$(liftIdx ix)
      In the first argument of `SuccIdx', namely `$$(liftIdx ix)'
    * Relevant bindings include
        ix :: Idx env2 t
          (bound at src\Data\Array\Accelerate\AST\Idx.hs:43:18)
        liftIdx :: Idx env t -> Q (TExp (Idx env t))
          (bound at src\Data\Array\Accelerate\AST\Idx.hs:42:1)

    |
    43 | liftIdx (SuccIdx ix) = [|| SuccIdx $$(liftIdx ix) ||]
    | ^^^^^^^^^^

    cabal.exe: Failed to build accelerate-1.3.0.0. See the build log above for
    details.
    Kevin C
    @dataopt
    I have never seen that before. I hope someone else could help.
    CommodoreIsTaken
    @CommodoreIsTaken
    how do you install it with stack?
    maybe it'll work if i do it through stack
    Tom Smeding
    @tomsmeding
    @CommodoreIsTaken sorry for the late response, but I bet you're building with GHC >=9.0. The released accelerate works only with <=8.10.7 if I'm not mistaken
    As Trevor said, there is a version working with GHC 9.2 on a branch in the source repository, but it's not released yet and won't work with the small family of other accelerate-related packages on hackage (accelerate-linear etc.)