partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
check_arguments
Check arguments passed by user that are not checked by argparse itself.
kerncraft/kerncraft.py
def check_arguments(args, parser): """Check arguments passed by user that are not checked by argparse itself.""" if args.asm_block not in ['auto', 'manual']: try: args.asm_block = int(args.asm_block) except ValueError: parser.error('--asm-block can only be "auto", "manual...
def check_arguments(args, parser): """Check arguments passed by user that are not checked by argparse itself.""" if args.asm_block not in ['auto', 'manual']: try: args.asm_block = int(args.asm_block) except ValueError: parser.error('--asm-block can only be "auto", "manual...
[ "Check", "arguments", "passed", "by", "user", "that", "are", "not", "checked", "by", "argparse", "itself", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L189-L202
[ "def", "check_arguments", "(", "args", ",", "parser", ")", ":", "if", "args", ".", "asm_block", "not", "in", "[", "'auto'", ",", "'manual'", "]", ":", "try", ":", "args", ".", "asm_block", "=", "int", "(", "args", ".", "asm_block", ")", "except", "Va...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
run
Run command line interface.
kerncraft/kerncraft.py
def run(parser, args, output_file=sys.stdout): """Run command line interface.""" # Try loading results file (if requested) result_storage = {} if args.store: args.store.seek(0) try: result_storage = pickle.load(args.store) except EOFError: pass arg...
def run(parser, args, output_file=sys.stdout): """Run command line interface.""" # Try loading results file (if requested) result_storage = {} if args.store: args.store.seek(0) try: result_storage = pickle.load(args.store) except EOFError: pass arg...
[ "Run", "command", "line", "interface", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L205-L305
[ "def", "run", "(", "parser", ",", "args", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "# Try loading results file (if requested)", "result_storage", "=", "{", "}", "if", "args", ".", "store", ":", "args", ".", "store", ".", "seek", "(", "0", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
main
Initialize and run command line interface.
kerncraft/kerncraft.py
def main(): """Initialize and run command line interface.""" # Create and populate parser parser = create_parser() # Parse given arguments args = parser.parse_args() # Checking arguments check_arguments(args, parser) # BUSINESS LOGIC IS FOLLOWING run(parser, args)
def main(): """Initialize and run command line interface.""" # Create and populate parser parser = create_parser() # Parse given arguments args = parser.parse_args() # Checking arguments check_arguments(args, parser) # BUSINESS LOGIC IS FOLLOWING run(parser, args)
[ "Initialize", "and", "run", "command", "line", "interface", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L308-L320
[ "def", "main", "(", ")", ":", "# Create and populate parser", "parser", "=", "create_parser", "(", ")", "# Parse given arguments", "args", "=", "parser", ".", "parse_args", "(", ")", "# Checking arguments", "check_arguments", "(", "args", ",", "parser", ")", "# BU...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
main
Comand line interface of picklemerge.
kerncraft/picklemerge.py
def main(): """Comand line interface of picklemerge.""" parser = argparse.ArgumentParser( description='Recursively merges two or more pickle files. Only supports pickles consisting ' 'of a single dictionary object.') parser.add_argument('destination', type=argparse.FileType('r+b'), ...
def main(): """Comand line interface of picklemerge.""" parser = argparse.ArgumentParser( description='Recursively merges two or more pickle files. Only supports pickles consisting ' 'of a single dictionary object.') parser.add_argument('destination', type=argparse.FileType('r+b'), ...
[ "Comand", "line", "interface", "of", "picklemerge", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/picklemerge.py#L23-L46
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Recursively merges two or more pickle files. Only supports pickles consisting '", "'of a single dictionary object.'", ")", "parser", ".", "add_argument", "(", "'destinat...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
symbol_pos_int
Create a sympy.Symbol with positive and integer assumptions.
kerncraft/kernel.py
def symbol_pos_int(*args, **kwargs): """Create a sympy.Symbol with positive and integer assumptions.""" kwargs.update({'positive': True, 'integer': True}) return sympy.Symbol(*args, **kwargs)
def symbol_pos_int(*args, **kwargs): """Create a sympy.Symbol with positive and integer assumptions.""" kwargs.update({'positive': True, 'integer': True}) return sympy.Symbol(*args, **kwargs)
[ "Create", "a", "sympy", ".", "Symbol", "with", "positive", "and", "integer", "assumptions", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L36-L40
[ "def", "symbol_pos_int", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "{", "'positive'", ":", "True", ",", "'integer'", ":", "True", "}", ")", "return", "sympy", ".", "Symbol", "(", "*", "args", ",", "*", "*", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
prefix_indent
Prefix and indent all lines in *textblock*. *prefix* is a prefix string *later_prefix* is used on all but the first line, if it is a single character it will be repeated to match length of *prefix*
kerncraft/kernel.py
def prefix_indent(prefix, textblock, later_prefix=' '): """ Prefix and indent all lines in *textblock*. *prefix* is a prefix string *later_prefix* is used on all but the first line, if it is a single character it will be repeated to match length of *prefix* """ textblock = te...
def prefix_indent(prefix, textblock, later_prefix=' '): """ Prefix and indent all lines in *textblock*. *prefix* is a prefix string *later_prefix* is used on all but the first line, if it is a single character it will be repeated to match length of *prefix* """ textblock = te...
[ "Prefix", "and", "indent", "all", "lines", "in", "*", "textblock", "*", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L43-L59
[ "def", "prefix_indent", "(", "prefix", ",", "textblock", ",", "later_prefix", "=", "' '", ")", ":", "textblock", "=", "textblock", ".", "split", "(", "'\\n'", ")", "line", "=", "prefix", "+", "textblock", "[", "0", "]", "+", "'\\n'", "if", "len", "(", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
transform_multidim_to_1d_decl
Transform ast of multidimensional declaration to a single dimension declaration. In-place operation! Returns name and dimensions of array (to be used with transform_multidim_to_1d_ref())
kerncraft/kernel.py
def transform_multidim_to_1d_decl(decl): """ Transform ast of multidimensional declaration to a single dimension declaration. In-place operation! Returns name and dimensions of array (to be used with transform_multidim_to_1d_ref()) """ dims = [] type_ = decl.type while type(type_) is c...
def transform_multidim_to_1d_decl(decl): """ Transform ast of multidimensional declaration to a single dimension declaration. In-place operation! Returns name and dimensions of array (to be used with transform_multidim_to_1d_ref()) """ dims = [] type_ = decl.type while type(type_) is c...
[ "Transform", "ast", "of", "multidimensional", "declaration", "to", "a", "single", "dimension", "declaration", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L62-L81
[ "def", "transform_multidim_to_1d_decl", "(", "decl", ")", ":", "dims", "=", "[", "]", "type_", "=", "decl", ".", "type", "while", "type", "(", "type_", ")", "is", "c_ast", ".", "ArrayDecl", ":", "dims", ".", "append", "(", "type_", ".", "dim", ")", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
transform_multidim_to_1d_ref
Transform ast of multidimensional reference to a single dimension reference. In-place operation!
kerncraft/kernel.py
def transform_multidim_to_1d_ref(aref, dimension_dict): """ Transform ast of multidimensional reference to a single dimension reference. In-place operation! """ dims = [] name = aref while type(name) is c_ast.ArrayRef: dims.append(name.subscript) name = name.name subscr...
def transform_multidim_to_1d_ref(aref, dimension_dict): """ Transform ast of multidimensional reference to a single dimension reference. In-place operation! """ dims = [] name = aref while type(name) is c_ast.ArrayRef: dims.append(name.subscript) name = name.name subscr...
[ "Transform", "ast", "of", "multidimensional", "reference", "to", "a", "single", "dimension", "reference", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L84-L107
[ "def", "transform_multidim_to_1d_ref", "(", "aref", ",", "dimension_dict", ")", ":", "dims", "=", "[", "]", "name", "=", "aref", "while", "type", "(", "name", ")", "is", "c_ast", ".", "ArrayRef", ":", "dims", ".", "append", "(", "name", ".", "subscript",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
transform_array_decl_to_malloc
Transform ast of "type var_name[N]" to "type* var_name = aligned_malloc(sizeof(type)*N, 32)" In-place operation. :param with_init: if False, ommit malloc
kerncraft/kernel.py
def transform_array_decl_to_malloc(decl, with_init=True): """ Transform ast of "type var_name[N]" to "type* var_name = aligned_malloc(sizeof(type)*N, 32)" In-place operation. :param with_init: if False, ommit malloc """ if type(decl.type) is not c_ast.ArrayDecl: # Not an array declarat...
def transform_array_decl_to_malloc(decl, with_init=True): """ Transform ast of "type var_name[N]" to "type* var_name = aligned_malloc(sizeof(type)*N, 32)" In-place operation. :param with_init: if False, ommit malloc """ if type(decl.type) is not c_ast.ArrayDecl: # Not an array declarat...
[ "Transform", "ast", "of", "type", "var_name", "[", "N", "]", "to", "type", "*", "var_name", "=", "aligned_malloc", "(", "sizeof", "(", "type", ")", "*", "N", "32", ")" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L110-L135
[ "def", "transform_array_decl_to_malloc", "(", "decl", ",", "with_init", "=", "True", ")", ":", "if", "type", "(", "decl", ".", "type", ")", "is", "not", "c_ast", ".", "ArrayDecl", ":", "# Not an array declaration, can be ignored", "return", "type_", "=", "c_ast"...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
find_node_type
Return list of array references in AST.
kerncraft/kernel.py
def find_node_type(ast, node_type): """Return list of array references in AST.""" if type(ast) is node_type: return [ast] elif type(ast) is list: return reduce(operator.add, list(map(lambda a: find_node_type(a, node_type), ast)), []) elif ast is None: return [] else: ...
def find_node_type(ast, node_type): """Return list of array references in AST.""" if type(ast) is node_type: return [ast] elif type(ast) is list: return reduce(operator.add, list(map(lambda a: find_node_type(a, node_type), ast)), []) elif ast is None: return [] else: ...
[ "Return", "list", "of", "array", "references", "in", "AST", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L138-L148
[ "def", "find_node_type", "(", "ast", ",", "node_type", ")", ":", "if", "type", "(", "ast", ")", "is", "node_type", ":", "return", "[", "ast", "]", "elif", "type", "(", "ast", ")", "is", "list", ":", "return", "reduce", "(", "operator", ".", "add", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
force_iterable
Will make any functions return an iterable objects by wrapping its result in a list.
kerncraft/kernel.py
def force_iterable(f): """Will make any functions return an iterable objects by wrapping its result in a list.""" def wrapper(*args, **kwargs): r = f(*args, **kwargs) if hasattr(r, '__iter__'): return r else: return [r] return wrapper
def force_iterable(f): """Will make any functions return an iterable objects by wrapping its result in a list.""" def wrapper(*args, **kwargs): r = f(*args, **kwargs) if hasattr(r, '__iter__'): return r else: return [r] return wrapper
[ "Will", "make", "any", "functions", "return", "an", "iterable", "objects", "by", "wrapping", "its", "result", "in", "a", "list", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L157-L165
[ "def", "force_iterable", "(", "f", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "r", "=", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "hasattr", "(", "r", ",", "'__iter__'", ")", ":", "return",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
reduce_path
Reduce absolute path to relative (if shorter) for easier readability.
kerncraft/kernel.py
def reduce_path(path): """Reduce absolute path to relative (if shorter) for easier readability.""" relative_path = os.path.relpath(path) if len(relative_path) < len(path): return relative_path else: return path
def reduce_path(path): """Reduce absolute path to relative (if shorter) for easier readability.""" relative_path = os.path.relpath(path) if len(relative_path) < len(path): return relative_path else: return path
[ "Reduce", "absolute", "path", "to", "relative", "(", "if", "shorter", ")", "for", "easier", "readability", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L168-L174
[ "def", "reduce_path", "(", "path", ")", ":", "relative_path", "=", "os", ".", "path", ".", "relpath", "(", "path", ")", "if", "len", "(", "relative_path", ")", "<", "len", "(", "path", ")", ":", "return", "relative_path", "else", ":", "return", "path" ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.check
Check that information about kernel makes sens and is valid.
kerncraft/kernel.py
def check(self): """Check that information about kernel makes sens and is valid.""" datatypes = [v[0] for v in self.variables.values()] assert len(set(datatypes)) <= 1, 'mixing of datatypes within a kernel is not supported.'
def check(self): """Check that information about kernel makes sens and is valid.""" datatypes = [v[0] for v in self.variables.values()] assert len(set(datatypes)) <= 1, 'mixing of datatypes within a kernel is not supported.'
[ "Check", "that", "information", "about", "kernel", "makes", "sens", "and", "is", "valid", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L196-L199
[ "def", "check", "(", "self", ")", ":", "datatypes", "=", "[", "v", "[", "0", "]", "for", "v", "in", "self", ".", "variables", ".", "values", "(", ")", "]", "assert", "len", "(", "set", "(", "datatypes", ")", ")", "<=", "1", ",", "'mixing of datat...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.set_constant
Set constant of name to value. :param name: may be a str or a sympy.Symbol :param value: must be an int
kerncraft/kernel.py
def set_constant(self, name, value): """ Set constant of name to value. :param name: may be a str or a sympy.Symbol :param value: must be an int """ assert isinstance(name, str) or isinstance(name, sympy.Symbol), \ "constant name needs to be of type str, unic...
def set_constant(self, name, value): """ Set constant of name to value. :param name: may be a str or a sympy.Symbol :param value: must be an int """ assert isinstance(name, str) or isinstance(name, sympy.Symbol), \ "constant name needs to be of type str, unic...
[ "Set", "constant", "of", "name", "to", "value", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L203-L216
[ "def", "set_constant", "(", "self", ",", "name", ",", "value", ")", ":", "assert", "isinstance", "(", "name", ",", "str", ")", "or", "isinstance", "(", "name", ",", "sympy", ".", "Symbol", ")", ",", "\"constant name needs to be of type str, unicode or a sympy.Sy...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.set_variable
Register variable of name and type_, with a (multidimensional) size. :param name: variable name as it appears in code :param type_: may be any key from Kernel.datatypes_size (typically float or double) :param size: either None for scalars or an n-tuple of ints for an n-dimensional array
kerncraft/kernel.py
def set_variable(self, name, type_, size): """ Register variable of name and type_, with a (multidimensional) size. :param name: variable name as it appears in code :param type_: may be any key from Kernel.datatypes_size (typically float or double) :param size: either None for s...
def set_variable(self, name, type_, size): """ Register variable of name and type_, with a (multidimensional) size. :param name: variable name as it appears in code :param type_: may be any key from Kernel.datatypes_size (typically float or double) :param size: either None for s...
[ "Register", "variable", "of", "name", "and", "type_", "with", "a", "(", "multidimensional", ")", "size", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L218-L232
[ "def", "set_variable", "(", "self", ",", "name", ",", "type_", ",", "size", ")", ":", "assert", "type_", "in", "self", ".", "datatypes_size", ",", "'only float and double variables are supported'", "if", "self", ".", "datatype", "is", "None", ":", "self", ".",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.subs_consts
Substitute constants in expression unless it is already a number.
kerncraft/kernel.py
def subs_consts(self, expr): """Substitute constants in expression unless it is already a number.""" if isinstance(expr, numbers.Number): return expr else: return expr.subs(self.constants)
def subs_consts(self, expr): """Substitute constants in expression unless it is already a number.""" if isinstance(expr, numbers.Number): return expr else: return expr.subs(self.constants)
[ "Substitute", "constants", "in", "expression", "unless", "it", "is", "already", "a", "number", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L240-L245
[ "def", "subs_consts", "(", "self", ",", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "numbers", ".", "Number", ")", ":", "return", "expr", "else", ":", "return", "expr", ".", "subs", "(", "self", ".", "constants", ")" ]
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.array_sizes
Return a dictionary with all arrays sizes. :param in_bytes: If True, output will be in bytes, not element counts. :param subs_consts: If True, output will be numbers and not symbolic. Scalar variables are ignored.
kerncraft/kernel.py
def array_sizes(self, in_bytes=False, subs_consts=False): """ Return a dictionary with all arrays sizes. :param in_bytes: If True, output will be in bytes, not element counts. :param subs_consts: If True, output will be numbers and not symbolic. Scalar variables are ignored. ...
def array_sizes(self, in_bytes=False, subs_consts=False): """ Return a dictionary with all arrays sizes. :param in_bytes: If True, output will be in bytes, not element counts. :param subs_consts: If True, output will be numbers and not symbolic. Scalar variables are ignored. ...
[ "Return", "a", "dictionary", "with", "all", "arrays", "sizes", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L247-L275
[ "def", "array_sizes", "(", "self", ",", "in_bytes", "=", "False", ",", "subs_consts", "=", "False", ")", ":", "var_sizes", "=", "{", "}", "for", "var_name", ",", "var_info", "in", "self", ".", "variables", ".", "items", "(", ")", ":", "var_type", ",", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel._calculate_relative_offset
Return the offset from the iteration center in number of elements. The order of indices used in access is preserved.
kerncraft/kernel.py
def _calculate_relative_offset(self, name, access_dimensions): """ Return the offset from the iteration center in number of elements. The order of indices used in access is preserved. """ # TODO to be replaced with compile_global_offsets offset = 0 base_dims = se...
def _calculate_relative_offset(self, name, access_dimensions): """ Return the offset from the iteration center in number of elements. The order of indices used in access is preserved. """ # TODO to be replaced with compile_global_offsets offset = 0 base_dims = se...
[ "Return", "the", "offset", "from", "the", "iteration", "center", "in", "number", "of", "elements", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L277-L298
[ "def", "_calculate_relative_offset", "(", "self", ",", "name", ",", "access_dimensions", ")", ":", "# TODO to be replaced with compile_global_offsets", "offset", "=", "0", "base_dims", "=", "self", ".", "variables", "[", "name", "]", "[", "1", "]", "for", "dim", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel._remove_duplicate_accesses
Remove duplicate source and destination accesses
kerncraft/kernel.py
def _remove_duplicate_accesses(self): """ Remove duplicate source and destination accesses """ self.destinations = {var_name: set(acs) for var_name, acs in self.destinations.items()} self.sources = {var_name: set(acs) for var_name, acs in self.sources.items()}
def _remove_duplicate_accesses(self): """ Remove duplicate source and destination accesses """ self.destinations = {var_name: set(acs) for var_name, acs in self.destinations.items()} self.sources = {var_name: set(acs) for var_name, acs in self.sources.items()}
[ "Remove", "duplicate", "source", "and", "destination", "accesses" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L300-L305
[ "def", "_remove_duplicate_accesses", "(", "self", ")", ":", "self", ".", "destinations", "=", "{", "var_name", ":", "set", "(", "acs", ")", "for", "var_name", ",", "acs", "in", "self", ".", "destinations", ".", "items", "(", ")", "}", "self", ".", "sou...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.access_to_sympy
Transform a (multidimensional) variable access to a flattend sympy expression. Also works with flat array accesses.
kerncraft/kernel.py
def access_to_sympy(self, var_name, access): """ Transform a (multidimensional) variable access to a flattend sympy expression. Also works with flat array accesses. """ base_sizes = self.variables[var_name][1] expr = sympy.Number(0) for dimension, a in enumerat...
def access_to_sympy(self, var_name, access): """ Transform a (multidimensional) variable access to a flattend sympy expression. Also works with flat array accesses. """ base_sizes = self.variables[var_name][1] expr = sympy.Number(0) for dimension, a in enumerat...
[ "Transform", "a", "(", "multidimensional", ")", "variable", "access", "to", "a", "flattend", "sympy", "expression", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L307-L322
[ "def", "access_to_sympy", "(", "self", ",", "var_name", ",", "access", ")", ":", "base_sizes", "=", "self", ".", "variables", "[", "var_name", "]", "[", "1", "]", "expr", "=", "sympy", ".", "Number", "(", "0", ")", "for", "dimension", ",", "a", "in",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.iteration_length
Return the number of global loop iterations that are performed. If dimension is not None, it is the loop dimension that is returned (-1 is the inner most loop and 0 the outermost)
kerncraft/kernel.py
def iteration_length(self, dimension=None): """ Return the number of global loop iterations that are performed. If dimension is not None, it is the loop dimension that is returned (-1 is the inner most loop and 0 the outermost) """ total_length = 1 if dimension ...
def iteration_length(self, dimension=None): """ Return the number of global loop iterations that are performed. If dimension is not None, it is the loop dimension that is returned (-1 is the inner most loop and 0 the outermost) """ total_length = 1 if dimension ...
[ "Return", "the", "number", "of", "global", "loop", "iterations", "that", "are", "performed", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L324-L342
[ "def", "iteration_length", "(", "self", ",", "dimension", "=", "None", ")", ":", "total_length", "=", "1", "if", "dimension", "is", "not", "None", ":", "loops", "=", "[", "self", ".", "_loop_stack", "[", "dimension", "]", "]", "else", ":", "loops", "="...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.get_loop_stack
Yield loop stack dictionaries in order from outer to inner.
kerncraft/kernel.py
def get_loop_stack(self, subs_consts=False): """Yield loop stack dictionaries in order from outer to inner.""" for l in self._loop_stack: if subs_consts: yield {'index': l[0], 'start': self.subs_consts(l[1]), 'stop': self.subs_con...
def get_loop_stack(self, subs_consts=False): """Yield loop stack dictionaries in order from outer to inner.""" for l in self._loop_stack: if subs_consts: yield {'index': l[0], 'start': self.subs_consts(l[1]), 'stop': self.subs_con...
[ "Yield", "loop", "stack", "dictionaries", "in", "order", "from", "outer", "to", "inner", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L344-L353
[ "def", "get_loop_stack", "(", "self", ",", "subs_consts", "=", "False", ")", ":", "for", "l", "in", "self", ".", "_loop_stack", ":", "if", "subs_consts", ":", "yield", "{", "'index'", ":", "l", "[", "0", "]", ",", "'start'", ":", "self", ".", "subs_c...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.index_order
Return the order of indices as they appear in array references. Use *source* and *destination* to filter output
kerncraft/kernel.py
def index_order(self, sources=True, destinations=True): """ Return the order of indices as they appear in array references. Use *source* and *destination* to filter output """ if sources: arefs = chain(*self.sources.values()) else: arefs = [] ...
def index_order(self, sources=True, destinations=True): """ Return the order of indices as they appear in array references. Use *source* and *destination* to filter output """ if sources: arefs = chain(*self.sources.values()) else: arefs = [] ...
[ "Return", "the", "order", "of", "indices", "as", "they", "appear", "in", "array", "references", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L355-L375
[ "def", "index_order", "(", "self", ",", "sources", "=", "True", ",", "destinations", "=", "True", ")", ":", "if", "sources", ":", "arefs", "=", "chain", "(", "*", "self", ".", "sources", ".", "values", "(", ")", ")", "else", ":", "arefs", "=", "[",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.compile_sympy_accesses
Return a dictionary of lists of sympy accesses, for each variable. Use *source* and *destination* to filter output
kerncraft/kernel.py
def compile_sympy_accesses(self, sources=True, destinations=True): """ Return a dictionary of lists of sympy accesses, for each variable. Use *source* and *destination* to filter output """ sympy_accesses = defaultdict(list) # Compile sympy accesses for var_name ...
def compile_sympy_accesses(self, sources=True, destinations=True): """ Return a dictionary of lists of sympy accesses, for each variable. Use *source* and *destination* to filter output """ sympy_accesses = defaultdict(list) # Compile sympy accesses for var_name ...
[ "Return", "a", "dictionary", "of", "lists", "of", "sympy", "accesses", "for", "each", "variable", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L377-L397
[ "def", "compile_sympy_accesses", "(", "self", ",", "sources", "=", "True", ",", "destinations", "=", "True", ")", ":", "sympy_accesses", "=", "defaultdict", "(", "list", ")", "# Compile sympy accesses", "for", "var_name", "in", "self", ".", "variables", ":", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.compile_relative_distances
Return load and store distances between accesses. :param sympy_accesses: optionally restrict accesses, default from compile_sympy_accesses() e.g. if accesses are to [+N, +1, -1, -N], relative distances are [N-1, 2, N-1] returned is a dict of list of sympy expressions, for each variable
kerncraft/kernel.py
def compile_relative_distances(self, sympy_accesses=None): """ Return load and store distances between accesses. :param sympy_accesses: optionally restrict accesses, default from compile_sympy_accesses() e.g. if accesses are to [+N, +1, -1, -N], relative distances are [N-1, 2, N-1] ...
def compile_relative_distances(self, sympy_accesses=None): """ Return load and store distances between accesses. :param sympy_accesses: optionally restrict accesses, default from compile_sympy_accesses() e.g. if accesses are to [+N, +1, -1, -N], relative distances are [N-1, 2, N-1] ...
[ "Return", "load", "and", "store", "distances", "between", "accesses", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L399-L417
[ "def", "compile_relative_distances", "(", "self", ",", "sympy_accesses", "=", "None", ")", ":", "if", "sympy_accesses", "is", "None", ":", "sympy_accesses", "=", "self", ".", "compile_sympy_accesses", "(", ")", "sympy_distances", "=", "defaultdict", "(", "list", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.global_iterator_to_indices
Return sympy expressions translating global_iterator to loop indices. If global_iterator is given, an integer is returned
kerncraft/kernel.py
def global_iterator_to_indices(self, git=None): """ Return sympy expressions translating global_iterator to loop indices. If global_iterator is given, an integer is returned """ # unwind global iteration count into loop counters: base_loop_counters = {} global_it...
def global_iterator_to_indices(self, git=None): """ Return sympy expressions translating global_iterator to loop indices. If global_iterator is given, an integer is returned """ # unwind global iteration count into loop counters: base_loop_counters = {} global_it...
[ "Return", "sympy", "expressions", "translating", "global_iterator", "to", "loop", "indices", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L419-L451
[ "def", "global_iterator_to_indices", "(", "self", ",", "git", "=", "None", ")", ":", "# unwind global iteration count into loop counters:", "base_loop_counters", "=", "{", "}", "global_iterator", "=", "symbol_pos_int", "(", "'global_iterator'", ")", "idiv", "=", "implem...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.global_iterator
Return global iterator sympy expression
kerncraft/kernel.py
def global_iterator(self): """ Return global iterator sympy expression """ global_iterator = sympy.Integer(0) total_length = sympy.Integer(1) for var_name, start, end, incr in reversed(self._loop_stack): loop_var = symbol_pos_int(var_name) length =...
def global_iterator(self): """ Return global iterator sympy expression """ global_iterator = sympy.Integer(0) total_length = sympy.Integer(1) for var_name, start, end, incr in reversed(self._loop_stack): loop_var = symbol_pos_int(var_name) length =...
[ "Return", "global", "iterator", "sympy", "expression" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L454-L465
[ "def", "global_iterator", "(", "self", ")", ":", "global_iterator", "=", "sympy", ".", "Integer", "(", "0", ")", "total_length", "=", "sympy", ".", "Integer", "(", "1", ")", "for", "var_name", ",", "start", ",", "end", ",", "incr", "in", "reversed", "(...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.indices_to_global_iterator
Transform a dictionary of indices to a global iterator integer. Inverse of global_iterator_to_indices().
kerncraft/kernel.py
def indices_to_global_iterator(self, indices): """ Transform a dictionary of indices to a global iterator integer. Inverse of global_iterator_to_indices(). """ global_iterator = self.subs_consts(self.global_iterator().subs(indices)) return global_iterator
def indices_to_global_iterator(self, indices): """ Transform a dictionary of indices to a global iterator integer. Inverse of global_iterator_to_indices(). """ global_iterator = self.subs_consts(self.global_iterator().subs(indices)) return global_iterator
[ "Transform", "a", "dictionary", "of", "indices", "to", "a", "global", "iterator", "integer", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L467-L474
[ "def", "indices_to_global_iterator", "(", "self", ",", "indices", ")", ":", "global_iterator", "=", "self", ".", "subs_consts", "(", "self", ".", "global_iterator", "(", ")", ".", "subs", "(", "indices", ")", ")", "return", "global_iterator" ]
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.max_global_iteration
Return global iterator with last iteration number
kerncraft/kernel.py
def max_global_iteration(self): """Return global iterator with last iteration number""" return self.indices_to_global_iterator({ symbol_pos_int(var_name): end-1 for var_name, start, end, incr in self._loop_stack })
def max_global_iteration(self): """Return global iterator with last iteration number""" return self.indices_to_global_iterator({ symbol_pos_int(var_name): end-1 for var_name, start, end, incr in self._loop_stack })
[ "Return", "global", "iterator", "with", "last", "iteration", "number" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L476-L480
[ "def", "max_global_iteration", "(", "self", ")", ":", "return", "self", ".", "indices_to_global_iterator", "(", "{", "symbol_pos_int", "(", "var_name", ")", ":", "end", "-", "1", "for", "var_name", ",", "start", ",", "end", ",", "incr", "in", "self", ".", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.compile_global_offsets
Return load and store offsets on a virtual address space. :param iteration: controls the inner index counter :param spacing: sets a spacing between the arrays, default is 0 All array variables (non scalars) are laid out linearly starting from 0. An optional spacing can be set. The acce...
kerncraft/kernel.py
def compile_global_offsets(self, iteration=0, spacing=0): """ Return load and store offsets on a virtual address space. :param iteration: controls the inner index counter :param spacing: sets a spacing between the arrays, default is 0 All array variables (non scalars) are laid ...
def compile_global_offsets(self, iteration=0, spacing=0): """ Return load and store offsets on a virtual address space. :param iteration: controls the inner index counter :param spacing: sets a spacing between the arrays, default is 0 All array variables (non scalars) are laid ...
[ "Return", "load", "and", "store", "offsets", "on", "a", "virtual", "address", "space", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L482-L589
[ "def", "compile_global_offsets", "(", "self", ",", "iteration", "=", "0", ",", "spacing", "=", "0", ")", ":", "global_load_offsets", "=", "[", "]", "global_store_offsets", "=", "[", "]", "if", "isinstance", "(", "iteration", ",", "range", ")", ":", "iterat...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.bytes_per_iteration
Consecutive bytes written out per high-level iterations (as counted by loop stack). Is used to compute number of iterations per cacheline.
kerncraft/kernel.py
def bytes_per_iteration(self): """ Consecutive bytes written out per high-level iterations (as counted by loop stack). Is used to compute number of iterations per cacheline. """ # TODO Find longst consecutive writes to any variable and use as basis var_name = list(self.d...
def bytes_per_iteration(self): """ Consecutive bytes written out per high-level iterations (as counted by loop stack). Is used to compute number of iterations per cacheline. """ # TODO Find longst consecutive writes to any variable and use as basis var_name = list(self.d...
[ "Consecutive", "bytes", "written", "out", "per", "high", "-", "level", "iterations", "(", "as", "counted", "by", "loop", "stack", ")", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L592-L603
[ "def", "bytes_per_iteration", "(", "self", ")", ":", "# TODO Find longst consecutive writes to any variable and use as basis", "var_name", "=", "list", "(", "self", ".", "destinations", ")", "[", "0", "]", "var_type", "=", "self", ".", "variables", "[", "var_name", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.print_kernel_info
Print kernel information in human readble format.
kerncraft/kernel.py
def print_kernel_info(self, output_file=sys.stdout): """Print kernel information in human readble format.""" table = (' idx | min max step\n' + '---------+---------------------------------\n') for l in self._loop_stack: table += '{:>8} | {!r:>...
def print_kernel_info(self, output_file=sys.stdout): """Print kernel information in human readble format.""" table = (' idx | min max step\n' + '---------+---------------------------------\n') for l in self._loop_stack: table += '{:>8} | {!r:>...
[ "Print", "kernel", "information", "in", "human", "readble", "format", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L605-L635
[ "def", "print_kernel_info", "(", "self", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "table", "=", "(", "' idx | min max step\\n'", "+", "'---------+---------------------------------\\n'", ")", "for", "l", "in", "self", ".", "_loop...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.print_variables_info
Print variables information in human readble format.
kerncraft/kernel.py
def print_variables_info(self, output_file=sys.stdout): """Print variables information in human readble format.""" table = (' name | type size \n' + '---------+-------------------------\n') for name, var_info in list(self.variables.items()): table +=...
def print_variables_info(self, output_file=sys.stdout): """Print variables information in human readble format.""" table = (' name | type size \n' + '---------+-------------------------\n') for name, var_info in list(self.variables.items()): table +=...
[ "Print", "variables", "information", "in", "human", "readble", "format", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L637-L643
[ "def", "print_variables_info", "(", "self", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "table", "=", "(", "' name | type size \\n'", "+", "'---------+-------------------------\\n'", ")", "for", "name", ",", "var_info", "in", "list", "(...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Kernel.print_constants_info
Print constants information in human readble format.
kerncraft/kernel.py
def print_constants_info(self, output_file=sys.stdout): """Print constants information in human readble format.""" table = (' name | value \n' + '---------+-----------\n') for name, value in list(self.constants.items()): table += '{!s:>8} | {:<10}\n'.format(na...
def print_constants_info(self, output_file=sys.stdout): """Print constants information in human readble format.""" table = (' name | value \n' + '---------+-----------\n') for name, value in list(self.constants.items()): table += '{!s:>8} | {:<10}\n'.format(na...
[ "Print", "constants", "information", "in", "human", "readble", "format", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L645-L651
[ "def", "print_constants_info", "(", "self", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "table", "=", "(", "' name | value \\n'", "+", "'---------+-----------\\n'", ")", "for", "name", ",", "value", "in", "list", "(", "self", ".", "constant...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._get_intermediate_file
Create or open intermediate file (may be used for caching). Will replace files older than kernel file, machine file or kerncraft version. :param machine_and_compiler_dependent: set to False if file content does not depend on machine file or compiler setti...
kerncraft/kernel.py
def _get_intermediate_file(self, name, machine_and_compiler_dependent=True, binary=False, fp=True): """ Create or open intermediate file (may be used for caching). Will replace files older than kernel file, machine file or kerncraft version. :param machin...
def _get_intermediate_file(self, name, machine_and_compiler_dependent=True, binary=False, fp=True): """ Create or open intermediate file (may be used for caching). Will replace files older than kernel file, machine file or kerncraft version. :param machin...
[ "Create", "or", "open", "intermediate", "file", "(", "may", "be", "used", "for", "caching", ")", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L701-L760
[ "def", "_get_intermediate_file", "(", "self", ",", "name", ",", "machine_and_compiler_dependent", "=", "True", ",", "binary", "=", "False", ",", "fp", "=", "True", ")", ":", "if", "self", ".", "_filename", ":", "base_name", "=", "os", ".", "path", ".", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.print_kernel_code
Print source code of kernel.
kerncraft/kernel.py
def print_kernel_code(self, output_file=sys.stdout): """Print source code of kernel.""" print(self.kernel_code, file=output_file)
def print_kernel_code(self, output_file=sys.stdout): """Print source code of kernel.""" print(self.kernel_code, file=output_file)
[ "Print", "source", "code", "of", "kernel", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L772-L774
[ "def", "print_kernel_code", "(", "self", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "print", "(", "self", ".", "kernel_code", ",", "file", "=", "output_file", ")" ]
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.conv_ast_to_sym
Convert mathematical expressions to a sympy representation. May only contain paranthesis, addition, subtraction and multiplication from AST.
kerncraft/kernel.py
def conv_ast_to_sym(self, math_ast): """ Convert mathematical expressions to a sympy representation. May only contain paranthesis, addition, subtraction and multiplication from AST. """ if type(math_ast) is c_ast.ID: return symbol_pos_int(math_ast.name) elif ...
def conv_ast_to_sym(self, math_ast): """ Convert mathematical expressions to a sympy representation. May only contain paranthesis, addition, subtraction and multiplication from AST. """ if type(math_ast) is c_ast.ID: return symbol_pos_int(math_ast.name) elif ...
[ "Convert", "mathematical", "expressions", "to", "a", "sympy", "representation", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L852-L871
[ "def", "conv_ast_to_sym", "(", "self", ",", "math_ast", ")", ":", "if", "type", "(", "math_ast", ")", "is", "c_ast", ".", "ID", ":", "return", "symbol_pos_int", "(", "math_ast", ".", "name", ")", "elif", "type", "(", "math_ast", ")", "is", "c_ast", "."...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._get_offsets
Return a tuple of offsets of an ArrayRef object in all dimensions. The index order is right to left (c-code order). e.g. c[i+1][j-2] -> (-2, +1) If aref is actually a c_ast.ID, None will be returned.
kerncraft/kernel.py
def _get_offsets(self, aref, dim=0): """ Return a tuple of offsets of an ArrayRef object in all dimensions. The index order is right to left (c-code order). e.g. c[i+1][j-2] -> (-2, +1) If aref is actually a c_ast.ID, None will be returned. """ if isinstance(are...
def _get_offsets(self, aref, dim=0): """ Return a tuple of offsets of an ArrayRef object in all dimensions. The index order is right to left (c-code order). e.g. c[i+1][j-2] -> (-2, +1) If aref is actually a c_ast.ID, None will be returned. """ if isinstance(are...
[ "Return", "a", "tuple", "of", "offsets", "of", "an", "ArrayRef", "object", "in", "all", "dimensions", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L873-L902
[ "def", "_get_offsets", "(", "self", ",", "aref", ",", "dim", "=", "0", ")", ":", "if", "isinstance", "(", "aref", ",", "c_ast", ".", "ID", ")", ":", "return", "None", "# Check for restrictions", "assert", "type", "(", "aref", ".", "name", ")", "in", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._get_basename
Return base name of ArrayRef object. e.g. c[i+1][j-2] -> 'c'
kerncraft/kernel.py
def _get_basename(cls, aref): """ Return base name of ArrayRef object. e.g. c[i+1][j-2] -> 'c' """ if isinstance(aref.name, c_ast.ArrayRef): return cls._get_basename(aref.name) elif isinstance(aref.name, str): return aref.name else: ...
def _get_basename(cls, aref): """ Return base name of ArrayRef object. e.g. c[i+1][j-2] -> 'c' """ if isinstance(aref.name, c_ast.ArrayRef): return cls._get_basename(aref.name) elif isinstance(aref.name, str): return aref.name else: ...
[ "Return", "base", "name", "of", "ArrayRef", "object", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L905-L916
[ "def", "_get_basename", "(", "cls", ",", "aref", ")", ":", "if", "isinstance", "(", "aref", ".", "name", ",", "c_ast", ".", "ArrayRef", ")", ":", "return", "cls", ".", "_get_basename", "(", "aref", ".", "name", ")", "elif", "isinstance", "(", "aref", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.get_index_type
Return index type used in loop nest. If index type between loops differ, an exception is raised.
kerncraft/kernel.py
def get_index_type(self, loop_nest=None): """ Return index type used in loop nest. If index type between loops differ, an exception is raised. """ if loop_nest is None: loop_nest = self.get_kernel_loop_nest() if type(loop_nest) is c_ast.For: loop_...
def get_index_type(self, loop_nest=None): """ Return index type used in loop nest. If index type between loops differ, an exception is raised. """ if loop_nest is None: loop_nest = self.get_kernel_loop_nest() if type(loop_nest) is c_ast.For: loop_...
[ "Return", "index", "type", "used", "in", "loop", "nest", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1051-L1073
[ "def", "get_index_type", "(", "self", ",", "loop_nest", "=", "None", ")", ":", "if", "loop_nest", "is", "None", ":", "loop_nest", "=", "self", ".", "get_kernel_loop_nest", "(", ")", "if", "type", "(", "loop_nest", ")", "is", "c_ast", ".", "For", ":", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_const_declartions
Generate constants declarations :return: list of declarations
kerncraft/kernel.py
def _build_const_declartions(self, with_init=True): """ Generate constants declarations :return: list of declarations """ decls = [] # Use type as provided by user in loop indices index_type = self.get_index_type() i = 2 # subscript for cli input, 1 is...
def _build_const_declartions(self, with_init=True): """ Generate constants declarations :return: list of declarations """ decls = [] # Use type as provided by user in loop indices index_type = self.get_index_type() i = 2 # subscript for cli input, 1 is...
[ "Generate", "constants", "declarations" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1075-L1103
[ "def", "_build_const_declartions", "(", "self", ",", "with_init", "=", "True", ")", ":", "decls", "=", "[", "]", "# Use type as provided by user in loop indices", "index_type", "=", "self", ".", "get_index_type", "(", ")", "i", "=", "2", "# subscript for cli input, ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.get_array_declarations
Return array declarations.
kerncraft/kernel.py
def get_array_declarations(self): """Return array declarations.""" return [d for d in self.kernel_ast.block_items if type(d) is c_ast.Decl and type(d.type) is c_ast.ArrayDecl]
def get_array_declarations(self): """Return array declarations.""" return [d for d in self.kernel_ast.block_items if type(d) is c_ast.Decl and type(d.type) is c_ast.ArrayDecl]
[ "Return", "array", "declarations", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1105-L1108
[ "def", "get_array_declarations", "(", "self", ")", ":", "return", "[", "d", "for", "d", "in", "self", ".", "kernel_ast", ".", "block_items", "if", "type", "(", "d", ")", "is", "c_ast", ".", "Decl", "and", "type", "(", "d", ".", "type", ")", "is", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.get_kernel_loop_nest
Return kernel loop nest including any preceding pragmas and following swaps.
kerncraft/kernel.py
def get_kernel_loop_nest(self): """Return kernel loop nest including any preceding pragmas and following swaps.""" loop_nest = [s for s in self.kernel_ast.block_items if type(s) in [c_ast.For, c_ast.Pragma, c_ast.FuncCall]] assert len(loop_nest) >= 1, "Found to few for state...
def get_kernel_loop_nest(self): """Return kernel loop nest including any preceding pragmas and following swaps.""" loop_nest = [s for s in self.kernel_ast.block_items if type(s) in [c_ast.For, c_ast.Pragma, c_ast.FuncCall]] assert len(loop_nest) >= 1, "Found to few for state...
[ "Return", "kernel", "loop", "nest", "including", "any", "preceding", "pragmas", "and", "following", "swaps", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1110-L1115
[ "def", "get_kernel_loop_nest", "(", "self", ")", ":", "loop_nest", "=", "[", "s", "for", "s", "in", "self", ".", "kernel_ast", ".", "block_items", "if", "type", "(", "s", ")", "in", "[", "c_ast", ".", "For", ",", "c_ast", ".", "Pragma", ",", "c_ast",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_array_declarations
Generate declaration statements for arrays. Also transforming multi-dim to 1d arrays and initializing with malloc. :param with_init: ommit malloc initialization :return: list of declarations nodes, dictionary of array names and original dimensions
kerncraft/kernel.py
def _build_array_declarations(self, with_init=True): """ Generate declaration statements for arrays. Also transforming multi-dim to 1d arrays and initializing with malloc. :param with_init: ommit malloc initialization :return: list of declarations nodes, dictionary of array na...
def _build_array_declarations(self, with_init=True): """ Generate declaration statements for arrays. Also transforming multi-dim to 1d arrays and initializing with malloc. :param with_init: ommit malloc initialization :return: list of declarations nodes, dictionary of array na...
[ "Generate", "declaration", "statements", "for", "arrays", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1117-L1134
[ "def", "_build_array_declarations", "(", "self", ",", "with_init", "=", "True", ")", ":", "# copy array declarations from from kernel ast", "array_declarations", "=", "deepcopy", "(", "self", ".", "get_array_declarations", "(", ")", ")", "array_dict", "=", "[", "]", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._find_inner_most_loop
Return inner most for loop in loop nest
kerncraft/kernel.py
def _find_inner_most_loop(self, loop_nest): """Return inner most for loop in loop nest""" r = None for s in loop_nest: if type(s) is c_ast.For: return self._find_inner_most_loop(s) or s else: r = r or self._find_inner_most_loop(s) r...
def _find_inner_most_loop(self, loop_nest): """Return inner most for loop in loop nest""" r = None for s in loop_nest: if type(s) is c_ast.For: return self._find_inner_most_loop(s) or s else: r = r or self._find_inner_most_loop(s) r...
[ "Return", "inner", "most", "for", "loop", "in", "loop", "nest" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1136-L1144
[ "def", "_find_inner_most_loop", "(", "self", ",", "loop_nest", ")", ":", "r", "=", "None", "for", "s", "in", "loop_nest", ":", "if", "type", "(", "s", ")", "is", "c_ast", ".", "For", ":", "return", "self", ".", "_find_inner_most_loop", "(", "s", ")", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_array_initializations
Generate initialization statements for arrays. :param array_dimensions: dictionary of array dimensions :return: list of nodes
kerncraft/kernel.py
def _build_array_initializations(self, array_dimensions): """ Generate initialization statements for arrays. :param array_dimensions: dictionary of array dimensions :return: list of nodes """ kernel = deepcopy(deepcopy(self.get_kernel_loop_nest())) # traverse to...
def _build_array_initializations(self, array_dimensions): """ Generate initialization statements for arrays. :param array_dimensions: dictionary of array dimensions :return: list of nodes """ kernel = deepcopy(deepcopy(self.get_kernel_loop_nest())) # traverse to...
[ "Generate", "initialization", "statements", "for", "arrays", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1146-L1170
[ "def", "_build_array_initializations", "(", "self", ",", "array_dimensions", ")", ":", "kernel", "=", "deepcopy", "(", "deepcopy", "(", "self", ".", "get_kernel_loop_nest", "(", ")", ")", ")", "# traverse to the inner most for loop:", "inner_most", "=", "self", ".",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_dummy_calls
Generate false if branch with dummy calls Requires kerncraft.h to be included, which defines dummy(...) and var_false. :return: dummy statement
kerncraft/kernel.py
def _build_dummy_calls(self): """ Generate false if branch with dummy calls Requires kerncraft.h to be included, which defines dummy(...) and var_false. :return: dummy statement """ # Make sure nothing gets removed by inserting dummy calls dummy_calls = [] ...
def _build_dummy_calls(self): """ Generate false if branch with dummy calls Requires kerncraft.h to be included, which defines dummy(...) and var_false. :return: dummy statement """ # Make sure nothing gets removed by inserting dummy calls dummy_calls = [] ...
[ "Generate", "false", "if", "branch", "with", "dummy", "calls" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1172-L1197
[ "def", "_build_dummy_calls", "(", "self", ")", ":", "# Make sure nothing gets removed by inserting dummy calls", "dummy_calls", "=", "[", "]", "for", "d", "in", "self", ".", "kernel_ast", ".", "block_items", ":", "# Only consider toplevel declarations from kernel ast", "if"...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_kernel_function_declaration
Build and return kernel function declaration
kerncraft/kernel.py
def _build_kernel_function_declaration(self, name='kernel'): """Build and return kernel function declaration""" array_declarations, array_dimensions = self._build_array_declarations(with_init=False) scalar_declarations = self._build_scalar_declarations(with_init=False) const_declarations...
def _build_kernel_function_declaration(self, name='kernel'): """Build and return kernel function declaration""" array_declarations, array_dimensions = self._build_array_declarations(with_init=False) scalar_declarations = self._build_scalar_declarations(with_init=False) const_declarations...
[ "Build", "and", "return", "kernel", "function", "declaration" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1199-L1208
[ "def", "_build_kernel_function_declaration", "(", "self", ",", "name", "=", "'kernel'", ")", ":", "array_declarations", ",", "array_dimensions", "=", "self", ".", "_build_array_declarations", "(", "with_init", "=", "False", ")", "scalar_declarations", "=", "self", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_scalar_declarations
Build and return scalar variable declarations
kerncraft/kernel.py
def _build_scalar_declarations(self, with_init=True): """Build and return scalar variable declarations""" # copy scalar declarations from from kernel ast scalar_declarations = [deepcopy(d) for d in self.kernel_ast.block_items if type(d) is c_ast.Decl and type(d.typ...
def _build_scalar_declarations(self, with_init=True): """Build and return scalar variable declarations""" # copy scalar declarations from from kernel ast scalar_declarations = [deepcopy(d) for d in self.kernel_ast.block_items if type(d) is c_ast.Decl and type(d.typ...
[ "Build", "and", "return", "scalar", "variable", "declarations" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1210-L1225
[ "def", "_build_scalar_declarations", "(", "self", ",", "with_init", "=", "True", ")", ":", "# copy scalar declarations from from kernel ast", "scalar_declarations", "=", "[", "deepcopy", "(", "d", ")", "for", "d", "in", "self", ".", "kernel_ast", ".", "block_items",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.get_kernel_code
Generate and return compilable source code with kernel function from AST. :param openmp: if true, OpenMP code will be generated :param as_filename: if true, will save to file and return filename :param name: name of kernel function
kerncraft/kernel.py
def get_kernel_code(self, openmp=False, as_filename=False, name='kernel'): """ Generate and return compilable source code with kernel function from AST. :param openmp: if true, OpenMP code will be generated :param as_filename: if true, will save to file and return filename :para...
def get_kernel_code(self, openmp=False, as_filename=False, name='kernel'): """ Generate and return compilable source code with kernel function from AST. :param openmp: if true, OpenMP code will be generated :param as_filename: if true, will save to file and return filename :para...
[ "Generate", "and", "return", "compilable", "source", "code", "with", "kernel", "function", "from", "AST", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1228-L1294
[ "def", "get_kernel_code", "(", "self", ",", "openmp", "=", "False", ",", "as_filename", "=", "False", ",", "name", "=", "'kernel'", ")", ":", "assert", "self", ".", "kernel_ast", "is", "not", "None", ",", "\"AST does not exist, this could be due to running \"", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode._build_kernel_call
Generate and return kernel call ast.
kerncraft/kernel.py
def _build_kernel_call(self, name='kernel'): """Generate and return kernel call ast.""" return c_ast.FuncCall(name=c_ast.ID(name=name), args=c_ast.ExprList(exprs=[ c_ast.ID(name=d.name) for d in ( self._build_array_declarations()[0] + self._build_scala...
def _build_kernel_call(self, name='kernel'): """Generate and return kernel call ast.""" return c_ast.FuncCall(name=c_ast.ID(name=name), args=c_ast.ExprList(exprs=[ c_ast.ID(name=d.name) for d in ( self._build_array_declarations()[0] + self._build_scala...
[ "Generate", "and", "return", "kernel", "call", "ast", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1296-L1302
[ "def", "_build_kernel_call", "(", "self", ",", "name", "=", "'kernel'", ")", ":", "return", "c_ast", ".", "FuncCall", "(", "name", "=", "c_ast", ".", "ID", "(", "name", "=", "name", ")", ",", "args", "=", "c_ast", ".", "ExprList", "(", "exprs", "=", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.get_main_code
Generate and return compilable source code from AST.
kerncraft/kernel.py
def get_main_code(self, as_filename=False, kernel_function_name='kernel'): """ Generate and return compilable source code from AST. """ # TODO produce nicer code, including help text and other "comfort features". assert self.kernel_ast is not None, "AST does not exist, this could...
def get_main_code(self, as_filename=False, kernel_function_name='kernel'): """ Generate and return compilable source code from AST. """ # TODO produce nicer code, including help text and other "comfort features". assert self.kernel_ast is not None, "AST does not exist, this could...
[ "Generate", "and", "return", "compilable", "source", "code", "from", "AST", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1351-L1409
[ "def", "get_main_code", "(", "self", ",", "as_filename", "=", "False", ",", "kernel_function_name", "=", "'kernel'", ")", ":", "# TODO produce nicer code, including help text and other \"comfort features\".", "assert", "self", ".", "kernel_ast", "is", "not", "None", ",", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.assemble_to_object
Assemble *in_filename* assembly into *out_filename* object. If *iaca_marked* is set to true, markers are inserted around the block with most packed instructions or (if no packed instr. were found) the largest block and modified file is saved to *in_file*. *asm_block* controls how the t...
kerncraft/kernel.py
def assemble_to_object(self, in_filename, verbose=False): """ Assemble *in_filename* assembly into *out_filename* object. If *iaca_marked* is set to true, markers are inserted around the block with most packed instructions or (if no packed instr. were found) the largest block and modifi...
def assemble_to_object(self, in_filename, verbose=False): """ Assemble *in_filename* assembly into *out_filename* object. If *iaca_marked* is set to true, markers are inserted around the block with most packed instructions or (if no packed instr. were found) the largest block and modifi...
[ "Assemble", "*", "in_filename", "*", "assembly", "into", "*", "out_filename", "*", "object", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1411-L1456
[ "def", "assemble_to_object", "(", "self", ",", "in_filename", ",", "verbose", "=", "False", ")", ":", "# Build file name", "file_base_name", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "in_filename", ")", ")", "["...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.compile_kernel
Compile source (from as_code(type_)) to assembly or object and return (fileptr, filename). Output can be used with Kernel.assemble()
kerncraft/kernel.py
def compile_kernel(self, openmp=False, assembly=False, verbose=False): """ Compile source (from as_code(type_)) to assembly or object and return (fileptr, filename). Output can be used with Kernel.assemble() """ compiler, compiler_args = self._machine.get_compiler() in_...
def compile_kernel(self, openmp=False, assembly=False, verbose=False): """ Compile source (from as_code(type_)) to assembly or object and return (fileptr, filename). Output can be used with Kernel.assemble() """ compiler, compiler_args = self._machine.get_compiler() in_...
[ "Compile", "source", "(", "from", "as_code", "(", "type_", "))", "to", "assembly", "or", "object", "and", "return", "(", "fileptr", "filename", ")", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1458-L1512
[ "def", "compile_kernel", "(", "self", ",", "openmp", "=", "False", ",", "assembly", "=", "False", ",", "verbose", "=", "False", ")", ":", "compiler", ",", "compiler_args", "=", "self", ".", "_machine", ".", "get_compiler", "(", ")", "in_filename", "=", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.iaca_analysis
Run an IACA analysis and return its outcome. *asm_block* controls how the to-be-marked block is chosen. "auto" (default) results in the largest block, "manual" results in interactive and a number in the according block. *pointer_increment* is the number of bytes the pointer is incremented afte...
kerncraft/kernel.py
def iaca_analysis(self, micro_architecture, asm_block='auto', pointer_increment='auto_with_manual_fallback', verbose=False): """ Run an IACA analysis and return its outcome. *asm_block* controls how the to-be-marked block is chosen. "auto" (default) results in the ...
def iaca_analysis(self, micro_architecture, asm_block='auto', pointer_increment='auto_with_manual_fallback', verbose=False): """ Run an IACA analysis and return its outcome. *asm_block* controls how the to-be-marked block is chosen. "auto" (default) results in the ...
[ "Run", "an", "IACA", "analysis", "and", "return", "its", "outcome", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1514-L1535
[ "def", "iaca_analysis", "(", "self", ",", "micro_architecture", ",", "asm_block", "=", "'auto'", ",", "pointer_increment", "=", "'auto_with_manual_fallback'", ",", "verbose", "=", "False", ")", ":", "asm_filename", "=", "self", ".", "compile_kernel", "(", "assembl...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelCode.build_executable
Compile source to executable with likwid capabilities and return the executable name.
kerncraft/kernel.py
def build_executable(self, lflags=None, verbose=False, openmp=False): """Compile source to executable with likwid capabilities and return the executable name.""" compiler, compiler_args = self._machine.get_compiler() kernel_obj_filename = self.compile_kernel(openmp=openmp, verbose=verbose) ...
def build_executable(self, lflags=None, verbose=False, openmp=False): """Compile source to executable with likwid capabilities and return the executable name.""" compiler, compiler_args = self._machine.get_compiler() kernel_obj_filename = self.compile_kernel(openmp=openmp, verbose=verbose) ...
[ "Compile", "source", "to", "executable", "with", "likwid", "capabilities", "and", "return", "the", "executable", "name", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1537-L1590
[ "def", "build_executable", "(", "self", ",", "lflags", "=", "None", ",", "verbose", "=", "False", ",", "openmp", "=", "False", ")", ":", "compiler", ",", "compiler_args", "=", "self", ".", "_machine", ".", "get_compiler", "(", ")", "kernel_obj_filename", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
KernelDescription.string_to_sympy
Convert any string to a sympy object or None.
kerncraft/kernel.py
def string_to_sympy(cls, s): """Convert any string to a sympy object or None.""" if isinstance(s, int): return sympy.Integer(s) elif isinstance(s, list): return tuple([cls.string_to_sympy(e) for e in s]) elif s is None: return None else: ...
def string_to_sympy(cls, s): """Convert any string to a sympy object or None.""" if isinstance(s, int): return sympy.Integer(s) elif isinstance(s, list): return tuple([cls.string_to_sympy(e) for e in s]) elif s is None: return None else: ...
[ "Convert", "any", "string", "to", "a", "sympy", "object", "or", "None", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1648-L1664
[ "def", "string_to_sympy", "(", "cls", ",", "s", ")", ":", "if", "isinstance", "(", "s", ",", "int", ")", ":", "return", "sympy", ".", "Integer", "(", "s", ")", "elif", "isinstance", "(", "s", ",", "list", ")", ":", "return", "tuple", "(", "[", "c...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.get_identifier
Return identifier which is either the machine file name or sha256 checksum of data.
kerncraft/machinemodel.py
def get_identifier(self): """Return identifier which is either the machine file name or sha256 checksum of data.""" if self._path: return os.path.basename(self._path) else: return hashlib.sha256(hashlib.sha256(repr(self._data).encode())).hexdigest()
def get_identifier(self): """Return identifier which is either the machine file name or sha256 checksum of data.""" if self._path: return os.path.basename(self._path) else: return hashlib.sha256(hashlib.sha256(repr(self._data).encode())).hexdigest()
[ "Return", "identifier", "which", "is", "either", "the", "machine", "file", "name", "or", "sha256", "checksum", "of", "data", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L92-L97
[ "def", "get_identifier", "(", "self", ")", ":", "if", "self", ".", "_path", ":", "return", "os", ".", "path", ".", "basename", "(", "self", ".", "_path", ")", "else", ":", "return", "hashlib", ".", "sha256", "(", "hashlib", ".", "sha256", "(", "repr"...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.get_last_modified_datetime
Return datetime object of modified time of machine file. Return now if not a file.
kerncraft/machinemodel.py
def get_last_modified_datetime(self): """Return datetime object of modified time of machine file. Return now if not a file.""" if self._path: statbuf = os.stat(self._path) return datetime.utcfromtimestamp(statbuf.st_mtime) else: return datetime.now()
def get_last_modified_datetime(self): """Return datetime object of modified time of machine file. Return now if not a file.""" if self._path: statbuf = os.stat(self._path) return datetime.utcfromtimestamp(statbuf.st_mtime) else: return datetime.now()
[ "Return", "datetime", "object", "of", "modified", "time", "of", "machine", "file", ".", "Return", "now", "if", "not", "a", "file", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L99-L105
[ "def", "get_last_modified_datetime", "(", "self", ")", ":", "if", "self", ".", "_path", ":", "statbuf", "=", "os", ".", "stat", "(", "self", ".", "_path", ")", "return", "datetime", ".", "utcfromtimestamp", "(", "statbuf", ".", "st_mtime", ")", "else", "...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.get_cachesim
Return a cachesim.CacheSimulator object based on the machine description. :param cores: core count (default: 1)
kerncraft/machinemodel.py
def get_cachesim(self, cores=1): """ Return a cachesim.CacheSimulator object based on the machine description. :param cores: core count (default: 1) """ cache_dict = {} for c in self['memory hierarchy']: # Skip main memory if 'cache per group' not...
def get_cachesim(self, cores=1): """ Return a cachesim.CacheSimulator object based on the machine description. :param cores: core count (default: 1) """ cache_dict = {} for c in self['memory hierarchy']: # Skip main memory if 'cache per group' not...
[ "Return", "a", "cachesim", ".", "CacheSimulator", "object", "based", "on", "the", "machine", "description", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L107-L125
[ "def", "get_cachesim", "(", "self", ",", "cores", "=", "1", ")", ":", "cache_dict", "=", "{", "}", "for", "c", "in", "self", "[", "'memory hierarchy'", "]", ":", "# Skip main memory", "if", "'cache per group'", "not", "in", "c", ":", "continue", "cache_dic...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.get_bandwidth
Return best fitting bandwidth according to number of threads, read and write streams. :param cache_level: integer of cache (0 is L1, 1 is L2 ...) :param read_streams: number of read streams expected :param write_streams: number of write streams expected :param threads_per_core: number o...
kerncraft/machinemodel.py
def get_bandwidth(self, cache_level, read_streams, write_streams, threads_per_core, cores=None): """ Return best fitting bandwidth according to number of threads, read and write streams. :param cache_level: integer of cache (0 is L1, 1 is L2 ...) :param read_streams: number of read stre...
def get_bandwidth(self, cache_level, read_streams, write_streams, threads_per_core, cores=None): """ Return best fitting bandwidth according to number of threads, read and write streams. :param cache_level: integer of cache (0 is L1, 1 is L2 ...) :param read_streams: number of read stre...
[ "Return", "best", "fitting", "bandwidth", "according", "to", "number", "of", "threads", "read", "and", "write", "streams", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L127-L191
[ "def", "get_bandwidth", "(", "self", ",", "cache_level", ",", "read_streams", ",", "write_streams", ",", "threads_per_core", ",", "cores", "=", "None", ")", ":", "# try to find best fitting kernel (closest to read/write ratio):", "# write allocate has to be handled in kernel in...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.get_compiler
Return tuple of compiler and compiler flags. Selects compiler and flags from machine description file, commandline arguments or call arguements.
kerncraft/machinemodel.py
def get_compiler(self, compiler=None, flags=None): """ Return tuple of compiler and compiler flags. Selects compiler and flags from machine description file, commandline arguments or call arguements. """ if self._args: compiler = compiler or self._args.compil...
def get_compiler(self, compiler=None, flags=None): """ Return tuple of compiler and compiler flags. Selects compiler and flags from machine description file, commandline arguments or call arguements. """ if self._args: compiler = compiler or self._args.compil...
[ "Return", "tuple", "of", "compiler", "and", "compiler", "flags", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L193-L218
[ "def", "get_compiler", "(", "self", ",", "compiler", "=", "None", ",", "flags", "=", "None", ")", ":", "if", "self", ".", "_args", ":", "compiler", "=", "compiler", "or", "self", ".", "_args", ".", "compiler", "flags", "=", "flags", "or", "self", "."...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.parse_perfctr_event
Parse events in machine description to tuple representation used in Benchmark module. Examples: >>> parse_perfctr_event('PERF_EVENT:REG[0-3]') ('PERF_EVENT', 'REG[0-3]') >>> parse_perfctr_event('PERF_EVENT:REG[0-3]:STAY:FOO=23:BAR=0x23') ('PERF_EVENT', 'REG[0-3]', {'STAY': None,...
kerncraft/machinemodel.py
def parse_perfctr_event(perfctr): """ Parse events in machine description to tuple representation used in Benchmark module. Examples: >>> parse_perfctr_event('PERF_EVENT:REG[0-3]') ('PERF_EVENT', 'REG[0-3]') >>> parse_perfctr_event('PERF_EVENT:REG[0-3]:STAY:FOO=23:BAR=0x...
def parse_perfctr_event(perfctr): """ Parse events in machine description to tuple representation used in Benchmark module. Examples: >>> parse_perfctr_event('PERF_EVENT:REG[0-3]') ('PERF_EVENT', 'REG[0-3]') >>> parse_perfctr_event('PERF_EVENT:REG[0-3]:STAY:FOO=23:BAR=0x...
[ "Parse", "events", "in", "machine", "description", "to", "tuple", "representation", "used", "in", "Benchmark", "module", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L221-L246
[ "def", "parse_perfctr_event", "(", "perfctr", ")", ":", "split_perfctr", "=", "perfctr", ".", "split", "(", "':'", ")", "assert", "len", "(", "split_perfctr", ")", ">=", "2", ",", "\"Atleast one colon (:) is required in the event name\"", "event_tuple", "=", "split_...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
MachineModel.parse_perfmetric
Return (sympy expressions, event names and symbols dict) from performance metric str.
kerncraft/machinemodel.py
def parse_perfmetric(metric): """Return (sympy expressions, event names and symbols dict) from performance metric str.""" # Find all perfs counter references perfcounters = re.findall(r'[A-Z0-9_]+:[A-Z0-9\[\]|\-]+(?::[A-Za-z0-9\-_=]+)*', metric) # Build a temporary metric, with parser-f...
def parse_perfmetric(metric): """Return (sympy expressions, event names and symbols dict) from performance metric str.""" # Find all perfs counter references perfcounters = re.findall(r'[A-Z0-9_]+:[A-Z0-9\[\]|\-]+(?::[A-Za-z0-9\-_=]+)*', metric) # Build a temporary metric, with parser-f...
[ "Return", "(", "sympy", "expressions", "event", "names", "and", "symbols", "dict", ")", "from", "performance", "metric", "str", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/machinemodel.py#L249-L271
[ "def", "parse_perfmetric", "(", "metric", ")", ":", "# Find all perfs counter references", "perfcounters", "=", "re", ".", "findall", "(", "r'[A-Z0-9_]+:[A-Z0-9\\[\\]|\\-]+(?::[A-Za-z0-9\\-_=]+)*'", ",", "metric", ")", "# Build a temporary metric, with parser-friendly Symbol names"...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Intervals._enforce_no_overlap
Enforce that no ranges overlap in internal storage.
kerncraft/intervals.py
def _enforce_no_overlap(self, start_at=0): """Enforce that no ranges overlap in internal storage.""" i = start_at while i+1 < len(self.data): if self.data[i][1] >= self.data[i+1][0]: # beginning of i+1-th range is contained in i-th range if self.data[i...
def _enforce_no_overlap(self, start_at=0): """Enforce that no ranges overlap in internal storage.""" i = start_at while i+1 < len(self.data): if self.data[i][1] >= self.data[i+1][0]: # beginning of i+1-th range is contained in i-th range if self.data[i...
[ "Enforce", "that", "no", "ranges", "overlap", "in", "internal", "storage", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/intervals.py#L20-L32
[ "def", "_enforce_no_overlap", "(", "self", ",", "start_at", "=", "0", ")", ":", "i", "=", "start_at", "while", "i", "+", "1", "<", "len", "(", "self", ".", "data", ")", ":", "if", "self", ".", "data", "[", "i", "]", "[", "1", "]", ">=", "self",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
get_header_path
Return local folder path of header files.
kerncraft/__init__.py
def get_header_path() -> str: """Return local folder path of header files.""" import os return os.path.abspath(os.path.dirname(os.path.realpath(__file__))) + '/headers/'
def get_header_path() -> str: """Return local folder path of header files.""" import os return os.path.abspath(os.path.dirname(os.path.realpath(__file__))) + '/headers/'
[ "Return", "local", "folder", "path", "of", "header", "files", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/__init__.py#L12-L15
[ "def", "get_header_path", "(", ")", "->", "str", ":", "import", "os", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ")", "+", "'/headers/'" ]
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor._align_iteration_with_cl_boundary
Align iteration with cacheline boundary.
kerncraft/cacheprediction.py
def _align_iteration_with_cl_boundary(self, iteration, subtract=True): """Align iteration with cacheline boundary.""" # FIXME handle multiple datatypes element_size = self.kernel.datatypes_size[self.kernel.datatype] cacheline_size = self.machine['cacheline size'] elements_per_cac...
def _align_iteration_with_cl_boundary(self, iteration, subtract=True): """Align iteration with cacheline boundary.""" # FIXME handle multiple datatypes element_size = self.kernel.datatypes_size[self.kernel.datatype] cacheline_size = self.machine['cacheline size'] elements_per_cac...
[ "Align", "iteration", "with", "cacheline", "boundary", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L352-L380
[ "def", "_align_iteration_with_cl_boundary", "(", "self", ",", "iteration", ",", "subtract", "=", "True", ")", ":", "# FIXME handle multiple datatypes", "element_size", "=", "self", ".", "kernel", ".", "datatypes_size", "[", "self", ".", "kernel", ".", "datatype", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor.get_loads
Return a list with number of loaded cache lines per memory hierarchy level.
kerncraft/cacheprediction.py
def get_loads(self): """Return a list with number of loaded cache lines per memory hierarchy level.""" return [self.stats[cache_level]['LOAD_count'] / self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
def get_loads(self): """Return a list with number of loaded cache lines per memory hierarchy level.""" return [self.stats[cache_level]['LOAD_count'] / self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
[ "Return", "a", "list", "with", "number", "of", "loaded", "cache", "lines", "per", "memory", "hierarchy", "level", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L486-L489
[ "def", "get_loads", "(", "self", ")", ":", "return", "[", "self", ".", "stats", "[", "cache_level", "]", "[", "'LOAD_count'", "]", "/", "self", ".", "first_dim_factor", "for", "cache_level", "in", "range", "(", "len", "(", "self", ".", "machine", "[", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor.get_hits
Return a list with number of hit cache lines per memory hierarchy level.
kerncraft/cacheprediction.py
def get_hits(self): """Return a list with number of hit cache lines per memory hierarchy level.""" return [self.stats[cache_level]['HIT_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
def get_hits(self): """Return a list with number of hit cache lines per memory hierarchy level.""" return [self.stats[cache_level]['HIT_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
[ "Return", "a", "list", "with", "number", "of", "hit", "cache", "lines", "per", "memory", "hierarchy", "level", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L491-L494
[ "def", "get_hits", "(", "self", ")", ":", "return", "[", "self", ".", "stats", "[", "cache_level", "]", "[", "'HIT_count'", "]", "/", "self", ".", "first_dim_factor", "for", "cache_level", "in", "range", "(", "len", "(", "self", ".", "machine", "[", "'...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor.get_misses
Return a list with number of missed cache lines per memory hierarchy level.
kerncraft/cacheprediction.py
def get_misses(self): """Return a list with number of missed cache lines per memory hierarchy level.""" return [self.stats[cache_level]['MISS_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
def get_misses(self): """Return a list with number of missed cache lines per memory hierarchy level.""" return [self.stats[cache_level]['MISS_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
[ "Return", "a", "list", "with", "number", "of", "missed", "cache", "lines", "per", "memory", "hierarchy", "level", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L496-L499
[ "def", "get_misses", "(", "self", ")", ":", "return", "[", "self", ".", "stats", "[", "cache_level", "]", "[", "'MISS_count'", "]", "/", "self", ".", "first_dim_factor", "for", "cache_level", "in", "range", "(", "len", "(", "self", ".", "machine", "[", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor.get_stores
Return a list with number of stored cache lines per memory hierarchy level.
kerncraft/cacheprediction.py
def get_stores(self): """Return a list with number of stored cache lines per memory hierarchy level.""" return [self.stats[cache_level]['STORE_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
def get_stores(self): """Return a list with number of stored cache lines per memory hierarchy level.""" return [self.stats[cache_level]['STORE_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
[ "Return", "a", "list", "with", "number", "of", "stored", "cache", "lines", "per", "memory", "hierarchy", "level", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L501-L504
[ "def", "get_stores", "(", "self", ")", ":", "return", "[", "self", ".", "stats", "[", "cache_level", "]", "[", "'STORE_count'", "]", "/", "self", ".", "first_dim_factor", "for", "cache_level", "in", "range", "(", "len", "(", "self", ".", "machine", "[", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor.get_evicts
Return a list with number of evicted cache lines per memory hierarchy level.
kerncraft/cacheprediction.py
def get_evicts(self): """Return a list with number of evicted cache lines per memory hierarchy level.""" return [self.stats[cache_level]['EVICT_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
def get_evicts(self): """Return a list with number of evicted cache lines per memory hierarchy level.""" return [self.stats[cache_level]['EVICT_count']/self.first_dim_factor for cache_level in range(len(self.machine['memory hierarchy']))]
[ "Return", "a", "list", "with", "number", "of", "evicted", "cache", "lines", "per", "memory", "hierarchy", "level", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L506-L509
[ "def", "get_evicts", "(", "self", ")", ":", "return", "[", "self", ".", "stats", "[", "cache_level", "]", "[", "'EVICT_count'", "]", "/", "self", ".", "first_dim_factor", "for", "cache_level", "in", "range", "(", "len", "(", "self", ".", "machine", "[", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
CacheSimulationPredictor.get_infos
Return verbose information about the predictor.
kerncraft/cacheprediction.py
def get_infos(self): """Return verbose information about the predictor.""" first_dim_factor = self.first_dim_factor infos = {'memory hierarchy': [], 'cache stats': self.stats, 'cachelines in stats': first_dim_factor} for cache_level, cache_info in list(enumerate(self.mac...
def get_infos(self): """Return verbose information about the predictor.""" first_dim_factor = self.first_dim_factor infos = {'memory hierarchy': [], 'cache stats': self.stats, 'cachelines in stats': first_dim_factor} for cache_level, cache_info in list(enumerate(self.mac...
[ "Return", "verbose", "information", "about", "the", "predictor", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/cacheprediction.py#L511-L531
[ "def", "get_infos", "(", "self", ")", ":", "first_dim_factor", "=", "self", ".", "first_dim_factor", "infos", "=", "{", "'memory hierarchy'", ":", "[", "]", ",", "'cache stats'", ":", "self", ".", "stats", ",", "'cachelines in stats'", ":", "first_dim_factor", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
measure_bw
*size* is given in kilo bytes
kerncraft/likwid_bench_auto.py
def measure_bw(type_, total_size, threads_per_core, max_threads_per_core, cores_per_socket, sockets): """*size* is given in kilo bytes""" groups = [] for s in range(sockets): groups += [ '-w', 'S' + str(s) + ':' + str(total_size) + 'kB:' + str(threa...
def measure_bw(type_, total_size, threads_per_core, max_threads_per_core, cores_per_socket, sockets): """*size* is given in kilo bytes""" groups = [] for s in range(sockets): groups += [ '-w', 'S' + str(s) + ':' + str(total_size) + 'kB:' + str(threa...
[ "*", "size", "*", "is", "given", "in", "kilo", "bytes" ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/likwid_bench_auto.py#L154-L174
[ "def", "measure_bw", "(", "type_", ",", "total_size", ",", "threads_per_core", ",", "max_threads_per_core", ",", "cores_per_socket", ",", "sockets", ")", ":", "groups", "=", "[", "]", "for", "s", "in", "range", "(", "sockets", ")", ":", "groups", "+=", "["...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
fix_env_variable
Fix environment variable to a value within context. Unset if value is None.
kerncraft/models/benchmark.py
def fix_env_variable(name, value): """Fix environment variable to a value within context. Unset if value is None.""" orig = os.environ.get(name, None) if value is not None: # Set if value is not None os.environ[name] = value elif name in os.environ: # Unset if value is None ...
def fix_env_variable(name, value): """Fix environment variable to a value within context. Unset if value is None.""" orig = os.environ.get(name, None) if value is not None: # Set if value is not None os.environ[name] = value elif name in os.environ: # Unset if value is None ...
[ "Fix", "environment", "variable", "to", "a", "value", "within", "context", ".", "Unset", "if", "value", "is", "None", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L41-L58
[ "def", "fix_env_variable", "(", "name", ",", "value", ")", ":", "orig", "=", "os", ".", "environ", ".", "get", "(", "name", ",", "None", ")", "if", "value", "is", "not", "None", ":", "# Set if value is not None", "os", ".", "environ", "[", "name", "]",...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Benchmark.configure_arggroup
Configure argument parser.
kerncraft/models/benchmark.py
def configure_arggroup(cls, parser): """Configure argument parser.""" parser.add_argument( '--no-phenoecm', action='store_true', help='Disables the phenomenological ECM model building.') parser.add_argument( '--iterations', type=int, default=10, he...
def configure_arggroup(cls, parser): """Configure argument parser.""" parser.add_argument( '--no-phenoecm', action='store_true', help='Disables the phenomenological ECM model building.') parser.add_argument( '--iterations', type=int, default=10, he...
[ "Configure", "argument", "parser", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L198-L209
[ "def", "configure_arggroup", "(", "cls", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'--no-phenoecm'", ",", "action", "=", "'store_true'", ",", "help", "=", "'Disables the phenomenological ECM model building.'", ")", "parser", ".", "add_argument", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Benchmark.perfctr
Run *cmd* with likwid-perfctr and returns result as dict. *group* may be a performance group known to likwid-perfctr or an event string. if CLI argument cores > 1, running with multi-core, otherwise single-core
kerncraft/models/benchmark.py
def perfctr(self, cmd, group='MEM', code_markers=True): """ Run *cmd* with likwid-perfctr and returns result as dict. *group* may be a performance group known to likwid-perfctr or an event string. if CLI argument cores > 1, running with multi-core, otherwise single-core """ ...
def perfctr(self, cmd, group='MEM', code_markers=True): """ Run *cmd* with likwid-perfctr and returns result as dict. *group* may be a performance group known to likwid-perfctr or an event string. if CLI argument cores > 1, running with multi-core, otherwise single-core """ ...
[ "Run", "*", "cmd", "*", "with", "likwid", "-", "perfctr", "and", "returns", "result", "as", "dict", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L279-L341
[ "def", "perfctr", "(", "self", ",", "cmd", ",", "group", "=", "'MEM'", ",", "code_markers", "=", "True", ")", ":", "# Making sure likwid-perfctr is available:", "if", "find_executable", "(", "'likwid-perfctr'", ")", "is", "None", ":", "print", "(", "\"likwid-per...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Benchmark.analyze
Run analysis.
kerncraft/models/benchmark.py
def analyze(self): """Run analysis.""" bench = self.kernel.build_executable(verbose=self.verbose > 1, openmp=self._args.cores > 1) element_size = self.kernel.datatypes_size[self.kernel.datatype] # Build arguments to pass to command: args = [str(s) for s in list(self.kernel.const...
def analyze(self): """Run analysis.""" bench = self.kernel.build_executable(verbose=self.verbose > 1, openmp=self._args.cores > 1) element_size = self.kernel.datatypes_size[self.kernel.datatype] # Build arguments to pass to command: args = [str(s) for s in list(self.kernel.const...
[ "Run", "analysis", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L343-L486
[ "def", "analyze", "(", "self", ")", ":", "bench", "=", "self", ".", "kernel", ".", "build_executable", "(", "verbose", "=", "self", ".", "verbose", ">", "1", ",", "openmp", "=", "self", ".", "_args", ".", "cores", ">", "1", ")", "element_size", "=", ...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
Benchmark.report
Report gathered analysis data in human readable form.
kerncraft/models/benchmark.py
def report(self, output_file=sys.stdout): """Report gathered analysis data in human readable form.""" if self.verbose > 1: with pprint_nosort(): pprint.pprint(self.results) if self.verbose > 0: print('Runtime (per repetition): {:.2g} s'.format( ...
def report(self, output_file=sys.stdout): """Report gathered analysis data in human readable form.""" if self.verbose > 1: with pprint_nosort(): pprint.pprint(self.results) if self.verbose > 0: print('Runtime (per repetition): {:.2g} s'.format( ...
[ "Report", "gathered", "analysis", "data", "in", "human", "readable", "form", "." ]
RRZE-HPC/kerncraft
python
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/benchmark.py#L488-L541
[ "def", "report", "(", "self", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "if", "self", ".", "verbose", ">", "1", ":", "with", "pprint_nosort", "(", ")", ":", "pprint", ".", "pprint", "(", "self", ".", "results", ")", "if", "self", "."...
c60baf8043e4da8d8d66da7575021c2f4c6c78af
test
parse_description
Parse the description in the README file CommandLine: python -c "import setup; print(setup.parse_description())"
setup.py
def parse_description(): """ Parse the description in the README file CommandLine: python -c "import setup; print(setup.parse_description())" """ from os.path import dirname, join, exists readme_fpath = join(dirname(__file__), 'README.md') # print('readme_fpath = %r' % (readme_fpath...
def parse_description(): """ Parse the description in the README file CommandLine: python -c "import setup; print(setup.parse_description())" """ from os.path import dirname, join, exists readme_fpath = join(dirname(__file__), 'README.md') # print('readme_fpath = %r' % (readme_fpath...
[ "Parse", "the", "description", "in", "the", "README", "file" ]
Erotemic/progiter
python
https://github.com/Erotemic/progiter/blob/24f1ad15d79f76cccef7b5811d341ab33b72bf1e/setup.py#L71-L104
[ "def", "parse_description", "(", ")", ":", "from", "os", ".", "path", "import", "dirname", ",", "join", ",", "exists", "readme_fpath", "=", "join", "(", "dirname", "(", "__file__", ")", ",", "'README.md'", ")", "# print('readme_fpath = %r' % (readme_fpath,))", "...
24f1ad15d79f76cccef7b5811d341ab33b72bf1e
test
schedule_retry
Schedule a retry
ecommerce_worker/sailthru/v1/tasks.py
def schedule_retry(self, config): """Schedule a retry""" raise self.retry(countdown=config.get('SAILTHRU_RETRY_SECONDS'), max_retries=config.get('SAILTHRU_RETRY_ATTEMPTS'))
def schedule_retry(self, config): """Schedule a retry""" raise self.retry(countdown=config.get('SAILTHRU_RETRY_SECONDS'), max_retries=config.get('SAILTHRU_RETRY_ATTEMPTS'))
[ "Schedule", "a", "retry" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L22-L25
[ "def", "schedule_retry", "(", "self", ",", "config", ")", ":", "raise", "self", ".", "retry", "(", "countdown", "=", "config", ".", "get", "(", "'SAILTHRU_RETRY_SECONDS'", ")", ",", "max_retries", "=", "config", ".", "get", "(", "'SAILTHRU_RETRY_ATTEMPTS'", ...
55246961d805b1f64d661a5c0bae0a216589401f
test
_build_purchase_item
Build and return Sailthru purchase item object
ecommerce_worker/sailthru/v1/tasks.py
def _build_purchase_item(course_id, course_url, cost_in_cents, mode, course_data, sku): """Build and return Sailthru purchase item object""" # build item description item = { 'id': "{}-{}".format(course_id, mode), 'url': course_url, 'price': cost_in_cents, 'qty': 1, } ...
def _build_purchase_item(course_id, course_url, cost_in_cents, mode, course_data, sku): """Build and return Sailthru purchase item object""" # build item description item = { 'id': "{}-{}".format(course_id, mode), 'url': course_url, 'price': cost_in_cents, 'qty': 1, } ...
[ "Build", "and", "return", "Sailthru", "purchase", "item", "object" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L28-L54
[ "def", "_build_purchase_item", "(", "course_id", ",", "course_url", ",", "cost_in_cents", ",", "mode", ",", "course_data", ",", "sku", ")", ":", "# build item description", "item", "=", "{", "'id'", ":", "\"{}-{}\"", ".", "format", "(", "course_id", ",", "mode...
55246961d805b1f64d661a5c0bae0a216589401f
test
_record_purchase
Record a purchase in Sailthru Arguments: sailthru_client (object): SailthruClient email (str): user's email address item (dict): Sailthru required information about the course purchase_incomplete (boolean): True if adding item to shopping cart message_id (str): Cookie used t...
ecommerce_worker/sailthru/v1/tasks.py
def _record_purchase(sailthru_client, email, item, purchase_incomplete, message_id, options): """Record a purchase in Sailthru Arguments: sailthru_client (object): SailthruClient email (str): user's email address item (dict): Sailthru required information about the course purcha...
def _record_purchase(sailthru_client, email, item, purchase_incomplete, message_id, options): """Record a purchase in Sailthru Arguments: sailthru_client (object): SailthruClient email (str): user's email address item (dict): Sailthru required information about the course purcha...
[ "Record", "a", "purchase", "in", "Sailthru" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L57-L85
[ "def", "_record_purchase", "(", "sailthru_client", ",", "email", ",", "item", ",", "purchase_incomplete", ",", "message_id", ",", "options", ")", ":", "try", ":", "sailthru_response", "=", "sailthru_client", ".", "purchase", "(", "email", ",", "[", "item", "]"...
55246961d805b1f64d661a5c0bae0a216589401f
test
_get_course_content
Get course information using the Sailthru content api or from cache. If there is an error, just return with an empty response. Arguments: course_id (str): course key of the course course_url (str): LMS url for course info page. sailthru_client (object): SailthruClient site_code...
ecommerce_worker/sailthru/v1/tasks.py
def _get_course_content(course_id, course_url, sailthru_client, site_code, config): """Get course information using the Sailthru content api or from cache. If there is an error, just return with an empty response. Arguments: course_id (str): course key of the course course_url (str): LMS u...
def _get_course_content(course_id, course_url, sailthru_client, site_code, config): """Get course information using the Sailthru content api or from cache. If there is an error, just return with an empty response. Arguments: course_id (str): course key of the course course_url (str): LMS u...
[ "Get", "course", "information", "using", "the", "Sailthru", "content", "api", "or", "from", "cache", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L88-L125
[ "def", "_get_course_content", "(", "course_id", ",", "course_url", ",", "sailthru_client", ",", "site_code", ",", "config", ")", ":", "# check cache first", "cache_key", "=", "\"{}:{}\"", ".", "format", "(", "site_code", ",", "course_url", ")", "response", "=", ...
55246961d805b1f64d661a5c0bae0a216589401f
test
_get_course_content_from_ecommerce
Get course information using the Ecommerce course api. In case of error returns empty response. Arguments: course_id (str): course key of the course site_code (str): site code Returns: course information from Ecommerce
ecommerce_worker/sailthru/v1/tasks.py
def _get_course_content_from_ecommerce(course_id, site_code=None): """ Get course information using the Ecommerce course api. In case of error returns empty response. Arguments: course_id (str): course key of the course site_code (str): site code Returns: course information...
def _get_course_content_from_ecommerce(course_id, site_code=None): """ Get course information using the Ecommerce course api. In case of error returns empty response. Arguments: course_id (str): course key of the course site_code (str): site code Returns: course information...
[ "Get", "course", "information", "using", "the", "Ecommerce", "course", "api", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L128-L154
[ "def", "_get_course_content_from_ecommerce", "(", "course_id", ",", "site_code", "=", "None", ")", ":", "api", "=", "get_ecommerce_client", "(", "site_code", "=", "site_code", ")", "try", ":", "api_response", "=", "api", ".", "courses", "(", "course_id", ")", ...
55246961d805b1f64d661a5c0bae0a216589401f
test
_update_unenrolled_list
Maintain a list of courses the user has unenrolled from in the Sailthru user record Arguments: sailthru_client (object): SailthruClient email (str): user's email address course_url (str): LMS url for course info page. unenroll (boolean): True if unenrolling, False if enrolling ...
ecommerce_worker/sailthru/v1/tasks.py
def _update_unenrolled_list(sailthru_client, email, course_url, unenroll): """Maintain a list of courses the user has unenrolled from in the Sailthru user record Arguments: sailthru_client (object): SailthruClient email (str): user's email address course_url (str): LMS url for course in...
def _update_unenrolled_list(sailthru_client, email, course_url, unenroll): """Maintain a list of courses the user has unenrolled from in the Sailthru user record Arguments: sailthru_client (object): SailthruClient email (str): user's email address course_url (str): LMS url for course in...
[ "Maintain", "a", "list", "of", "courses", "the", "user", "has", "unenrolled", "from", "in", "the", "Sailthru", "user", "record" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L157-L210
[ "def", "_update_unenrolled_list", "(", "sailthru_client", ",", "email", ",", "course_url", ",", "unenroll", ")", ":", "try", ":", "# get the user 'vars' values from sailthru", "sailthru_response", "=", "sailthru_client", ".", "api_get", "(", "\"user\"", ",", "{", "\"i...
55246961d805b1f64d661a5c0bae0a216589401f
test
update_course_enrollment
Adds/updates Sailthru when a user adds to cart/purchases/upgrades a course Args: email(str): The user's email address course_url(str): Course home page url purchase_incomplete(boolean): True if adding to cart mode(string): enroll mode (audit, verification, ...) unit_cost(de...
ecommerce_worker/sailthru/v1/tasks.py
def update_course_enrollment(self, email, course_url, purchase_incomplete, mode, unit_cost=None, course_id=None, currency=None, message_id=None, site_code=None, sku=None): """Adds/updates Sailthru when a user adds to cart/purchases/upgrades a course Args: email(str): The u...
def update_course_enrollment(self, email, course_url, purchase_incomplete, mode, unit_cost=None, course_id=None, currency=None, message_id=None, site_code=None, sku=None): """Adds/updates Sailthru when a user adds to cart/purchases/upgrades a course Args: email(str): The u...
[ "Adds", "/", "updates", "Sailthru", "when", "a", "user", "adds", "to", "cart", "/", "purchases", "/", "upgrades", "a", "course" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L234-L305
[ "def", "update_course_enrollment", "(", "self", ",", "email", ",", "course_url", ",", "purchase_incomplete", ",", "mode", ",", "unit_cost", "=", "None", ",", "course_id", "=", "None", ",", "currency", "=", "None", ",", "message_id", "=", "None", ",", "site_c...
55246961d805b1f64d661a5c0bae0a216589401f
test
send_course_refund_email
Sends the course refund email. Args: self: Ignore. email (str): Recipient's email address. refund_id (int): ID of the refund that initiated this task. amount (str): Formatted amount of the refund. course_name (str): Name of the course for which payment was refunded. ...
ecommerce_worker/sailthru/v1/tasks.py
def send_course_refund_email(self, email, refund_id, amount, course_name, order_number, order_url, site_code=None): """ Sends the course refund email. Args: self: Ignore. email (str): Recipient's email address. refund_id (int): ID of the refund that initiated this task. amount (...
def send_course_refund_email(self, email, refund_id, amount, course_name, order_number, order_url, site_code=None): """ Sends the course refund email. Args: self: Ignore. email (str): Recipient's email address. refund_id (int): ID of the refund that initiated this task. amount (...
[ "Sends", "the", "course", "refund", "email", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L309-L369
[ "def", "send_course_refund_email", "(", "self", ",", "email", ",", "refund_id", ",", "amount", ",", "course_name", ",", "order_number", ",", "order_url", ",", "site_code", "=", "None", ")", ":", "config", "=", "get_sailthru_configuration", "(", "site_code", ")",...
55246961d805b1f64d661a5c0bae0a216589401f
test
send_offer_assignment_email
Sends the offer assignment email. Args: self: Ignore. user_email (str): Recipient's email address. offer_assignment_id (str): Key of the entry in the offer_assignment model. subject (str): Email subject. email_body (str): The body of the email. site_code (str): Identi...
ecommerce_worker/sailthru/v1/tasks.py
def send_offer_assignment_email(self, user_email, offer_assignment_id, subject, email_body, site_code=None): """ Sends the offer assignment email. Args: self: Ignore. user_email (str): Recipient's email address. offer_assignment_id (str): Key of the entry in the offer_assignment model. ...
def send_offer_assignment_email(self, user_email, offer_assignment_id, subject, email_body, site_code=None): """ Sends the offer assignment email. Args: self: Ignore. user_email (str): Recipient's email address. offer_assignment_id (str): Key of the entry in the offer_assignment model. ...
[ "Sends", "the", "offer", "assignment", "email", ".", "Args", ":", "self", ":", "Ignore", ".", "user_email", "(", "str", ")", ":", "Recipient", "s", "email", "address", ".", "offer_assignment_id", "(", "str", ")", ":", "Key", "of", "the", "entry", "in", ...
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L373-L397
[ "def", "send_offer_assignment_email", "(", "self", ",", "user_email", ",", "offer_assignment_id", ",", "subject", ",", "email_body", ",", "site_code", "=", "None", ")", ":", "config", "=", "get_sailthru_configuration", "(", "site_code", ")", "response", "=", "_sen...
55246961d805b1f64d661a5c0bae0a216589401f
test
_send_offer_assignment_notification_email
Handles sending offer assignment notification emails and retrying failed emails when appropriate.
ecommerce_worker/sailthru/v1/tasks.py
def _send_offer_assignment_notification_email(config, user_email, subject, email_body, site_code, task): """Handles sending offer assignment notification emails and retrying failed emails when appropriate.""" try: sailthru_client = get_sailthru_client(site_code) except SailthruError: logger....
def _send_offer_assignment_notification_email(config, user_email, subject, email_body, site_code, task): """Handles sending offer assignment notification emails and retrying failed emails when appropriate.""" try: sailthru_client = get_sailthru_client(site_code) except SailthruError: logger....
[ "Handles", "sending", "offer", "assignment", "notification", "emails", "and", "retrying", "failed", "emails", "when", "appropriate", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L400-L450
[ "def", "_send_offer_assignment_notification_email", "(", "config", ",", "user_email", ",", "subject", ",", "email_body", ",", "site_code", ",", "task", ")", ":", "try", ":", "sailthru_client", "=", "get_sailthru_client", "(", "site_code", ")", "except", "SailthruErr...
55246961d805b1f64d661a5c0bae0a216589401f
test
_update_assignment_email_status
Update the offer_assignment and offer_assignment_email model using the Ecommerce assignmentemail api. Arguments: offer_assignment_id (str): Key of the entry in the offer_assignment model. send_id (str): Unique message id from Sailthru status (str): status to be sent to the api site_c...
ecommerce_worker/sailthru/v1/tasks.py
def _update_assignment_email_status(offer_assignment_id, send_id, status, site_code=None): """ Update the offer_assignment and offer_assignment_email model using the Ecommerce assignmentemail api. Arguments: offer_assignment_id (str): Key of the entry in the offer_assignment model. send_id (...
def _update_assignment_email_status(offer_assignment_id, send_id, status, site_code=None): """ Update the offer_assignment and offer_assignment_email model using the Ecommerce assignmentemail api. Arguments: offer_assignment_id (str): Key of the entry in the offer_assignment model. send_id (...
[ "Update", "the", "offer_assignment", "and", "offer_assignment_email", "model", "using", "the", "Ecommerce", "assignmentemail", "api", ".", "Arguments", ":", "offer_assignment_id", "(", "str", ")", ":", "Key", "of", "the", "entry", "in", "the", "offer_assignment", ...
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L453-L481
[ "def", "_update_assignment_email_status", "(", "offer_assignment_id", ",", "send_id", ",", "status", ",", "site_code", "=", "None", ")", ":", "api", "=", "get_ecommerce_client", "(", "url_postfix", "=", "'assignment-email/'", ",", "site_code", "=", "site_code", ")",...
55246961d805b1f64d661a5c0bae0a216589401f
test
send_offer_update_email
Sends the offer emails after assignment, either for revoking or reminding. Args: self: Ignore. user_email (str): Recipient's email address. subject (str): Email subject. email_body (str): The body of the email. site_code (str): Identifier of the site sending the email.
ecommerce_worker/sailthru/v1/tasks.py
def send_offer_update_email(self, user_email, subject, email_body, site_code=None): """ Sends the offer emails after assignment, either for revoking or reminding. Args: self: Ignore. user_email (str): Recipient's email address. subject (str): Email subject. email_body (str): The ...
def send_offer_update_email(self, user_email, subject, email_body, site_code=None): """ Sends the offer emails after assignment, either for revoking or reminding. Args: self: Ignore. user_email (str): Recipient's email address. subject (str): Email subject. email_body (str): The ...
[ "Sends", "the", "offer", "emails", "after", "assignment", "either", "for", "revoking", "or", "reminding", ".", "Args", ":", "self", ":", "Ignore", ".", "user_email", "(", "str", ")", ":", "Recipient", "s", "email", "address", ".", "subject", "(", "str", ...
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/tasks.py#L485-L495
[ "def", "send_offer_update_email", "(", "self", ",", "user_email", ",", "subject", ",", "email_body", ",", "site_code", "=", "None", ")", ":", "config", "=", "get_sailthru_configuration", "(", "site_code", ")", "_send_offer_assignment_notification_email", "(", "config"...
55246961d805b1f64d661a5c0bae0a216589401f
test
get_logger_config
Returns a dictionary containing logging configuration. If dev_env is True, logging will not be done via local rsyslogd. Instead, application logs will be dropped into log_dir. 'edx_filename' is ignored unless dev_env is True.
ecommerce_worker/configuration/logger.py
def get_logger_config(log_dir='/var/tmp', logging_env='no_env', edx_filename='edx.log', dev_env=False, debug=False, local_loglevel='INFO', service_variant='ecomworker'): """ Retur...
def get_logger_config(log_dir='/var/tmp', logging_env='no_env', edx_filename='edx.log', dev_env=False, debug=False, local_loglevel='INFO', service_variant='ecomworker'): """ Retur...
[ "Returns", "a", "dictionary", "containing", "logging", "configuration", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/configuration/logger.py#L8-L100
[ "def", "get_logger_config", "(", "log_dir", "=", "'/var/tmp'", ",", "logging_env", "=", "'no_env'", ",", "edx_filename", "=", "'edx.log'", ",", "dev_env", "=", "False", ",", "debug", "=", "False", ",", "local_loglevel", "=", "'INFO'", ",", "service_variant", "...
55246961d805b1f64d661a5c0bae0a216589401f
test
_retry_order
Retry with exponential backoff until fulfillment succeeds or the retry limit is reached. If the retry limit is exceeded, the exception is re-raised.
ecommerce_worker/fulfillment/v1/tasks.py
def _retry_order(self, exception, max_fulfillment_retries, order_number): """ Retry with exponential backoff until fulfillment succeeds or the retry limit is reached. If the retry limit is exceeded, the exception is re-raised. """ retries = self.request.retries if retries == max_fulfillment_...
def _retry_order(self, exception, max_fulfillment_retries, order_number): """ Retry with exponential backoff until fulfillment succeeds or the retry limit is reached. If the retry limit is exceeded, the exception is re-raised. """ retries = self.request.retries if retries == max_fulfillment_...
[ "Retry", "with", "exponential", "backoff", "until", "fulfillment", "succeeds", "or", "the", "retry", "limit", "is", "reached", ".", "If", "the", "retry", "limit", "is", "exceeded", "the", "exception", "is", "re", "-", "raised", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/fulfillment/v1/tasks.py#L14-L27
[ "def", "_retry_order", "(", "self", ",", "exception", ",", "max_fulfillment_retries", ",", "order_number", ")", ":", "retries", "=", "self", ".", "request", ".", "retries", "if", "retries", "==", "max_fulfillment_retries", ":", "logger", ".", "exception", "(", ...
55246961d805b1f64d661a5c0bae0a216589401f
test
fulfill_order
Fulfills an order. Arguments: order_number (str): Order number indicating which order to fulfill. Returns: None
ecommerce_worker/fulfillment/v1/tasks.py
def fulfill_order(self, order_number, site_code=None, email_opt_in=False): """Fulfills an order. Arguments: order_number (str): Order number indicating which order to fulfill. Returns: None """ max_fulfillment_retries = get_configuration('MAX_FULFILLMENT_RETRIES', site_code=site_co...
def fulfill_order(self, order_number, site_code=None, email_opt_in=False): """Fulfills an order. Arguments: order_number (str): Order number indicating which order to fulfill. Returns: None """ max_fulfillment_retries = get_configuration('MAX_FULFILLMENT_RETRIES', site_code=site_co...
[ "Fulfills", "an", "order", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/fulfillment/v1/tasks.py#L31-L62
[ "def", "fulfill_order", "(", "self", ",", "order_number", ",", "site_code", "=", "None", ",", "email_opt_in", "=", "False", ")", ":", "max_fulfillment_retries", "=", "get_configuration", "(", "'MAX_FULFILLMENT_RETRIES'", ",", "site_code", "=", "site_code", ")", "a...
55246961d805b1f64d661a5c0bae0a216589401f
test
get_sailthru_client
Returns a Sailthru client for the specified site. Args: site_code (str): Site for which the client should be configured. Returns: SailthruClient Raises: SailthruNotEnabled: If Sailthru is not enabled for the specified site. ConfigurationError: If either the Sailthru API ke...
ecommerce_worker/sailthru/v1/utils.py
def get_sailthru_client(site_code): """ Returns a Sailthru client for the specified site. Args: site_code (str): Site for which the client should be configured. Returns: SailthruClient Raises: SailthruNotEnabled: If Sailthru is not enabled for the specified site. C...
def get_sailthru_client(site_code): """ Returns a Sailthru client for the specified site. Args: site_code (str): Site for which the client should be configured. Returns: SailthruClient Raises: SailthruNotEnabled: If Sailthru is not enabled for the specified site. C...
[ "Returns", "a", "Sailthru", "client", "for", "the", "specified", "site", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/sailthru/v1/utils.py#L18-L50
[ "def", "get_sailthru_client", "(", "site_code", ")", ":", "# Get configuration", "config", "=", "get_sailthru_configuration", "(", "site_code", ")", "# Return if Sailthru integration disabled", "if", "not", "config", ".", "get", "(", "'SAILTHRU_ENABLE'", ")", ":", "msg"...
55246961d805b1f64d661a5c0bae0a216589401f
test
Cache.get
Get an object from the cache Arguments: key (str): Cache key Returns: Cached object
ecommerce_worker/cache.py
def get(self, key): """Get an object from the cache Arguments: key (str): Cache key Returns: Cached object """ lock.acquire() try: if key not in self: return None current_time = time.time() if ...
def get(self, key): """Get an object from the cache Arguments: key (str): Cache key Returns: Cached object """ lock.acquire() try: if key not in self: return None current_time = time.time() if ...
[ "Get", "an", "object", "from", "the", "cache" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/cache.py#L23-L51
[ "def", "get", "(", "self", ",", "key", ")", ":", "lock", ".", "acquire", "(", ")", "try", ":", "if", "key", "not", "in", "self", ":", "return", "None", "current_time", "=", "time", ".", "time", "(", ")", "if", "self", "[", "key", "]", ".", "exp...
55246961d805b1f64d661a5c0bae0a216589401f
test
Cache.set
Save an object in the cache Arguments: key (str): Cache key value (object): object to cache duration (int): time in seconds to keep object in cache
ecommerce_worker/cache.py
def set(self, key, value, duration): """Save an object in the cache Arguments: key (str): Cache key value (object): object to cache duration (int): time in seconds to keep object in cache """ lock.acquire() try: self[key] = CacheO...
def set(self, key, value, duration): """Save an object in the cache Arguments: key (str): Cache key value (object): object to cache duration (int): time in seconds to keep object in cache """ lock.acquire() try: self[key] = CacheO...
[ "Save", "an", "object", "in", "the", "cache" ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/cache.py#L53-L66
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "duration", ")", ":", "lock", ".", "acquire", "(", ")", "try", ":", "self", "[", "key", "]", "=", "CacheObject", "(", "value", ",", "duration", ")", "finally", ":", "lock", ".", "release", ...
55246961d805b1f64d661a5c0bae0a216589401f
test
get_configuration
Get a value from configuration. Retrieves the value corresponding to the given variable from the configuration module currently in use by the app. Specify a site_code value to check for a site-specific override. Arguments: variable (str): The name of a variable from the configuration module. ...
ecommerce_worker/utils.py
def get_configuration(variable, site_code=None): """ Get a value from configuration. Retrieves the value corresponding to the given variable from the configuration module currently in use by the app. Specify a site_code value to check for a site-specific override. Arguments: variable (str...
def get_configuration(variable, site_code=None): """ Get a value from configuration. Retrieves the value corresponding to the given variable from the configuration module currently in use by the app. Specify a site_code value to check for a site-specific override. Arguments: variable (str...
[ "Get", "a", "value", "from", "configuration", "." ]
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/utils.py#L10-L46
[ "def", "get_configuration", "(", "variable", ",", "site_code", "=", "None", ")", ":", "name", "=", "os", ".", "environ", ".", "get", "(", "CONFIGURATION_MODULE", ")", "# __import__ performs a full import, but only returns the top-level", "# package, not the targeted module....
55246961d805b1f64d661a5c0bae0a216589401f
test
get_ecommerce_client
Get client for fetching data from ecommerce API. Arguments: site_code (str): (Optional) The SITE_OVERRIDES key to inspect for site-specific values url_postfix (str): (Optional) The URL postfix value to append to the ECOMMERCE_API_ROOT value. Returns: EdxRestApiClient object
ecommerce_worker/utils.py
def get_ecommerce_client(url_postfix='', site_code=None): """ Get client for fetching data from ecommerce API. Arguments: site_code (str): (Optional) The SITE_OVERRIDES key to inspect for site-specific values url_postfix (str): (Optional) The URL postfix value to append to the ECOMMERCE_API_...
def get_ecommerce_client(url_postfix='', site_code=None): """ Get client for fetching data from ecommerce API. Arguments: site_code (str): (Optional) The SITE_OVERRIDES key to inspect for site-specific values url_postfix (str): (Optional) The URL postfix value to append to the ECOMMERCE_API_...
[ "Get", "client", "for", "fetching", "data", "from", "ecommerce", "API", ".", "Arguments", ":", "site_code", "(", "str", ")", ":", "(", "Optional", ")", "The", "SITE_OVERRIDES", "key", "to", "inspect", "for", "site", "-", "specific", "values", "url_postfix", ...
edx/ecommerce-worker
python
https://github.com/edx/ecommerce-worker/blob/55246961d805b1f64d661a5c0bae0a216589401f/ecommerce_worker/utils.py#L49-L64
[ "def", "get_ecommerce_client", "(", "url_postfix", "=", "''", ",", "site_code", "=", "None", ")", ":", "ecommerce_api_root", "=", "get_configuration", "(", "'ECOMMERCE_API_ROOT'", ",", "site_code", "=", "site_code", ")", "signing_key", "=", "get_configuration", "(",...
55246961d805b1f64d661a5c0bae0a216589401f