Skip to content

Commit 7ec40a2

Browse files
committed
Use CL_DEVICE_TYPE_ALL for all samples.
This increases the chance that they will just work for most users. Previously there was a mixture of CPU and GPU, which only works if users have both CPU and GPU OpenCL devices.
1 parent fd75b40 commit 7ec40a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+50
-55
lines changed

src/samples/example_chbmv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ main(void)
9191
return 1;
9292
}
9393

94-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
94+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
9595
if (err != CL_SUCCESS) {
9696
printf( "clGetDeviceIDs() failed with %d\n", err );
9797
return 1;

src/samples/example_cher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ main(void)
8484
return 1;
8585
}
8686

87-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
87+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
8888
if (err != CL_SUCCESS) {
8989
printf( "clGetDeviceIDs() failed with %d\n", err );
9090
return 1;

src/samples/example_cher2k.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ main(void)
100100
return 1;
101101
}
102102

103-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
103+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
104104
if (err != CL_SUCCESS) {
105105
printf( "clGetDeviceIDs() failed with %d\n", err );
106106
return 1;

src/samples/example_chpmv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ main(void)
8888
return 1;
8989
}
9090

91-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
91+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
9292
if (err != CL_SUCCESS) {
9393
printf( "clGetDeviceIDs() failed with %d\n", err );
9494
return 1;

src/samples/example_chpr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ main(void)
9090
return 1;
9191
}
9292

93-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
93+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
9494
if (err != CL_SUCCESS) {
9595
printf( "clGetDeviceIDs() failed with %d\n", err );
9696
return 1;

src/samples/example_csscal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ main(void)
7373
return 1;
7474
}
7575

76-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
76+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
7777
if (err != CL_SUCCESS) {
7878
printf( "clGetDeviceIDs() failed with %d\n", err );
7979
return 1;

src/samples/example_ctrsm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int
8181
main(void)
8282
{
8383
cl_int err;
84-
cl_platform_id platform[] = { 0, 0 };
84+
cl_platform_id platform = 0;
8585
cl_device_id device = 0;
8686
cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 };
8787
cl_context ctx = 0;
@@ -97,7 +97,7 @@ main(void)
9797
return 1;
9898
}
9999

100-
err = clGetDeviceIDs(platform[0], CL_DEVICE_TYPE_CPU, 1, &device, NULL);
100+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
101101
if (err != CL_SUCCESS) {
102102
printf( "clGetDeviceIDs() failed with %d\n", err );
103103
return 1;

src/samples/example_dtrmv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ main(void)
9595
return 1;
9696
}
9797

98-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
98+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
9999
if (err != CL_SUCCESS) {
100100
printf( "clGetDeviceIDs() failed with %d\n", err );
101101
return 1;

src/samples/example_isamax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ main(void)
6363
return 1;
6464
}
6565

66-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
66+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
6767
if (err != CL_SUCCESS) {
6868
printf( "clGetDeviceIDs() failed with %d\n", err );
6969
return 1;

src/samples/example_sasum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ main(void)
6161
return 1;
6262
}
6363

64-
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 1, &device, NULL);
64+
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
6565
if (err != CL_SUCCESS) {
6666
printf( "clGetDeviceIDs() failed with %d\n", err );
6767
return 1;

0 commit comments

Comments
 (0)