Giter Club home page Giter Club logo

libthermo's Introduction

libthermo

A fast C++ thermodynamical gas library.

libthermo targets high-performance computing using really simple/simplistic thermodynamical modelings instead of complex and more accurate approaches (such as https://cantera.org/).

It's well fitted for industrial simulation where the base blocks need to be efficient to not become bottlenecks.

Modelings

Properties

The library provides modelings for the following properties:

Short Long
Cp Specific heat pressure
Gamma Specific heat ratio
r Gas constant
H Enthalpy
Phi Entropy
PR Pressure ratio
EffPoly Polytropic efficiency

Properties

For now, only ideal gas is implemented in IdealGas class.

It has constant specific heat pressure, thus ratio.

Benchmarks

Benchmarks can be ran using:

  • C++: thermo_benchs CMake target
  • Python: ipython python_benchs.ipy

The metrics are computed over 1M elements for operation only (allocation is not timed), and are given in nanoseconds/element:

IdealGas

Case Pure NumPy C++ loop on vector C++ xtensor + xsimd + tbb pythermo*
Cp 0.27 0.12 0.32 0.32 0.31
Gamma 0.30 0.12 0.31 0.31 0.31
r 0.28 0.45
H 0.73 0.45 0.80 0.75 0.26
Phi 4.54 4.99 4.35 2.97 0.30 0.30
PR 11.5 14.41 13.65 8.28 0.55 0.53
EffPoly 17.1 16.18 14.87 9.87 2.59 2.68

*pythermo = Python bindings, incl. xsimd and tbb (vectorization and multithreading)

Conclusions are:

  • Pure NumPy (vectorized), C++ loop over a 1D buffer allocated on the heap (std::vector) and xtensor are directly comparable
    • xtensor shows performance issues on very simples cases (Cp, gamma, H): to be investigated
  • xsimd and tbb, turned on by simply adding 2 CMake flags give a huge benefit
    • up to x1.65 speed-up for xsimd
    • up to x15 speed-up for tbb, on a 12-cores/24-threads AMD Ryzen 3900XT
  • using xtensor-python Python bindings to operate on NumPy buffers gives the same performance as pure C++ code

libthermo's People

Contributors

adriendelsalle avatar

Stargazers

Guy De Spiegeleer avatar Haris Musaefenidc avatar Jules Chéron avatar

Watchers

Haris Musaefenidc avatar  avatar

Forkers

adriendelsalle

libthermo's Issues

Improve Python bindings

Description

For now the Python bindings are not covering all the C++ API, they need to be further improved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.