MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / loadProgramSource

Function loadProgramSource

cpp/7_libNVVM/simple/simple.c:103–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static char *loadProgramSource(const char *filename, size_t *size)
104{
105 assert(filename && size);
106 char *source = NULL;
107 *size = 0;
108 FILE *fh = fopen(filename, "rb");
109 if (fh) {
110 struct stat statbuf;
111 stat(filename, &statbuf);
112 source = malloc(statbuf.st_size + 1);
113 assert(source);
114 fread(source, statbuf.st_size, 1, fh);
115 source[statbuf.st_size] = 0;
116 *size = statbuf.st_size + 1;
117 }
118 else {
119 fprintf(stderr, "Error reading file %s\n", filename);
120 exit(EXIT_FAILURE);
121 }
122 return source;
123}
124
125static char *generatePTX(const char *ir, size_t size, const char *filename, int devMajor, int devMinor)
126{

Callers 1

mainFunction · 0.70

Calls 1

statClass · 0.70

Tested by

no test coverage detected