EuroSciPy logo

EuroScipy

Cambridge, UK - 27-30 August 2014

LMGC90 software and Python: interface, memory, efficiency...

Rémy Mozul

Abstract

The LMGC90 software is dedicated to the simulation of divided media, or so-called multi-contacts problems. The main point of the software is to model and compute large collections of bodies in interactions.

The software is about 15 years old and is written in Fortran. It is designed as a library and the user must provide a script allowing to finely tune the simulation. About 5 years ago a Python interface has been provided using swig and the ISO_C_BINDING standard of Fortran 2003.

This interface broadened the horizon of possibilities of the software and the other interfaces are now scarcely used except for coupling purpose. A Python pre-processor has been written to generate the input files of the software.

The next step in the development of the interface is about its efficiency. Even if referencing the memory allocated within Fortran is possible it is no longer enough. Our will is now to expose our data structure within Python, allowing to merge the database of the software with our pre-processor and allowing efficient (meaning copyless) coupling with well designed software.

Cython is now the main tool allowing C/C++ interface with Python, here are the results of our trials to expose our database within Python memory. This would allow us to implement, as a next step, the concept of Python memory manager introduced to us by the ONERA.

Sponsors