arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1412.6765cs.PFcs.DCcs.PL
收藏

Java与JNI优化实现微内核的性能比较

Performance comparison between Java and JNI for optimal implementation of computational micro-kernels

Nassim A. Halli, Henri-Pierre Charles, Jean-François Mehaut

摘要:

在高性能计算(HPC)中使用的通用CPU支持向量指令集和专用于增加指令级并行的乱序引擎。因此,相关的优化是目前至关重要的,以提高需要数值计算的应用程序的性能。此外,在高性能计算中使用Java运行时环境(如HotSpot Java虚拟机(JVM))是一种有前途的替代方案。它受益于其编程灵活性,生产力和性能是由即时(JIT)编译器确保的。然而,JIT编译器有两个主要缺点。首先,JIT对于开发人员来说是一个黑盒子。我们无法控制生成的代码,也无法从其优化阶段(如向量化)获得任何反馈。其次,与GCC或LLVM等静态编译器相比,时间约束缩小了优化程度。因此,使用静态编译的代码是很有吸引力的,因为它可以从减少性能瓶颈的额外优化中受益。Java允许通过Java本机接口(JNI)从动态库调用本机代码。然而,JNI方法不是内联的,与Java方法相比,调用JNI方法需要额外的成本。因此,为了从更好的静态优化中获益,必须通过在每次JNI调用时执行的计算量来平衡这种调用开销。在本文中,我们解决这个问题,我们建议这样做的一组微内核的分析。我们的目标是根据调用上下文定义的计算量来选择最有效的实现。我们还研究了几种不同的优化方案,这是向量化,无序优化,数据对齐,方法内联和使用本机内存JNI方法的性能的影响。

英文摘要:

General purpose CPUs used in high performance computing (HPC) support a vector instruction set and an out-of-order engine dedicated to increase the instruction level parallelism. Hence, related optimizations are currently critical to improve the performance of applications requiring numerical computation. Moreover, the use of a Java run-time environment such as the HotSpot Java Virtual Machine (JVM) in high performance computing is a promising alternative. It benefits from its programming flexibility, productivity and the performance is ensured by the Just-In-Time (JIT) compiler. Though, the JIT compiler suffers from two main drawbacks. First, the JIT is a black box for developers. We have no control over the generated code nor any feedback from its optimization phases like vectorization. Secondly, the time constraint narrows down the degree of optimization compared to static compilers like GCC or LLVM. So, it is compelling to use statically compiled code since it benefits from additional optimization reducing performance bottlenecks. Java enables to call native code from dynamic libraries through the Java Native Interface (JNI). Nevertheless, JNI methods are not inlined and require an additional cost to be invoked compared to Java ones. Therefore, to benefit from better static optimization, this call overhead must be leveraged by the amount of computation performed at each JNI invocation. In this paper we tackle this problem and we propose to do this analysis for a set of micro-kernels. Our goal is to select the most efficient implementation considering the amount of computation defined by the calling context. We also investigate the impact on performance of several different optimization schemes which are vectorization, out-of-order optimization, data alignment, method inlining and the use of native memory for JNI methods.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑