microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

New C++ header for common code used for ks entry points #919

Closed dcrc2 closed 3 years ago

dcrc2 commented 3 years ago

This PR splits up the file knossos-pybind.h, removing some parts that are not specifically related to pybind.

This is preliminary work for GPU support, where separate compilation of a .cpp file and a .cu file is required. This means being a bit more careful about which things are defined in headers (e.g. not including definitions of global variables, which would break ODR). Splitting the header file also avoids needing to include pybind in code that doesn't use it. But at the moment we're still compiling a single .cpp file, so I'm just #include-ing the new .cpp file here.

As drive-by changes, I've introduced a new namespace ks::entry_points to avoid polluting the global one, and moved away from using lambdas for pybind bindings.