Skip to content

exec 🔗

Exec 🔗

Bases: Exec_Operation

An Exec operation model vAccel resource

exec classmethod 🔗

exec(library: str, symbol: str, arg_read: List[Any], arg_write: List[Any])

Performs the Exec using vAccel over genop.

Parameters:

Name Type Description Default

library 🔗

str

Path to the shared object containing the function that the user wants to call

required

symbol 🔗

str

Name of the function contained in the above shared object

required

arg_read 🔗

List[Any]

A list of inputs

required

Returns:

Name Type Description
arg_write

A list of outputs

Source code in vaccel/exec.py
@classmethod
def exec(cls, library: str, symbol: str, arg_read: List[Any], arg_write: List[Any]):
    """Performs the Exec using vAccel over genop.

    Args:
        library: Path to the shared object containing the function that the user wants to call
        symbol: Name of the function contained in the above shared object
        arg_read: A list of inputs

    Returns:
        arg_write: A list of outputs
    """

    session = Session(flags=0)
    arg_read_local = [VaccelArg(data=int(cls.__op__)),
                      VaccelArg(data=library), VaccelArg(data=symbol)] + arg_read
    arg_write = [VaccelArg(data=bytes(100 * " ", encoding="utf-8"))]
    ret = cls.__genop__(session, arg_read=arg_read_local, arg_write=arg_write, index=0)
    return ret

Exec_Operation 🔗

An Exec Operation model vAccel resource

Exec_with_resource 🔗

Bases: Exec_Operation

An Exec with resource model vAccel resource.

exec_with_resource classmethod 🔗

exec_with_resource(
    obj: str, symbol: str, arg_read: List[Any], arg_write: List[Any]
)

Performs the Exec with resource operation

Parameters:

Name Type Description Default

object 🔗

Filename of a shared object to be used with vaccel exec

required

symbol 🔗

str

Name of the function contained in the above shared object

required

arg_read 🔗

List[Any]

A list of inputs

required

Returns:

Name Type Description
arg_write

A list of outputs

Source code in vaccel/exec.py
@classmethod
def exec_with_resource(cls, obj: str, symbol: str, arg_read: List[Any], arg_write: List[Any]):
    """Performs the Exec with resource operation

    Args:
        object: Filename of a shared object to be used with vaccel exec
        symbol: Name of the function contained in the above shared object
        arg_read: A list of inputs

    Returns:
        arg_write: A list of outputs
    """
    session = Session(flags=0)

    myresource = Resource(session, obj, rtype=0)
    resource = myresource._inner
    symbolcdata = Exec_with_resource.object_symbol(symbol)
    #myobject.register


    vaccel_args_read = Vaccel_Args.vaccel_args(arg_read)
    vaccel_args_write = Vaccel_Args.vaccel_args(arg_write)
    nr_read = len(vaccel_args_read)
    nr_write = len(vaccel_args_write)


    ret = lib.vaccel_exec_with_resource(session._to_inner(), resource, symbolcdata, vaccel_args_read, nr_read, vaccel_args_write, nr_write)
    print(arg_write)
    #import pdb;pdb.set_trace()
    print(vaccel_args_write[0].buf)

    #myobject.unregister

    return arg_write 

Vaccel_Args 🔗

A helper class for converting argument lists to the appropriate vAccel format

vaccel_args staticmethod 🔗

vaccel_args(args: List[Any]) -> List[VaccelArg]

Convert a list of arguments to a list of VaccelArg objects

Args: args : A list of integers

Returns:

Type Description
List[VaccelArg]

A list of VaccelArg objects

Source code in vaccel/exec.py
@staticmethod
def vaccel_args(args: List[Any]) -> List[VaccelArg]:
    """Convert a list of arguments to a list of VaccelArg objects

    Args:
        args : A list of integers

   Returns:
        A list of VaccelArg objects
    """
    iterable = list(args)

    new_list = []
    for item in iterable:
        new_item=VaccelArg(data=item)
        new_list.append(new_item)
        __hidden__.append(new_item)

    return VaccelArgList(new_list).to_cffi()