summaryrefslogtreecommitdiff
path: root/libcuda
diff options
context:
space:
mode:
authorAhmad Alawneh <[email protected]>2023-06-12 22:00:22 -0400
committerAhmad Alawneh <[email protected]>2023-06-12 22:00:22 -0400
commitcb565024f23f1ab6b11d3717967b559aa49f3333 (patch)
tree721ac3c41294ef2071b08ebc9442690843813ad0 /libcuda
parent5c16d70a65e3e68803074fb7d8ba0324fc2355bf (diff)
more unused var fixes
Diffstat (limited to 'libcuda')
-rw-r--r--libcuda/cuda_runtime_api.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index 12d3aac..bc7ad38 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -464,6 +464,10 @@ static int get_app_cuda_version() {
" | grep libcudart.so | sed 's/.*libcudart.so.\\(.*\\) =>.*/\\1/' > " +
fname;
int res = system(app_cuda_version_command.c_str());
+ if(res == -1){
+ printf("Error - Cannot detect the app's CUDA version.\n");
+ exit(1);
+ }
FILE *cmd = fopen(fname, "r");
char buf[256];
while (fgets(buf, sizeof(buf), cmd) != 0) {
@@ -3235,6 +3239,11 @@ char *readfile(const std::string filename) {
// allocate and copy the entire ptx
char *ret = (char *)malloc((filesize + 1) * sizeof(char));
int num = fread(ret, 1, filesize, fp);
+ if(num == 0){
+ std::cout << "ERROR: Could not read data from file %s\n"
+ << filename << std::endl;
+ assert(0);
+ }
ret[filesize] = '\0';
fclose(fp);
return ret;