
FPGAs for numerical mathematics using CLaSH - Gladdyu
https://github.com/Gladdy/numerical-fpga-thesis
======
mortenlarsen
Presentation slides: [https://raw.githubusercontent.com/Gladdy/numerical-fpga-
thes...](https://raw.githubusercontent.com/Gladdy/numerical-fpga-
thesis/master/talk/talk.pdf)

------
gh02t
So on a tangent, does anybody have a nice article on numerical methods with
Haskell? I've used Haskell for other things, but I've never endeavored to try
doing any sort of heavy number crunching because it seemed a bit weird.

My standard test is implementing GMRES. I gave it some thought once and I
couldn't come up with a non-awkward way to do it in Haskell. Mostly I get
caught up on how to do the Arnoldi process as it requires lots of manipulation
of submatrices. I couldn't ever seem to find a library that was nice for
matrix manipulation. What do people mostly use? Also, what's the idiomatic way
to do nitty-gritty matrix operations? Entrywise manipulation of a matrix
doesn't seem very Haskell-ish to me, but it's not something you can really
avoid in this application.

~~~
carterschonwald
I've been slowly working on a nice library in that space for the past few
years. It's not quite there yet, but I'll be spending a bit of time this
Summer getting it into shape

~~~
gh02t
Cool. I feel like it's an area that's kind of under-served (or that I'm
ignorant of). Haskell has a much more mathy flavor than a lot of the more
traditional scientific languages and it seems to me like it should be really
great for implementing algorithms based on their mathematical description, but
I haven't really figured out the details yet. I've used Haskell in other
projects, but this application eludes me.

------
leni536
Really nice. As a physicist FPGAs looks really tempting to speed up
calculations, it has to compete with GPUs and the toolsets around them though.
CLaSH really looks promising, I don't thing that too many physicist would
touch VHDL or Verilog.

~~~
mafuyu
I don't know how practical that is; FPGAs are very efficient, but they won't
come close to the raw computational power of a GPU. Many moons ago, the dream
was to have a configurable FPGA in every computer, but GPUs ended up winning
out due to games, among other reasons.

Adapteva [0] is a startup doing cool things with multi core parallel
coprocessors. From their interview on The Amp Hour [1], it seems like their
target niche is parallelisable loads that aren't IO constrained, such as
computer vision and video processing. Chunks of a video frame don't need to
talk to each other.

[0]: [http://www.adapteva.com/](http://www.adapteva.com/) [1]:
[http://www.theamphour.com/254-an-interview-with-andreas-
olof...](http://www.theamphour.com/254-an-interview-with-andreas-olofsson-
adatevas-ampliative-abacus/)

~~~
scott_wilson46
I think this is a common misconception in the debate about GPU's vs FPGAs. If
you take a top of the range GPU you get 2.7 Teraflops of performance
(according to the GTP Titan review I just looked at:
[http://www.techspot.com/review/977-nvidia-geforce-gtx-
titan-...](http://www.techspot.com/review/977-nvidia-geforce-gtx-titan-x/)).
Comparing this to a top of the range Stratix 10 FPGA, you get 3.2 Teraflops
([https://www.altera.com/content/dam/altera-
www/global/en_US/p...](https://www.altera.com/content/dam/altera-
www/global/en_US/pdfs/literature/pt/stratix-10-product-table.pdf)) so there is
really not much in it.

~~~
benou
You have to take into account that Titan are super cheap compared to FPGA. Big
FPGA boards for HPC can easily cost between 5k$ to 10k$. If you compare to GPU
in the same price range, you end-up with K40 or K80, who have a peak at
4.3TFLOPS SP and 5.6TFLOPS SP respectively, much higher than Stratix 10.
Moreover, FPGA are not really good at double precision FP, which is important
in many HPC area. At the end of the day, the important metric is FLOPS/$, and
more importantly what you can achieve for your application and tooling and
ecosystem. Many scientists are not computer science experts, and many HPC
codes are legacy simulations which can be hard to port and re-validate. In my
experience, FPGA are still a nich accelerator vs GPU. And I am not even
talking about future Xeon Phi generations. And of course, when talking about
HPC you should not forget the elephant in the room: standard Xeon...

~~~
Gladdyu
My work intends to change the aspect of having to be a computer scientist in
order to leverage the power of an FPGA by using Haskell/CLaSH as a HDL which
is close to mathematics.

Furthermore, the verification of the designs is simplified a lot by checking
directly in Haskell over generating VHDL testbenches and then running an
additional simulator tool.

Lastly, I hope that with the recent acquisition of Altera by Intel, some of
the other issues you mentioned (mainly floating point performance)
additionally with some tooling issues will be addressed as well.

~~~
benou
I understand that, and having a DSL is definitely a good idea, but you need to
create a community, which can be hard (and NVIDIA seems to be good at it). I
didn't want to be deceptive, I just wanted to highlight that it was not just a
matter of peak FLOPS (in fact it never is - as an engineer working on another
niche accelerators I know it too much ;) ).

~~~
rch
Which other niche accelerators?

~~~
benou
[http://www.kalrayinc.com](http://www.kalrayinc.com) You can see it as a
scaled-out DSP.

