From cb565024f23f1ab6b11d3717967b559aa49f3333 Mon Sep 17 00:00:00 2001 From: Ahmad Alawneh Date: Mon, 12 Jun 2023 22:00:22 -0400 Subject: more unused var fixes --- libcuda/cuda_runtime_api.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libcuda') 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; -- cgit v1.3