Towards a Boost Free PyTango

Slides:



Advertisements
Similar presentations
Boost Writing better code faster with Boost. Boost Introduction Collection of C++ libraries Boost includes 52 libraries, 1.31 will have at least.
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
BY: ALBERTO CABEZAS 4/19/2010. INTRODUCTION: PHP is considered today as one of the most famous scripting languages. PHP is widely used as a general purpose.
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
Chapter 3.2 C++, Java, and Scripting Languages “The major programming languages used in game development.”
Chapter 3.2 C++, Java, and Scripting Languages hacked by jeffery.
Tango Collaboration Meeting1 Tango C++ Kernel Development J. Meyer European Synchrotron Radiation Facility (ESRF)
By Logan Phipps Hal student.  This power point explains some common programming languages enjoy  When done click on the home button to return to home.
Language Issues Misunderstimated? Sublimable? Hopefuller? "I know how hard it is for you to put food on your family.” "I know the human being and fish.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Dessy, 17 september 2007 Tango Meeting Development of Tango Client Applications in Python Tiago Coutinho and Josep Ribas.
K. Harrison CERN, 20th April 2004 AJDL interface and LCG submission - Overview of AJDL - Using AJDL from Python - LCG submission.
Integrating Open Source Statistical Packages with ArcGIS Mark V. Janikas Liang-Huan (Leo) Chin.
PyCoral, Python interface to CORAL By S.S.Tomar RRCAT, Indore, India.
Andrea Valassi & Alejandro Álvarez IT-SDC White Area lecture 16 th April 2014 C++11 in practice Implications around Boost, ROOT, CORAL, COOL…
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Eagle: Maturation and Evolution 17th Annual Tcl Conference Joe Mistachkin.
Python/Tango Client Binding Swig ( Vs Boost (
Python template engines and implementation in Indico Marius Damarackas (Vilnius University)
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
Siena Computational Crystallography School 2005
GDB Meeting - 10 June 2003 ATLAS Offline Software David R. Quarrie Lawrence Berkeley National Laboratory
Internship EDGE Presentation Company: Tofani Co Position: Junior Intern: Front End Web Developer Faye Omar.
Java Example Presentation of a Language. Background Conception: Java began as a language for embedded processors in consumer electronics, such as VCR,
March 19th 2007 TANGO collaboration 1 POGO-7 Pascal Verdier ESRF- Hamburg - 25 th of October 2010 A Short History of Pogo A Short History of Pogo New Technology.
PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are.
Modern C++ in practice.
S3D Software Object Oriented Refactoring IMPA – Sistemas Gráficos 3D (2007) Mário de Sá Vera
PYTHON FOR HIGH PERFORMANCE COMPUTING. OUTLINE  Compiling for performance  Native ways for performance  Generator  Examples.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
Python – It's great By J J M Kilner. Introduction to Python.
AdaControl A free ASIS based tool J-P. Rosen Adalog.
Re Write POGO using openArchitectureWare Technology ● Pogo History ● OpenArchitectureWare technology ● Generated code ● Project status.
Slice & dice the Web with XmlPL, The XML Processing Language A presentation for Boise Code Camp 2007 Joseph Coffland Cauldron Development LLC.
September 24th 2006, aKademy The Design and Implementation of KJSEmbed Richard Moore,
Introduction to.
Matlab.
CSC391/691 Intro to OpenCV Dr. Rongzhong Li Fall 2016
Content from Python Docs.
How to Integrate LabVIEW Applications into a Tango Control System
C++ Tango REST API implementation
PYTHON: AN INTRODUCTION
Python in astronomy + Monte-Carlo techniques
Python Training in Chennai
Introduction Enosis Learning.
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
CMPE419 Mobile Application Development
MVC in ASP.NET Core: The new kid on the block
Ucsmsdk v UCS Python SDK.
Introduction Enosis Learning.
INFS 6225 – Object-Oriented Systems Analysis & Design
Introduction to Python programming
A brief look at some of the new features introduced to the language
Brief Intro to Python for Statistics
Sébastien Gara, Tango meeting 2016
Tango in a Nutshell 31/12/2018.
autodiscoverable microservices with vertx3
CISC/CMPE320 - Prof. McLeod
CORBA usage within the TANGO control system
Intro to PHP.
CSE 303 Concepts and Tools for Software Development
Elecbits Electronic shade.
Eagle: Maturation and Evolution
CSCE 221 Professor Lupoli TAMU CSCE 221 Intro.
Tutorial 10: Programming with javascript
CMPE419 Mobile Application Development
The Lua Chunk Vault, an enhancement to epics base
C++ Object Oriented 1.
Chengyu Sun California State University, Los Angeles
Talking Between Services with gRPC
Presentation transcript:

Towards a Boost Free PyTango Daresbury Laboratory Towards a Boost Free PyTango   G.R. Mant (STFC, Daresbury, Warrington, Cheshire, United Kingdom) T.M. Coutinho, A. Götz, V. Michel (ESRF, Grenoble, France)

C++/Python bindings What are the choices SWIG - old style Daresbury Laboratory C++/Python bindings What are the choices SWIG - old style Boost.Python - as we already know Cython - very neat syntax close to Python SIP - used in the LIMA project pybind11 - Syntax similar to Boost.Python, compact implementation thanks to C++11. Why did we choose pybind11 to replace Boost?

Daresbury Laboratory Boost: Why change Boost is an enormously large and complex suite of utility libraries that works with almost every C++ compiler in existence. It uses arcane template tricks and workarounds. Now that C++11-compatible compilers are widely available it’s not necessary. < 200 commits in the last 5 years

Daresbury Laboratory The future is pybind11 pybind11’s syntax and initial API design was heavily influenced by Boost.Python pybind11 is a lightweight header-only with no dependencies and doesn’t require specific build tools Heavily optimized for binary size; fast compile time Support for C++11, C++14 and C++17 language features Support for NumPy without having to include NumPy headers Support for embedding Python interpreter

More on pybind11 Useful features for PyTango that come as standard: Daresbury Laboratory More on pybind11 Useful features for PyTango that come as standard: STL data types, overloaded functions, enumerations, callbacks, multiple inheritance, smart pointers, capturing lambdas. Still actively developed at: http://github.com/pybind/pybind11 http://pybind11.readthedocs.io/en/stable/index.html

Daresbury Laboratory PyTango with pybind11 In a conda environment with g++ version 4.8.5 and python 2.7.14 PyTango codebase compiles in 8min. _tango.so size with boost: 106M pybind11: 97M branch: pybind11 at https://github.com/tango-controls/pytango.git

Progress so far Client Server - attributes - scaler, array, images Daresbury Laboratory Progress so far Client - attributes - scaler, array, images - pipes (reading) - commands - sync - async no callback - events Server

We are trying to keep the same API However, should we deprecate? Daresbury Laboratory We are trying to keep the same API However, should we deprecate? ApiUtil methods is_notifd_event_consumer_created & is_zmq_event_consumer_created ExtractAs: does anyone use anything other than numpy Async command with callback

DeviceProxy method overloading Daresbury Laboratory DeviceProxy method overloading .def("_get_property", [](Tango::DeviceProxy& self, string& prop_name) -> Tango::DbData { Tango::DbData dbData; self.get_property(prop_name, dbData); return dbData; }) .def("_get_property", [](Tango::DeviceProxy& self, std::vector<std::string>& prop_names) -> Tango::DbData self.get_property(prop_names, dbData);

DeviceProxy methods implemented, C++11 style, as lambda functions Daresbury Laboratory DeviceProxy methods implemented, C++11 style, as lambda functions .def("_read_attribute", [](Tango::DeviceProxy& self, std::string& attr_name, PyTango::ExtractAs extract_as=PyTango::ExtractAsNumpy) -> py::object { // the method body here }, py::arg("attr_name"), py::arg("extract_as")=PyTango::ExtractAsNumpy) .def("_read_attributes", [](Tango::DeviceProxy& self, std::vector<std::string> &attr_names, PyTango::ExtractAs extract_as=PyTango::ExtractAsNumpy) -> py::list { }, py::arg("attr_names"), py::arg("extract_as")=PyTango::ExtractAsNumpy)

dp = DeviceProxy('sys/tg_test/1') db_datum = DbDatum('test') Daresbury Laboratory dp = DeviceProxy('sys/tg_test/1') db_datum = DbDatum('test') db_datum.value_string = ['3.142'] dp.put_property(db_datum) props = dp.get_property('test') assert props.keys() == ["test"] assert props.values() == [['3.142']] db_datum = DbDatum('timeout') db_datum.value_string = ['0.05'] props = dp.get_property(['test', 'timeout']) assert props.keys() == ['test', 'timeout'] assert props.values() == [['3.142'], ['0.05']]

Reading/Writing attributes Daresbury Laboratory Reading/Writing attributes dp['long_scalar_w','double_spectrum', 'string_scalar', 'long_spectrum'] = 1234, [3.142, 6.284, 9.426], 'ESRF', np.array([1,2,3,4,5]) attr = dp['long_scalar_w','double_spectrum', 'string_scalar', 'long_spectrum'] assert attr[0].value == 1234 spectre = np.array([3.142, 6.284, 9.426]) assert set(attr[1].value) == set(spectre) assert attr[2].value == 'ESRF' spectre = np.array((1,2,3,4,5)) assert set(attr[3].value) == set(spectre)

Vincent Michel for his invaluable support and encouragement Daresbury Laboratory Thanks to: Vincent Michel for his invaluable support and encouragement Andy Gotz for giving me the opportunity to do this work and the Tango Consortium for financial support