Esempio n. 1
0
    # {{{ generate set_args

    gen("")
    gen("def set_args(%s):" % (", ".join(["self"] + arg_names)))

    with Indentation(gen):
        add_local_imports(gen)
        gen.extend(err_handler)

    # }}}

    return gen.get_picklable_module(), enqueue_name


invoker_cache = WriteOncePersistentDict("pyopencl-invoker-cache-v1",
                                        key_builder=_NumpyTypesKeyBuilder())


def generate_enqueue_and_set_args(function_name, num_passed_args, num_cl_args,
                                  scalar_arg_dtypes, work_around_arg_count_bug,
                                  warn_about_arg_count_bug):

    cache_key = (function_name, num_passed_args, num_cl_args,
                 scalar_arg_dtypes, work_around_arg_count_bug,
                 warn_about_arg_count_bug)

    from_cache = False

    try:
        result = invoker_cache[cache_key]
        from_cache = True
Esempio n. 2
0
    gen("")
    gen("def set_args(%s):"
            % (", ".join(["self"] + arg_names)))

    with Indentation(gen):
        add_local_imports(gen)
        gen.extend(err_handler)

    # }}}

    return gen.get_picklable_module(), enqueue_name


invoker_cache = WriteOncePersistentDict(
        "pyopencl-invoker-cache-v1",
        key_builder=_NumpyTypesKeyBuilder())


def generate_enqueue_and_set_args(function_name,
        num_passed_args, num_cl_args,
        scalar_arg_dtypes,
        work_around_arg_count_bug, warn_about_arg_count_bug):

    cache_key = (function_name, num_passed_args, num_cl_args,
            scalar_arg_dtypes,
            work_around_arg_count_bug, warn_about_arg_count_bug)

    from_cache = False

    try:
        result = invoker_cache[cache_key]