F# performance in scientific computing

前端 未结 10 1187
闹比i
闹比i 2020-12-22 17:12

I am curious as to how F# performance compares to C++ performance? I asked a similar question with regards to Java, and the impression I got was that Java is not suitable f

10条回答
  •  伪装坚强ぢ
    2020-12-22 17:53

    In addition to what others said, there is one important point about F# and that's parallelism. The performance of ordinary F# code is determined by CLR, although you may be able to use LAPACK from F# or you may be able to make native calls using C++/CLI as part of your project.

    However, well-designed functional programs tend to be much easier to parallelize, which means that you can easily gain performance by using multi-core CPUs, which are definitely available to you if you're doing some scientific computing. Here are a couple of relevant links:

    • F# and Task-Parallel library (blog by Jurgen van Gael, who is doing machine-learning stuff)
    • Another interesting answer at SO regarding parllelism
    • An example of using Parallel LINQ from F#
    • Chapter 14 of my book discusses parallelism (source code is available)

    Regarding distributed computing, you can use any distributed computing framework that's available for the .NET platform. There is a MPI.NET project, which works well with F#, but you may be also able to use DryadLINQ, which is a MSR project.

    • Some articles: F# MPI tools for .NET, Concurrency with MPI.NET
    • DryadLINQ project hompepage

提交回复
热议问题