Wrapping and Linking

Note that codepy accesses a file called .aksetup-defaults.py in your home directory (mind the dot!) and /etc/aksetup-defaults.py to determine a few configuration values, notably:

  • BOOST_INC_DIR
  • BOOST_LIB_DIR
  • BOOST_PYTHON_LIBNAME
  • BOOST_COMPILER (used in the default libnames)
  • CUDA_ROOT

For lack of better installation documentation at this moment, please see this wiki page.

codepy.jit – Compilation and Linking of C Source Code

Errors

codepy.toolchain – Tool support code

codepy.bpl – Support for Boost.Python

Convenience interface for using CodePy with Boost.Python.

class codepy.bpl.BoostPythonModule(name='module', max_arity=None, use_private_namespace=True)
add_codepy_include()
add_function(func)

Add a function to be exposed. func is expected to be a cgen.FunctionBody.

add_raw_function(func)

Add a function to be exposed using boost::python::raw_function. func is expected to be a cgen.FunctionBody.

add_raw_function_include()
add_struct(struct, py_name=None, py_member_name_transform=<function BoostPythonModule.<lambda>>, by_value_members=set())
add_to_init(body)

Add the blocks or statements contained in the iterable body to the module initialization function.

add_to_module(body)

Add the cgen.Generable instances in the iterable body to the body of the module self.

add_to_preamble(pa)
compile(toolchain, **kwargs)

Return the extension module generated from the code described by self. If necessary, build the code using toolchain with codepy.jit.extension_from_string(). Any keyword arguments accept by that latter function may be passed in kwargs.

expose_vector_type(name, py_name=None)
generate()

Generate (i.e. yield) the source code of the module line-by-line.