News for hackers. Stuff that matters.
Re:Triangle frenzy by torrance on Saturday May 07, 2022 @08:38PM (#31300136)
I’ve used CUDA and Julia extensively in my work for radio astronomy imaging applications.

I can say it is a delight to work with. All the usual GPU tips and tricks still apply, of course, and you need to pay careful attention to sequential memory accesses and so on (as with all GPU programming). But staying in the one, high level language is a real boon, and having access to native types and methods directly in my kernels is fantastic. I can’t speak highly enough of it.

And for performance comparison, I see between 3-4 orders of magnitude improvement in speed, about as fast as native CUDA.

Re:Triangle frenzy by krasin on Saturday May 07, 2022 @11:50PM (#31301113)
Can you please recommend an open source codebase that uses Julia + CUDA and that can be used to learn that combination? I am considering starting a CUDA-related project and Julia is a serious contender, but I am scared to hit too many rough edges.
Re:Triangle frenzy by chrsig on Sunday May 08, 2022 @10:58AM (#31304666)
I can't recommend any particular project that implements something in cuda, but I'd check out the StructArrays.jl[0] project.

One of julia's strengths is it's macro and type system. StructArrays.jl uses them to create a SoA struct out of a AoS. This is a killer feature that generally requires some form of code generation in C/C++.

Even if you're just doing something on the cpu, it should set you up to be both simd & gpu friendly. They have a guide on how to swap out the underlying array storage from cpu to gpu memory

fwiw, cuda is a "Tier 1" supported architecture[1], where "Tier 1" is defined as

> Tier 1: Julia is guaranteed to build from source and pass all tests on these platforms when built with the default options. Official binaries are always available and CI is run on every commit to ensure support is actively maintained.

[0] https://github.com/JuliaArrays/StructArrays.jl

[1] https://julialang.org/downloads/#supported_platforms

Re:Triangle frenzy by ackbar03 on Sunday May 08, 2022 @12:09AM (#31301207)
>I’ve used CUDA and Julia extensively in my work for radio astronomy imaging applications.

Do you happen to have some examples of these you could share? Sounds interesting. Why is gpu needed for radio imaging?

Re:Triangle frenzy by adgjlsfhk1 on Sunday May 08, 2022 @02:00AM (#31301716)
it's not needed, but image processing algorithms are pretty much what GPUs are designed for. You have a lot of data to process, and doing it quickly is always nice.
Re:Triangle frenzy by chrsig on Saturday May 07, 2022 @06:00PM (#31298998)
I'd be interested to see what each looks like if the allocations were done external to the benchmark. For that matter, it'd be interesting to see if after the allocations are factored out, if the same function could be used for cuda & cpu. From there, I'd be curious if the compiler is able to vectorize it automatically, or if it'd benefit from a @simd

It's also great to see how well cuda is supported in julia. I've started to pick up julia lately, and find it incredibly pleasant to work with. It feels like a lovely mix of haskell, lisp, and python, with a really nice repl.

Re:Triangle frenzy by monkeybutton on Saturday May 07, 2022 @09:51PM (#31300489)
Crazy to see such a similar idea kicking around 14 year later:

https://rogerjohansson.blog/2008/12/07/genetic-programming-e...

Re:Triangle frenzy by Athas on Sunday May 08, 2022 @03:23AM (#31301997)
> Note that I benchmarked with --check-bounds=no, which is a startup option that you pass to Julia, when launching, that disables the performance killer “bounds checking”.

Why is bounds checking a performance killer?

Re:Triangle frenzy by physicsguy on Sunday May 08, 2022 @04:45AM (#31302325)
If you add bounds checking, then what happens is that on every index into the array, a line of code gets called that says "is the index the user specified less than the length of the array". On it's own, that's not a problem, but when you're doing this repeatedly millions of times, it's a performance killer.
Re:Triangle frenzy by Athas on Sunday May 08, 2022 @08:32AM (#31303453)
Still, I would expect the overhead to be moderate, not a killer.
Re:Triangle frenzy by ChrisRackauckas on Sunday May 08, 2022 @09:48AM (#31303931)
Bounds checking can block the ability to auto-generate SIMD, which then has a larger effect than the operations of the bounds checking itself.
Re:Triangle frenzy by cancandan on Sunday May 08, 2022 @04:33AM (#31302285)
Re:Triangle frenzy by hereforonep on Sunday May 08, 2022 @05:57AM (#31302625)
People should really just use a language like FUTHARK For GPU programming
Re:Triangle frenzy by dunefox on Sunday May 08, 2022 @06:59AM (#31302974)
Or, you know, Julia.