-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nim and Futhark #11843
Comments
Tagging RFC: "Request for Cooperation" ;). I don't see how a cooperation would work. Unfortunately no one applied for that GSoC proposition in 2014, 2015 or 2016. Can you tell us more how you envision such a cooperation? I think this discussion makes more sense on the forum but if members of the Futhark community wants to speak up, I will leave this thread open for the moment. |
I've never heard of this language before but it sounds interesting. You could probably write a DSL in Nim to emit Futhark code, although given Nim's philosophy and goals in general I think more people are interested in writing systems in Nim that directly compile to OpenCL/CUDA C/GLSL/Vectorized CPU code, etc. |
Well, I have heared about this language before. But I don't don't necessarily like it. The language tries to find it's niche in "compute-intensive parts of an application". But it ignores the most important principle of programming language: While programming languages are desigend for different use cases and different languages are better for different tasks, The programmer who learns a language uses that language for everything, no matter if it is the best fir for the job or not, because that is the only languge he knows, or the language he knows best. And that is why Futhark is doomed to fail in my opinion. You don't change your programming language for one piece of the project, especially not if that requires performance. You want to write the high performance code in the language that you are most familiar with. Even if it means shoehorning.
But that doesn't mean that Futhark does not have nice ideas on how to tackle GPGPU computing. We might indeed learn something from it. But I also thing that the paradigms of Nim and Futhark clash quite a lot, because Nim is not a "purely functional array language".
This is another problem of Futhark. Because here it has to compete with CUDA. NVidia has its own fork of clang that allows to write compute kernels in C++. So people can use C++ for everything, they don't need to switch to another language just for the high performance computing part. |
I know it. Programing paradigms aren't fall with nim but backend principles are similar. Nim also can produce cuda/opencl in procuder way in my opinion but there is no need to struggle with compiling to opencl/cuda. Futhark looks like has a good foresight about parallel executable codes. |
I have an experimental GLSL backend for Nim that is written as a macro library. |
I had a look into Futhark for my in-depth deep learning compiler optimization research and more generally looking through Domain Specific Languages for GPU computing (mratsim/Arraymancer#347 (comment)) As shown in the issue I raised for Futhark benchmarks (diku-dk/futhark-benchmarks#9 ) 2 weeks ago, there are no benchmarks against expert-tuned kernels like other DSL with GPU backends, but the main author expects Futhark to be much slower. Furthermore Futhark lacks a multidimensional representation of buffers/algorithms which is key for scientific computing and image processing. This makes it very verbose see some example neural network layers, compared to a DSL based on Einstein Summation like I'm planning in Laser. Besides, it doesn't meet @krux02 needs for GPU computing: shaders, textures, rendering and game-related processing. What it is strong at is offloading arrays computations on GPU including map/reduce/scan/filter. I.e. it's the GPU equivalent of zero-functional. In short of the 3 areas of GPU computing I identified, Futhark is weak at two and strong at one:
Strong at
Anyway, I don't see concrete path forward for collaboration in the main Nim compiler repo besides a library similar to nimpy so I'm closing the thread. That doesn't prevent the discussion for continuing though. |
Oh actually this is an error from the generated wrapper:
converting this wild struct with padding:
Seems a trivial fix is just to redefine it to:
I'm using Alpine (musl libc) btw so possibly why it's a weird define. Anyway with that fixed, the wrapper works a treat!
|
Summary
There is a language like nim. It is futhark. Futhark language also generate optimized c/c++/Python/C#/cuda/opencl parallel executable code. but futhark aims to damin specific language. Futhark generates parallel executable code.
Description
These languages can cooparate with each others in my opinion.
Alternatives
Additional Information
The text was updated successfully, but these errors were encountered: