diode package

Submodules

diode.DaceState module

State of DaCe program in DIODE.

class diode.DaceState.DaceState(dace_code, fake_fname, source_code=None, sdfg=None, remote=False)

Bases: object

This class abstracts the DaCe implementation from the GUI. It accepts a string of DaCe code and compiles it, giving access to the SDFG and the generated code, as well as the matching transformations.

DaCe requires the code to be in a file (for code inspection), but while the user types in the GUI we do not have the data available in a file. Thus we create a temporary directory and save it there. However, the user might check for the filename in the code, thus we provide the original file name in argv[0].

compile()
get_arg_initializers()
get_call_args()
get_dace_code()
get_dace_fake_fname()

Returns the original filename of the DaCe program, i.e., the name of the file he stored to, before performing modifications in the editor

get_dace_generated_files()

Writes the generated code to a temporary file and returns the file name. Compiles the code if not already compiled.

get_dace_tmpfile()

Returns the current temporary path to the generated code files.

get_generated_code()
get_sdfg()
get_sdfgs()

Returns the current set of SDFGs in the workspace. @rtype: Tuples of (name, SDFG).

set_is_compiled(state)
set_sdfg(sdfg, name='Main SDFG')

diode.abstract_sdfg module

diode.adjust_settings module

diode.config_ui module

diode.diode_client module

DIODE client using a command line interface.

diode.diode_server module

class diode.diode_server.ConfigCopy(config_values)

Bases: object

Copied Config for passing by-value

get(*key_hierarchy)
get_bool(*key_hierarchy)
save(path=None)

Nonstatic version of Config::save()

set(*key_hierarchy, value=None, autosave=False)
class diode.diode_server.ExecutorServer

Bases: object

Implements a server scheduling execution of dace programs

addCommand(cmd)
addRun(client_id, compilation_output_tuple, more_options)
consume()
consume_programs()
executorLoop()
getExecutionOutput(client_id)
static getPerfdataDir(client_id)
lock()
loop()
run(cot, options)
stop()
unlock()
waitForCommand(ticket)
diode.diode_server.applyOptPath(sdfg, optpath, useGlobalSuffix=True, sdfg_props=None)
diode.diode_server.applySDFGProperties(sdfg, properties, step=None)
diode.diode_server.applySDFGProperty(sdfg, property_element, step=None)
diode.diode_server.collect_all_SDFG_nodes(sdfg)
diode.diode_server.compile(language)
POST-Parameters:
sdfg: ser. sdfg: Contains the root SDFG, serialized in JSON-string. If set, options code and sdfg_props are taken from this value.
Can be a list of SDFGs. NOTE: If specified, code, sdfg_prop, and language (in URL) are ignored.

code: string/list. Contains all necessary input code files [opt] optpath: list of dicts, as { <sdfg_name/str>: { name: <str>, params: <dict> }}. Contains the current optimization path/tree.

This optpath is applied to the provided code before compilation
[opt] sdfg_props: list of dicts, as { <sdfg_name/str>: { state_id: <str>, node_id: <str>, params: <dict>, step: <opt int>}}. Contains changes to the default SDFG properties.
The step element of the dicts is optional. If it is provided, it specifies the number of optpath elements that preceed it. E.g. a step value of 0 means that the property is applied before the first optimization. If it is omitted, the property is applied after all optimization steps, i.e. to the resulting SDFG
[opt] perf_mode: string. Providing “null” has the same effect as omission. If specified, enables performance instrumentation with the counter set
provided in the DaCe settings. If null (or omitted), no instrumentation is enabled.
client_id: <string>: For later identification. May be unique across all runs,
must be unique across clients
Returns:

sdfg: object. Contains a serialization of the resulting SDFGs. generated_code: string. Contains the output code sdfg_props: object. Contains a dict of all properties for

every existing node of the sdfgs returned in the sdfg field
diode.diode_server.compileProgram(request, language, perfopts=None)
diode.diode_server.create_DaceState(code, sdfg_dict, errors)
diode.diode_server.diode_settings(operation)
diode.diode_server.execution_queue_query(op)
diode.diode_server.expand_node_or_sdfg()

Performs expansion of a single library node or an entire SDFG. Fields: sdfg (required): SDFG as JSON nodeid (not required): A list of: [SDFG ID, state ID, node ID]

diode.diode_server.getEnum(name)

Helper function to enumerate available values for ScheduleType.

Returns:
enum: List of string-representations of the values in the enum
diode.diode_server.getPubSSH()
diode.diode_server.get_available_ace_editor_themes()
diode.diode_server.get_library_implementations(name)

Helper function to enumerate available implementations for a given library node.

Returns:
enum: List of string-representations of implementations
diode.diode_server.get_run_status()
diode.diode_server.get_settings(client_id, name='', cv=None, config_path='')
diode.diode_server.get_transformations(sdfgs)
diode.diode_server.index(path)

This is an http server (on the same port as the REST API). It serves the files from the ‘webclient’-directory to user agents. Note: This is NOT intended for production environments and security is disregarded!

diode.diode_server.main()
diode.diode_server.optimize()

Returns a list of possible optimizations (transformations) and their properties.

POST-Parameters:

input_code: list. Contains all necessary input code files optpath: list of dicts, as { name: <str>, params: <dict> }. Contains the current optimization path/tree.

This optpath is applied to the provided code before evaluating possible pattern matches.
client_id: For identification. May be unique across all runs,
must be unique across clients
Returns:matching_opts: list of dicts, as { opt_name: <str>, opt_params: <dict>, affects: <list>, children: <recurse> }. Contains the matching transformations. affects is a list of affected node ids, which must be unique in the current program.
diode.diode_server.properties_to_json_list(props)
diode.diode_server.redirect_base()
diode.diode_server.run()

This function is equivalent to the old DIODE “Run”-Button.

POST-Parameters:
(Same as for compile(), language defaults to ‘dace’) perfmodes: list including every queried mode corecounts: list of core counts (one run for every number of cores)
diode.diode_server.set_settings(settings_array, client_id)
diode.diode_server.split_nodeid_in_state_and_nodeid(nodeid)
diode.diode_server.status()

diode.remote_execution module

class diode.remote_execution.AsyncExecutor(remote)

Bases: object

Asynchronous remote execution.

add_async_task(task)
append_run_async(dace_state, fail_on_nonzero=False)
callMethod(obj, name, *args)
execute_task(task)
join(timeout=None)
run()
run_async(dace_state, fail_on_nonzero=False)
run_sync(func)
class diode.remote_execution.Executor(remote, async_host=None)

Bases: object

DaCe program execution management class for DIODE.

config_get(*key_hierarchy)
copy_file_from_remote(src, dst)
copy_file_to_remote(src, dst)
copy_folder_from_remote(src: str, dst: str)
copy_folder_to_remote(src, dst)
create_remote_directory(path)

Creates a path on a remote node.

@note: We use mkdir -p for now, which is not portable.

delete_local_folder(path)
exec_cmd_and_show_output(cmd, fail_on_nonzero=True)
remote_compile(rem_path, dace_progname)
remote_delete_dir(deldir)
remote_delete_file(delfile)
remote_exec_dace(remote_workdir, dace_file, use_mpi=True, fail_on_nonzero=False, omp_num_threads=None, additional_options_dict=None, repetitions=None)
run(dace_state, fail_on_nonzero=False)
run_local(sdfg: dace.sdfg.sdfg.SDFG, driver_file: str)
run_remote(sdfg: dace.sdfg.sdfg.SDFG, dace_state, fail_on_nonzero: bool)
set_config(config)
set_exit_on_error(do_exit)
show_output(outstr)

Displays output of any ongoing compilation or computation.

class diode.remote_execution.FunctionStreamWrapper(*funcs)

Bases: object

Class that wraps around a function with a stream-like API (write).

flush()
write(*args, **kwargs)

diode.sdfv module

Module contents