Skip to content

Commit d046172

Browse files
authored
Merge pull request #37 from quic/apandit_dev
standard error prints on Open CL execution failure.
2 parents 211f03a + 0bb151f commit d046172

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

OpenCL-Application/matrix_multiply/matrix_multiply.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const int Ndim = 20;
2828
const int Mdim = 20;
2929
const int Pdim = 20;
3030

31-
// read file to string
3231
int convertToString(const char *filename, std::string& str) {
3332
using std::fstream;
3433
char* filestr;
@@ -51,21 +50,28 @@ int convertToString(const char *filename, std::string& str) {
5150
}
5251

5352
void cl_init() {
53+
using std::cout;
54+
using std::endl;
5455
status = clGetPlatformIDs(1, &platform, NULL);
5556
if (status < 0) {
5657
perror("Couldn't identify a platform");
58+
cout<<"error, when identifying the platform. FATAL::exit()" << endl;
59+
5760
exit(1);
5861
}
5962
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
6063
if (status < 0) {
6164
perror("Couldn't access any devices");
65+
cout<<"error, access any devices. FATAL::exit()" << endl;
66+
6267
exit(1);
6368
}
6469
context = clCreateContext(NULL, 1, &device, NULL, NULL, NULL);
6570
commandQueue = clCreateCommandQueue(context, device, CL_QUEUE_PROFILING_ENABLE, NULL);
6671

6772
if (commandQueue == NULL) {
6873
perror("Failed to create commandQueue for device 0.");
74+
cout<<"error, Failed to create commandQueue for device 0." << endl;
6975
}
7076
}
7177

0 commit comments

Comments
 (0)