Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does F# provide you automatic parallelism?

By this I meant: when you design your app side effects free, etc, will F# code be automatically distributed across all cores?

like image 614
Joan Venge Avatar asked Mar 25 '09 17:03

Joan Venge


People also ask

Does f mean derivative?

We can then define a function that maps every point x to the value of the derivative of f at x. This function is written f′ and is called the derivative function or the derivative of f. Sometimes f has a derivative at most, but not all, points of its domain.

Does f x mean Y?

The “Y” stands for the outcome, the “f” embodies the function used in the calculation, and the “X” represents the input or inputs used for the formula.

What does f mean in math?

more ... A special relationship where each input has a single output. It is often written as "f(x)" where x is the input value.

What does ∘ mean in math?

The ∘ symbol denotes a composite function - it looks similar to the multiplication symbol, ⋅, but does not mean the same thing. (f ∘ g)(x) is the same thing as f(g(x)).


2 Answers

No, I'm afraid not. Given that F# isn't a pure functional language (in the strictest sense), it would be rather difficult to do so I believe. The primary way to make good use of parallelism in F# is to use Async Workflows (mainly via the Async module I believe). The TPL (Task Parallel Library), which is being introduced with .NET 4.0, is going to fulfil a similar role in F# (though notably it can be used in all .NET languages equally well), though I can't say I'm sure exactly how it's going to integrate with the existing async framework. Perhaps Microsoft will simply advise the use of the TPL for everything, or maybe they will leave both as an option and one will eventually become the de facto standard...

Anyway, here are a few articles on asynchronous programming/workflows in F# to get you started.

  • http://blogs.msdn.com/dsyme/archive/2007/10/11/introducing-f-asynchronous-workflows.aspx
  • http://strangelights.com/blog/archive/2007/09/29/1597.aspx
  • http://www.infoq.com/articles/pickering-fsharp-async
like image 137
Noldorin Avatar answered Nov 20 '22 13:11

Noldorin


F# does not make it automatic, it just makes it easy.

Yet another chance to link to Luca's PDC talk. Eight minutes starting at 52:20 are an awesome demo of F# async workflows. It rocks!

like image 27
Brian Avatar answered Nov 20 '22 15:11

Brian