Commit 872a69a5 authored by Julien Jerphanion's avatar Julien Jerphanion

Add minimal memos

parent 0da9564c
## Experimentations with Cython+
### Introduction
Cython is being used in a various number of libraries for improving the performance of algorithms.
Cython allow transpiling code from Python to C, to use the CPython C API or directly to use C, bypassing CPython's interpreter Global Interpreter Lock.
Cython+ is a fork of Cython which aims at supporting multicore and thread safe computations.
Cython+ provides a few new features, especially:
- the possibility to compile code to C++ instead of C
- the possibility to hence use the C++ class system via the `cypclass` construction. Hence a way to use OOP without being constrained by the GIL
- a few constructions for asynchronous computations
Whether Cython+ features are relevant for scientific computing is yet to be determined.
### Ressources
Cython+ documentation is relatively light. The main features and elements of documentation are present on [Cython+](https://www.cython.plus) online website. Here are the available resources:
- *To Read* [Automatic multithreaded-safe memory managed classes in Cython](https://www.nexedi.com/blog/NXD-Document.Blog.Cypclass)
- present `cypclass`, i.e. the main construct of Cython+
- two allocation systems exist, using normal calls to constructor or using the `new` operator.
- an alternative design could have been explored for atomic reference counting (`ccdef` class)
- [Basic Syntax](https://www.cython.plus/P-CYP-Documentation.Basic.Syntax)
- [Interacting with Python (by example)](https://www.cython.plus/P-CYP-Documentation.Interacting.With.Python)
- though `cypclass`es are by passing the GIL by default, it is possible to acquire it using a context.
- `cypclass` objects are still be seen as `CPython` objects : one can call python method on them interchangeably
- the overloading of methods (especially constructor) is not yet properly supported: one would need a virtual table to register overloading of methods, which is not yet implemented. There are workaround this currently.
- [HowTo Use Cython+ in Jupyter Notebook](https://www.cython.plus/P-CYP-Howto.Jupyter)
- mention of the ipython magic to be able to use C++ for compilation
- [Concurrency](https://www.cython.plus/P-CYP-Documentation.Concurrency)
- special operator `consume` and three type qualifiers `iso`, `active` and `locked` to manage asynchronous operations
- `activable` method
- [OLD] [Cython nogil extension on multi core introduction](https://www.nexedi.com/blog/NXD-Blog.Cython.Nogil.Extension.Reports)
- preliminary work used by the `cypclass` construct
- use extension types to access C struct, functions and get ride of the specificities of CPython objects (including the `PyObject_HEAD`)
###
\ No newline at end of file
all:
python setup.py build_ext --inplace
mrproper:
rm -f *.cpp
rm -f *.so
rm -Rf build
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment