2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
15 #include "cuda_common.h"
18 /* Open the host .cu file and the kernel .hu and .cu files for writing.
19 * Add the necessary includes.
21 void cuda_open_files(struct cuda_info
*info
, const char *input
)
26 len
= ppcg_extract_base_name(name
, input
);
28 strcpy(name
+ len
, "_host.cu");
29 info
->host_c
= fopen(name
, "w");
31 strcpy(name
+ len
, "_kernel.cu");
32 info
->kernel_c
= fopen(name
, "w");
34 strcpy(name
+ len
, "_kernel.hu");
35 info
->kernel_h
= fopen(name
, "w");
36 fprintf(info
->host_c
, "#include <assert.h>\n");
37 fprintf(info
->host_c
, "#include <stdio.h>\n");
38 fprintf(info
->host_c
, "#include \"%s\"\n", name
);
39 fprintf(info
->kernel_c
, "#include \"%s\"\n", name
);
40 fprintf(info
->kernel_h
, "#include \"cuda.h\"\n\n");
43 /* Close all output files.
45 void cuda_close_files(struct cuda_info
*info
)
47 fclose(info
->kernel_c
);
48 fclose(info
->kernel_h
);