UETLI: Unified Expression Template Library Interface
UETLI - the Unified Expression Template Library Interface - is the swiss army knife for working with expression template linear algebra libraries like Armadillo, ArrayFire, Blaze, Eigen, VexCL, and ViennaCL without the pain to rewrite your code for each backend individually. It is designed as a header-only, lightweight C++11 wrapper library that can be easily integrated into existing codes and provides a unified interface to a common subset of operations provided by all of the above libraries. The following code snippet illustrates the use of UETLI for the VexCL backend:
To change from the VexCL backend to another one, e.g., Eigen it suffices to replace the first few lines by:
#include <uetli.h> #include <vexcl/vexcl.hpp> // Create VexCL context (double-precision support on GPU) vex::Context ctx( vex::Filter::GPU && vex::Filter::DoublePrecision ); // Create two VexCL vectors of length 1000000 vex::vector
x( ctx, 1000000 ); vex::vector y( ctx, 1000000 ); // YOUR CODE: Compute element-wise expression y = y + sin(x) y += fdbb::elem_sin(x);
#include <uetli.h> #include <Eigen/Dense> // Create two Eigen vectors of length 1000000 Eigen::VectorXd x( 1000000 ); Eigen::VectorXd y( 1000000 ); // YOUR CODE: Compute element-wise expression y = y + sin(x) y += fdbb::elem_sin(x);
UETLI is licensed under the Mozilla Public License Version 2.0.
$ git clone https://gitlab.com/mmoelle1/UETLI.git
- Matthias Möller and Andrzej Jaeschke. FDBB: Fluid dynamics building blocks. In Proceedings of the 6th European Conference on Computational Mechanics (ECCM 6) and the 7th European Conference on Computational Fluid Dynamics (ECFD 7), Glasgow, UK, jun 2018. ECCOMAS. (pdf). [ arXiv | http ]
UETLI is a spin-off of the FDBB project, which has received funding from the European's Horizon 2020 research and innovation programme under grant agreement No 678727, project MOTOR (Multi-ObjecTive design Optimization of fluid eneRgy machines).