Home | Download/Install | Documentation | Packages | Screenshots | News | Forum/Mailing-lists | Contact | GForge

Compile nodes once, run everywhere

  • Author : Daniel BARBEAU
  • Date : 10/10/2011

Overview

The goal of this proposal is to solve the client-side deployment of binary code. The problem is that we do not have enough man power to compile for every type of system out there. The idea is to build a small, steady runtime environment per platform and to transfer intermediate representations of code that this runtime environment would compile on the fly if needed.

In Openalea we have Python nodes or binary nodes (C/C++/Fortran). The problem considered here is the compilation of code for every existing platform. One solution would be to compile for a runtime (like Java bytecode). We consider that our runtime is LLVM, so we compile to LLVM_IR.

Implementation Proposal

This is an early description of the process

A Node can be queried for its code. This code is split into python code or binary code.

class Node(...) :
    def get_code(self):
    """ Returns all the necessary code - python bytecode and LLVM-IR to run the node with the Openalea Runtime """
        return self.get_py_func_bytecode(), self.get_python_bytecode(), self.get_llvm_ir()
 
    def get_py_func_bytecode(self):
    """ Return this node's python function bytecode """   
        # do something
        return something
 
    def get_python_bytecode(self):
    """ Sophisticated introspection to build a structure containing the bytecode to satisfy the requirements of this node's function. """
        # do something
        return something
 
    def get_llvm_ir(self):
    """ Returns a string containing the LLVM Intermediate representation of binary requirements needed by this node's function. """
        # do something
        return something

When the full code is received, the LLVM_IR code is compiled to the runtime environment and executed. It is executed in a sandbox. See Native Client (x86) and Portable Native Client (other).

 
documentation/core/propositions/215_nodes_compile_once_run_everywhere.txt · Last modified: 2011/10/10 18:42 by admin   Back to top
INRIA   INRA     CIRAD     AGROPOLIS IBC
INRIA GForge RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki