How do I program I F# that utilize multi cores CPU? Say instead of multithread or async? In python language, they have multiprocessing module but what is the equivalent for F#?
How to do multi core programming in F#
1.7k views Asked by himekami At
3
There are 3 answers
0
On
There are several approaches for parallelization in F#
F#
usesCLR
andCTS
so it is possible to use usual .NET constructions like you do it inC#
. For example:Thread
,BackgroundWorker
,AutoResetEvent
etc. DetailsF#
has a built-in construct called "asynchronous workflows" Details- There are some frameworks which allow you to choose appropriate parallelisation model. For example Hopac
0
On
If You're intereseted in GPU programming (which is strongly related to multicore, or even manycore) in F#, take a look into Alea GPU which allows You to easily use F# for technologies like CUDA.
For list other GPU programming options in F#, look here.
You can also try to employ the actor model. Akka.NET has some nice F# API.
There's also an incoming book that as a whole can be considered an answer to the question (didn't read it yet).
Adding a couple of pointers to what has already been mentioned in the comments:
for
loops.