arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1804.08935astro-ph.IMastro-ph.EPcs.CEphysics.comp-ph
收藏

粒子模拟器FDPS开发框架的Fortran接口层

Fortran interface layer of the framework for developing particle simulator FDPS

Daisuke Namekata, Masaki Iwasawa, Keigo Nitadori, Ataru Tanikawa, Takayuki Muranushi, Long Wang, Natsuki Hosono, Kentaro Nomura, Junichiro Makino

摘要:

基于粒子方法的数值模拟在包括天体物理在内的各个领域都有着广泛的应用。到目前为止,模拟软件已经由每个领域的研究人员或研究小组开发,花费了大量的时间和精力,尽管所使用的数值算法非常相似。为了改善这种情况,我们开发了一个框架,称为FDPS,它使研究人员能够轻松地开发大规模并行粒子模拟代码的任意粒子方法。在3.0版本之前,FDPS只提供C++编程语言的API。这个限制来自于这样一个事实,即FDPS是使用C++中的模板功能开发的,这对于支持任意数据类型的粒子是必不可少的。然而,有许多研究人员使用Fortran来开发他们的代码。因此,以前的FDPS版本要求这些人投入大量时间来学习C++。这是没有效率的。为了解决这个问题,我们在FDPS中开发了一个新的Fortran接口层,它为Fortran提供了API。为了支持Fortran中任意类型的粒子数据,我们设计了Fortran接口层。基于Fortran中代表粒子的给定派生数据类型,我们提供的Python脚本自动生成一个库,该库操作FDPS的C++核心部分。这个库被看作是一个Fortran模块,从Fortran端提供FDPS的API,并在内部使用C程序来实现Fortran与C++的互操作。通过这种方式,我们克服了在Fortran中模拟“模板”时的几个技术问题。通过使用Fortran接口,用户可以在Fortran中开发其代码的所有部分。我们表明,Fortran接口部分的开销是足够小的,在Fortran中编写的代码表现出几乎相同的性能在C++中编写的。

英文摘要:

Numerical simulations based on particle methods have been widely used in various fields including astrophysics. To date, simulation softwares have been developed by individual researchers or research groups in each field, with a huge amount of time and effort, even though numerical algorithms used are very similar. To improve the situation, we have developed a framework, called FDPS, which enables researchers to easily develop massively parallel particle simulation codes for arbitrary particle methods. Until version 3.0, FDPS have provided API only for C++ programing language. This limitation comes from the fact that FDPS is developed using the template feature in C++, which is essential to support arbitrary data types of particle. However, there are many researchers who use Fortran to develop their codes. Thus, the previous versions of FDPS require such people to invest much time to learn C++. This is inefficient. To cope with this problem, we newly developed a Fortran interface layer in FDPS, which provides API for Fortran. In order to support arbitrary data types of particle in Fortran, we design the Fortran interface layer as follows. Based on a given derived data type in Fortran representing particle, a Python script provided by us automatically generates a library that manipulates the C++ core part of FDPS. This library is seen as a Fortran module providing API of FDPS from the Fortran side and uses C programs internally to interoperate Fortran with C++. In this way, we have overcome several technical issues when emulating `template' in Fortran. By using the Fortran interface, users can develop all parts of their codes in Fortran. We show that the overhead of the Fortran interface part is sufficiently small and a code written in Fortran shows a performance practically identical to the one written in C++.

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

↑