| 58 | const char *sSDKname = "PTX Just In Time (JIT) Compilation (no-qatest)"; |
| 59 | |
| 60 | bool inline findModulePath(const char *module_file, std::string &module_path, char **argv, std::string &ptx_source) |
| 61 | { |
| 62 | char *actual_path = sdkFindFilePath(module_file, argv[0]); |
| 63 | |
| 64 | if (actual_path) { |
| 65 | module_path = actual_path; |
| 66 | } |
| 67 | else { |
| 68 | printf("> findModulePath file not found: <%s> \n", module_file); |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | if (module_path.empty()) { |
| 73 | printf("> findModulePath file not found: <%s> \n", module_file); |
| 74 | return false; |
| 75 | } |
| 76 | else { |
| 77 | printf("> findModulePath <%s>\n", module_path.c_str()); |
| 78 | |
| 79 | if (module_path.rfind(".ptx") != std::string::npos) { |
| 80 | FILE *fp = fopen(module_path.c_str(), "rb"); |
| 81 | fseek(fp, 0, SEEK_END); |
| 82 | int file_size = ftell(fp); |
| 83 | char *buf = new char[file_size + 1]; |
| 84 | fseek(fp, 0, SEEK_SET); |
| 85 | fread(buf, sizeof(char), file_size, fp); |
| 86 | fclose(fp); |
| 87 | buf[file_size] = '\0'; |
| 88 | ptx_source = buf; |
| 89 | delete[] buf; |
| 90 | } |
| 91 | |
| 92 | return true; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void ptxJIT(int argc, char **argv, CUmodule *phModule, CUfunction *phKernel, CUlinkState *lState) |
| 97 | { |
no test coverage detected