def prepare_cuda_compilation(M):
    assert(len(M.entry_points) == 1)
    procedure_name = M.entry_points[0]
    hash, (wrap_type, wrap_name), wrap_args = M.wrap_info
    wrap_decl = CG.FunctionDeclaration(CG.Value(wrap_type, wrap_name),
                                       [CG.Value(x, y) for x, y in wrap_args])
    host_module = codepy.bpl.BoostPythonModule(max_arity=max(10,M.arity),
                                               use_private_namespace=False)
    host_module.add_to_preamble([
        CG.Include("prelude/runtime/cunp.hpp"),
        CG.Include("prelude/runtime/cuarray.hpp"),
        CG.Line('using namespace copperhead;')])
    device_module = codepy.cuda.CudaModule(host_module)
    hash_namespace_open = CG.Line(hash % 'namespace %s {')
    hash_namespace_close = CG.Line('}')
    using_declaration = CG.Line('using namespace %s;' % hash)
    host_module.add_to_preamble([hash_namespace_open, wrap_decl,
                                 hash_namespace_close, using_declaration])

    host_module.add_to_init([CG.Statement(
                "boost::python::def(\"%s\", &%s)" % (
                    procedure_name, wrap_name))])

    device_module.add_to_preamble(
        [CG.Include("prelude/prelude.h"),
         CG.Include("prelude/runtime/cunp.hpp"),
         CG.Include("prelude/runtime/make_cuarray.hpp"),
         CG.Include("prelude/runtime/make_sequence.hpp"),
         CG.Include("prelude/runtime/tuple_utilities.hpp"),
         CG.Line('using namespace copperhead;')])
    wrapped_cuda_code = [CG.Line(M.compiler_output)]
    device_module.add_to_module(wrapped_cuda_code)
    M.device_module = device_module
    if M.compile:
        M.current_toolchains = (M.toolchains.host_toolchain,
                                M.toolchains.nvcc_toolchain)
    else:
        M.current_toolchains = (M.toolchains.null_host_toolchain,
                                M.toolchains.null_nvcc_toolchain)
    M.codepy_module = device_module
    M.code = (str(host_module.generate()), str(device_module.generate()))
    M.kwargs = dict(host_kwargs=dict(cache_dir=M.code_dir),
                    nvcc_kwargs=dict(cache_dir=M.code_dir),
                    debug=M.verbose)
    return []
dataset/ETHPy150Open bryancatanzaro/copperhead/copperhead/compiler/binarygenerator.py/prepare_cuda_compilation/swapped operands of `%`