/* Transform the code in the file called "input" by replacing * all scops by corresponding CUDA code. * The names of the output files are derived from "input". * * We let generate_gpu do all the hard work and then let it call * us back for printing the AST in print_cuda. * * To prepare for this printing, we first open the output files * and we close them after generate_gpu has finished. */ int generate_cuda(isl_ctx *ctx, struct ppcg_options *options, const char *input) { struct cuda_info cuda; int r; cuda_open_files(&cuda, input); r = generate_gpu(ctx, input, cuda.host_c, options, &print_cuda, &cuda); cuda_close_files(&cuda); return r; }
/* Transform the code in the file called "input" by replacing * all scops by corresponding OpenCL code. * The host code is written to "output" or a name derived from * "input" if "output" is NULL. * The kernel code is placed in separate files with names * derived from "output" or "input". * * We let generate_gpu do all the hard work and then let it call * us back for printing the AST in print_opencl. * * To prepare for this printing, we first open the output files * and we close them after generate_gpu has finished. */ int generate_opencl(isl_ctx *ctx, struct ppcg_options *options, const char *input, const char *output) { struct opencl_info opencl = { options, input, output }; int r; opencl.kprinter = isl_printer_to_str(ctx); r = opencl_open_files(&opencl); if (r >= 0) r = generate_gpu(ctx, input, opencl.host_c, options, &print_opencl, &opencl); if (opencl_close_files(&opencl) < 0) r = -1; isl_printer_free(opencl.kprinter); return r; }