c - Passing the PTX program to the CUDA driver directly -
the cuda driver api provides loading file containing ptx code filesystem. 1 following:
cumodule module; cufunction function; const char* module_file = "my_prg.ptx"; const char* kernel_name = "vector_add"; err = cumoduleload(&module, module_file); err = cumodulegetfunction(&function, module, kernel_name); in case 1 generates ptx files during runtime (on fly) going through file io seems waste (since driver has load in again).
is there way pass ptx program cuda driver directly (e.g. c string) ?
taken ptxjit cuda example:
define ptx program c string as
char myptx32[] = "\n\ .version 1.4\n\ .target sm_10, map_f64_to_f32\n\ .entry _z8mykernelpi (\n\.param .u32 __cudaparm__z8mykernelpi_data)\n\ {\n\ .reg .u16 %rh<4>;\n\ .reg .u32 %r<8>;\n\ // other stuff .loc 28 18 0\n\ exit;\n\ }\n\ "; then
cumoduleloaddataex(phmodule, myptx32, 0, 0, 0); and finally
cumoduleloaddataex(phmodule, myptx, 0, 0, 0);
Comments
Post a Comment