F#性能的科学计算 [英] F# performance in scientific computing

查看:601
本文介绍了F#性能的科学计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇F#性能如何与C ++性能相比?我问了一个关于Java的类似问题,我得到的印象是Java不适合大量的数字崩溃。

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 for heavy numbercrunching.

我读过F#应该更多可扩展和更高性能,但是与C ++相比,这种现实世界的性能如何?关于当前实现的具体问题是:

I have read that F# is supposed to be more scalable and more performant, but how is this real-world performance compares to C++? specific questions about current implementation are:


  • 它是如何做浮点的?

  • 是否允许向量指令

  • 如何优化
    编译器?

  • 它有多大的内存脚印?它是否允许对内存区域的细粒度控制?

  • 它是否具有分布式
    内存处理器的容量,例如Cray?


  • 是否有实际的科学计算
    实现使用它?

  • How well does it do floating-point?
  • Does it allow vector instructions
  • how friendly is it towards optimizing compilers?
  • How big a memory foot print does it have? Does it allow fine-grained control over memory locality?
  • does it have capacity for distributed memory processors, for example Cray?
  • what features does it have that may be of interest to computational science where heavy number processing is involved?
  • Are there actual scientific computing implementations that use it?

感谢

推荐答案


  • 点计算与.NET CLR将允许的速度一样快。

  • F#不允许向量指令本身,但如果你的CLR有一个API为这些,F#不应该有使用它的问题。例如,请参阅单一

  • 至于我知道,目前只有一个F#编译器,所以也许问题应该是F#编译器在优化时有多好?。答案是在任何情况下潜在地与C#编译器一样好,可能在这一刻有点更糟糕。注意,F# C#支持在编译时内联,这可能允许依赖于泛型的更高效的代码。

  • F#程序的内存占用与其他.NET语言相似。

  • 我不知道对分布式内存的支持。

  • F#有非常好的原语来处理平面数据结构,例如数组和列表。查找实例在Array模块的内容:map,map2,mapi,iter,fold,zip ...数组在科学计算中很受欢迎,我猜是因为它们固有的良好的内存区域属性。

  • 对于使用F#的科学计算包,您可能想要查看Jon Harrop正在做什么。

    • F# does floating point computation as fast as the .NET CLR will allow it. Not much difference from C# or other .NET languages.
    • F# does not allow vector instructions by itself, but if your CLR has an API for these, F# should not have problems using it. See for instance Mono.
    • As far as I know, there is only one F# compiler for the moment, so maybe the question should be "how good is the F# compiler when it comes to optimisation?". The answer is in any case "potentially as good as the C# compiler, probably a little bit worse at the moment". Note that F# differs from e.g. C# in its support for inlining at compile time, which potentially allows for more efficient code which rely on generics.
    • Memory foot prints of F# programs are similar to that of other .NET languages. The amount of control you have over allocation and garbage collection is the same as in other .NET languages.
    • I don't know about the support for distributed memory.
    • F# has very nice primitives for dealing with flat data structures, e.g. arrays and lists. Look for instance at the content of the Array module: map, map2, mapi, iter, fold, zip... Arrays are popular in scientific computing, I guess due to their inherently good memory locality properties.
    • For scientific computation packages using F#, you may want to look at what Jon Harrop is doing.
    • 这篇关于F#性能的科学计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆