'shell' plugin for Importer More...
#include <shell_compiler.hpp>
Interface to the JIT compiler SHELL
Extra doc: https://github.com/casadi/casadi/wiki/L_22w
Id | Type | Description |
---|---|---|
cleanup | OT_BOOL | Cleanup temporary files when unloading. Default: true |
compiler | OT_STRING | Compiler command |
compiler_flags | OT_STRINGVECTOR | Alias for 'compiler_flags' |
compiler_output_flag | OT_STRING | Compiler flag to denote object output. Default: '-o ' |
compiler_setup | OT_STRING | Compiler setup command. Intended to be fixed. The 'flag' option is the prefered way to set custom flags. |
directory | OT_STRING | Directory to put temporary objects in. Must end with a file separator. |
extra_suffixes | OT_STRINGVECTOR | List of suffixes for extra files that the compiler may generate. Default: None |
flags | OT_STRINGVECTOR | Compile flags for the JIT compiler. Default: None |
linker | OT_STRING | Linker command |
linker_flags | OT_STRINGVECTOR | Linker flags for the JIT compiler. Default: None |
linker_output_flag | OT_STRING | Linker flag to denote shared library output. Default: '-o ' |
linker_setup | OT_STRING | Linker setup command. Intended to be fixed. The 'flag' option is the prefered way to set custom flags. |
name | OT_STRING | The file name used to write out compiled objects/libraries. The actual file names used depend on 'temp_suffix' and include extensions. Default: 'tmp_casadi_compiler_shell' |
temp_suffix | OT_BOOL | Use a temporary (seemingly random) filename suffix for file names. This is desired for thread-safety. This behaviour may defeat caching compiler wrappers. Default: true |
Id | Type | Description | Used in |
---|---|---|---|
cleanup | OT_BOOL | Cleanup temporary files when unloading. Default: true | casadi::ShellCompiler |
compiler | OT_STRING | Compiler command | casadi::ShellCompiler |
compiler_flags | OT_STRINGVECTOR | Alias for 'compiler_flags' | casadi::ShellCompiler |
compiler_output_flag | OT_STRING | Compiler flag to denote object output. Default: '-o ' | casadi::ShellCompiler |
compiler_setup | OT_STRING | Compiler setup command. Intended to be fixed. The 'flag' option is the prefered way to set custom flags. | casadi::ShellCompiler |
directory | OT_STRING | Directory to put temporary objects in. Must end with a file separator. | casadi::ShellCompiler |
extra_suffixes | OT_STRINGVECTOR | List of suffixes for extra files that the compiler may generate. Default: None | casadi::ShellCompiler |
flags | OT_STRINGVECTOR | Compile flags for the JIT compiler. Default: None | casadi::ShellCompiler |
linker | OT_STRING | Linker command | casadi::ShellCompiler |
linker_flags | OT_STRINGVECTOR | Linker flags for the JIT compiler. Default: None | casadi::ShellCompiler |
linker_output_flag | OT_STRING | Linker flag to denote shared library output. Default: '-o ' | casadi::ShellCompiler |
linker_setup | OT_STRING | Linker setup command. Intended to be fixed. The 'flag' option is the prefered way to set custom flags. | casadi::ShellCompiler |
name | OT_STRING | The file name used to write out compiled objects/libraries. The actual file names used depend on 'temp_suffix' and include extensions. Default: 'tmp_casadi_compiler_shell' | casadi::ShellCompiler |
temp_suffix | OT_BOOL | Use a temporary (seemingly random) filename suffix for file names. This is desired for thread-safety. This behaviour may defeat caching compiler wrappers. Default: true | casadi::ShellCompiler |
verbose | OT_BOOL | Verbose evaluation – for debugging | casadi::ImporterInternal |
Definition at line 53 of file shell_compiler.hpp.
Public Types | |
typedef ImporterInternal *(* | Creator) (const std::string &name) |
using | weak_ref_type = WeakRefInternal |
typedef int(* | RegFcn) (Plugin *plugin) |
Public Member Functions | |
ShellCompiler (const std::string &name) | |
Constructor. More... | |
~ShellCompiler () override | |
Destructor. More... | |
void | init (const Dict &opts) override |
Initialize. More... | |
const char * | plugin_name () const override |
Get name of plugin. More... | |
std::string | class_name () const override |
Get type name. More... | |
signal_t | get_function (const std::string &symname) override |
Get a function pointer for numerical evaluation. More... | |
std::string | library () const override |
Get library name. More... | |
void | disp (std::ostream &stream, bool more) const override |
Print. More... | |
void | construct (const Dict &opts) |
Construct. More... | |
virtual void | finalize () |
bool | has_function (const std::string &symname) const |
Get a function pointer for numerical evaluation. More... | |
bool | has_meta (const std::string &cmd, casadi_int ind=-1) const |
Does an entry exist? More... | |
std::string | get_meta (const std::string &cmd, casadi_int ind=-1) const |
Get entry as a text. More... | |
void | read_meta (std::istream &file, casadi_int &offset) |
Get meta information. More... | |
void | read_external (const std::string &sym, bool inlined, std::istream &file, casadi_int &offset) |
Get an external function declaration. More... | |
bool | inlined (const std::string &symname) const |
std::string | body (const std::string &symname) const |
Get the function body, if inlined. More... | |
virtual bool | can_have_meta () const |
Can meta information be read? More... | |
std::string | to_text (const std::string &cmd, casadi_int ind=-1) const |
Get entry as a text. More... | |
void | serialize (SerializingStream &s) const |
virtual void | serialize_type (SerializingStream &s) const |
virtual void | serialize_body (SerializingStream &s) const |
casadi_int | getCount () const |
Get the reference count. More... | |
std::string | debug_repr (const SharedObjectInternal *) const |
GenericWeakRef< SharedObject, SharedObjectInternal > * | weak () |
Get a weak reference to the object. More... | |
Static Public Member Functions | |
static ImporterInternal * | creator (const std::string &name) |
Create a new JIT function. More... | |
static std::string | shortname () |
Short name. More... | |
static std::string | indexed (const std::string &cmd, casadi_int ind) |
static ImporterInternal * | deserialize (DeserializingStream &s) |
static bool | has_plugin (const std::string &pname, bool verbose=false) |
Check if a plugin is available or can be loaded. More... | |
static const Options & | plugin_options (const std::string &pname) |
Get the plugin options. More... | |
static Deserialize | plugin_deserialize (const std::string &pname) |
Get the plugin deserialize_map. More... | |
static Plugin | pluginFromRegFcn (RegFcn regfcn) |
Instantiate a Plugin struct from a factory function. More... | |
static Plugin | load_plugin (const std::string &pname, bool register_plugin=true, bool needs_lock=true) |
Load a plugin dynamically. More... | |
static handle_t | load_library (const std::string &libname, std::string &resultpath, bool global) |
Load a library dynamically. More... | |
static void | registerPlugin (const Plugin &plugin, bool needs_lock=true) |
Register an integrator in the factory. More... | |
static void | registerPlugin (RegFcn regfcn, bool needs_lock=true) |
Register an integrator in the factory. More... | |
static Plugin & | getPlugin (const std::string &pname) |
Load and get the creator function. More... | |
static ImporterInternal * | instantiate (const std::string &fname, const std::string &pname, Problem problem) |
Public Attributes | |
std::string | name_ |
C filename. More... | |
std::map< std::string, std::pair< casadi_int, std::string > > | meta_ |
Meta data. More... | |
std::map< std::string, std::pair< bool, std::string > > | external_ |
External functions. More... | |
bool | verbose_ |
Verbose – for debugging purposes. More... | |
Static Public Attributes | |
static const std::string | meta_doc |
A documentation string. More... | |
static std::map< std::string, Plugin > | solvers_ |
Collection of solvers. More... | |
static const std::string | infix_ = "importer" |
Infix. More... | |
Protected Member Functions | |
void | initSingleton () |
void | destroySingleton () |
B | shared_from_this () |
Get a shared object from the current internal object. More... | |
const B | shared_from_this () const |
Get a shared object from the current internal object. More... | |
Protected Attributes | |
std::string | base_name_ |
std::string | bin_name_ |
Temporary file. More... | |
std::string | obj_name_ |
Temporary file. More... | |
std::vector< std::string > | extra_suffixes_ |
Extra files. More... | |
bool | cleanup_ |
Cleanup temporary files when unloading. More... | |
handle_t | handle_ |
static const Options | options_ |
Options. More... | |
const Options & | get_options () const override |
Options. More... | |
|
inherited |
Definition at line 66 of file importer_internal.hpp.
|
inherited |
Definition at line 73 of file plugin_interface.hpp.
|
inherited |
Definition at line 152 of file shared_object.hpp.
|
explicit |
Definition at line 57 of file shell_compiler.cpp.
References handle_.
|
override |
Definition at line 62 of file shell_compiler.cpp.
References base_name_, bin_name_, cleanup_, extra_suffixes_, handle_, obj_name_, and casadi::remove().
|
inherited |
Definition at line 299 of file importer_internal.cpp.
References casadi::ImporterInternal::external_.
|
inlinevirtualinherited |
Reimplemented in casadi::DllLibrary.
Definition at line 142 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::init().
|
inlineoverridevirtual |
Extra doc: https://github.com/casadi/casadi/wiki/L_219
Reimplemented from casadi::ImporterInternal.
Definition at line 83 of file shell_compiler.hpp.
|
inherited |
Prepares the function for evaluation
Extra doc: https://github.com/casadi/casadi/wiki/L_21b
Definition at line 57 of file importer_internal.cpp.
References casadi::Options::check(), casadi::ImporterInternal::finalize(), casadi::ImporterInternal::get_options(), casadi::ImporterInternal::init(), casadi::Options::is_sane(), and casadi::Options::sanitize().
Referenced by casadi::Importer::create().
|
inlinestatic |
Definition at line 60 of file shell_compiler.hpp.
Referenced by casadi::casadi_register_importer_shell().
|
inherited |
Definition at line 62 of file generic_shared_internal.hpp.
|
staticinherited |
Definition at line 332 of file importer_internal.cpp.
References casadi::ImporterInternal::class_name(), casadi::DllLibrary::deserialize(), and casadi::DeserializingStream::unpack().
Referenced by casadi::Importer::deserialize().
|
inlineprotectedinherited |
Called in the destructor of singletons
Definition at line 77 of file generic_shared_internal.hpp.
|
overridevirtualinherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_21a
Implements casadi::SharedObjectInternal.
Definition at line 38 of file importer_internal.cpp.
|
inlinevirtualinherited |
Reimplemented in casadi::DllLibrary.
Definition at line 88 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::construct().
|
overridevirtual |
Reimplemented from casadi::ImporterInternal.
Definition at line 262 of file shell_compiler.cpp.
References handle_.
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_21f
Definition at line 283 of file importer_internal.cpp.
References casadi::ImporterInternal::has_meta(), casadi::ImporterInternal::indexed(), and casadi::ImporterInternal::meta_.
|
inlineoverridevirtual |
Reimplemented from casadi::ImporterInternal.
Definition at line 70 of file shell_compiler.hpp.
|
inherited |
Definition at line 60 of file generic_shared_internal.hpp.
|
staticinherited |
Definition at line 102 of file plugin_interface.hpp.
|
inherited |
Definition at line 214 of file importer_internal.cpp.
References casadi::ImporterInternal::external_, and casadi::ImporterInternal::get_function().
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_21e
Definition at line 289 of file importer_internal.cpp.
References casadi::ImporterInternal::indexed(), and casadi::ImporterInternal::meta_.
Referenced by casadi::ImporterInternal::get_meta().
|
staticinherited |
Definition at line 76 of file plugin_interface.hpp.
|
inlinestaticinherited |
Convert indexed command
Definition at line 150 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::get_meta(), and casadi::ImporterInternal::has_meta().
|
overridevirtual |
Reimplemented from casadi::ImporterInternal.
Definition at line 131 of file shell_compiler.cpp.
References base_name_, bin_name_, cleanup_, extra_suffixes_, casadi::get_search_paths(), handle_, casadi::ImporterInternal::init(), casadi::ImporterInternal::name_, obj_name_, casadi::temporary_file(), and casadi::ImporterInternal::verbose_.
|
inlineprotectedinherited |
Called in the constructor of singletons to avoid that the counter reaches zero
Definition at line 71 of file generic_shared_internal.hpp.
|
inherited |
Definition at line 294 of file importer_internal.cpp.
References casadi::ImporterInternal::external_.
Referenced by casadi::ImporterInternal::init(), and casadi::ImporterInternal::read_external().
|
staticinherited |
Definition at line 106 of file plugin_interface.hpp.
|
overridevirtual |
Reimplemented from casadi::ImporterInternal.
Definition at line 258 of file shell_compiler.cpp.
References bin_name_.
|
staticinherited |
Definition at line 92 of file plugin_interface.hpp.
|
staticinherited |
Definition at line 88 of file plugin_interface.hpp.
|
staticinherited |
Definition at line 82 of file plugin_interface.hpp.
|
inlineoverridevirtual |
Reimplemented from casadi::ImporterInternal.
Definition at line 80 of file shell_compiler.hpp.
|
staticinherited |
Definition at line 79 of file plugin_interface.hpp.
|
staticinherited |
Definition at line 85 of file plugin_interface.hpp.
|
inherited |
Definition at line 179 of file importer_internal.cpp.
References casadi::ImporterInternal::external_, and casadi::ImporterInternal::inlined().
Referenced by casadi::ImporterInternal::init().
|
inherited |
Definition at line 132 of file importer_internal.cpp.
References casadi::ImporterInternal::meta_.
Referenced by casadi::ImporterInternal::init().
|
staticinherited |
Definition at line 96 of file plugin_interface.hpp.
|
staticinherited |
Definition at line 99 of file plugin_interface.hpp.
|
inherited |
Definition at line 309 of file importer_internal.cpp.
References casadi::ImporterInternal::serialize_body(), and casadi::ImporterInternal::serialize_type().
|
virtualinherited |
Definition at line 318 of file importer_internal.cpp.
References casadi::ImporterInternal::external_, casadi::ImporterInternal::meta_, casadi::ImporterInternal::name_, casadi::SerializingStream::pack(), and casadi::SerializingStream::version().
Referenced by casadi::ImporterInternal::serialize().
|
virtualinherited |
Definition at line 314 of file importer_internal.cpp.
References casadi::ImporterInternal::class_name(), and casadi::SerializingStream::pack().
Referenced by casadi::ImporterInternal::serialize().
|
inlineprotectedinherited |
Definition at line 83 of file generic_shared_internal.hpp.
|
inlineprotectedinherited |
Definition at line 92 of file generic_shared_internal.hpp.
|
inlinestaticinherited |
Definition at line 104 of file importer_internal.hpp.
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_21g
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_1ai
Definition at line 67 of file generic_shared_internal.hpp.
|
protected |
Definition at line 92 of file shell_compiler.hpp.
Referenced by init(), and ~ShellCompiler().
|
protected |
Definition at line 95 of file shell_compiler.hpp.
Referenced by init(), library(), and ~ShellCompiler().
|
protected |
Definition at line 104 of file shell_compiler.hpp.
Referenced by init(), and ~ShellCompiler().
|
inherited |
Definition at line 163 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::body(), casadi::ImporterInternal::has_function(), casadi::ImporterInternal::ImporterInternal(), casadi::ImporterInternal::inlined(), casadi::ImporterInternal::read_external(), and casadi::ImporterInternal::serialize_body().
|
protected |
Definition at line 101 of file shell_compiler.hpp.
Referenced by init(), and ~ShellCompiler().
|
protected |
Definition at line 107 of file shell_compiler.hpp.
Referenced by get_function(), init(), ShellCompiler(), and ~ShellCompiler().
|
staticinherited |
Definition at line 101 of file importer_internal.hpp.
|
inherited |
Definition at line 160 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::get_meta(), casadi::ImporterInternal::has_meta(), casadi::ImporterInternal::ImporterInternal(), casadi::ImporterInternal::read_meta(), and casadi::ImporterInternal::serialize_body().
|
static |
Definition at line 77 of file shell_compiler.hpp.
Referenced by casadi::casadi_register_importer_shell().
|
inherited |
Definition at line 157 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::ImporterInternal(), casadi::ImporterInternal::init(), casadi::ClangCompiler::init(), init(), casadi::DllLibrary::init_handle(), casadi::DllLibrary::library(), and casadi::ImporterInternal::serialize_body().
|
protected |
Definition at line 98 of file shell_compiler.hpp.
Referenced by init(), and ~ShellCompiler().
|
static |
Definition at line 69 of file shell_compiler.hpp.
Referenced by casadi::casadi_register_importer_shell().
|
staticinherited |
Definition at line 94 of file importer_internal.hpp.
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_21h
Definition at line 168 of file importer_internal.hpp.
Referenced by casadi::ImporterInternal::ImporterInternal(), casadi::ImporterInternal::init(), and init().