summaryrefslogtreecommitdiff
path: root/libcuda
diff options
context:
space:
mode:
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;