Skip to content

Commit 8c76473

Browse files
committed
added support for 'device' module for GPGPU OpenCL and CUDA benchmarks
1 parent 20fae1c commit 8c76473

31 files changed

Lines changed: 136 additions & 46 deletions

File tree

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* 2016.09.23 added support for 'device' module for GPGPU OpenCL programs
1+
* 2016.09.23 added support for 'device' module for GPGPU OpenCL and CUDA benchmarks
22

33
* 2016.05.06 adding simple JULIA bench demo (after MIT visit)
44

program/polybench-cuda-2dconv/.cm/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
],
5151
"ignore_return_code": "no",
5252
"run_time": {
53+
"need_gpgpu_device":"cuda",
5354
"fine_grain_timer_file": "tmp-ck-timer.json",
5455
"run_cmd_main": "$#BIN_FILE#$ ",
5556
"run_cmd_out1": "tmp-output1.tmp",

program/polybench-cuda-2dconv/2DConvolution.cu

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,18 @@ void compareResults(DATA_TYPE* B, DATA_TYPE* B_outputFromGpu)
122122

123123
void GPU_argv_init()
124124
{
125+
/* Grigori Fursin added support for CK widgets */
126+
int gpgpu_device_id=GPU_DEVICE;
127+
125128
int devID = 0;
126129
cudaError_t error;
127130
cudaDeviceProp deviceProp;
128131
error = cudaGetDevice(&devID);
129132

130-
cudaGetDeviceProperties(&deviceProp, GPU_DEVICE);
131-
133+
if (getenv("CK_GPGPU_DEVICE_ID")!=NULL) gpgpu_device_id=atol(getenv("CK_GPGPU_DEVICE_ID"));
134+
135+
cudaGetDeviceProperties(&deviceProp, gpgpu_device_id);
136+
132137
if (deviceProp.computeMode == cudaComputeModeProhibited)
133138
{
134139
printf("Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
@@ -140,7 +145,7 @@ void GPU_argv_init()
140145
else
141146
printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
142147

143-
cudaSetDevice( GPU_DEVICE );
148+
cudaSetDevice( gpgpu_device_id );
144149
}
145150

146151

program/polybench-cuda-2mm/.cm/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
],
5252
"ignore_return_code": "no",
5353
"run_time": {
54+
"need_gpgpu_device":"cuda",
5455
"fine_grain_timer_file": "tmp-ck-timer.json",
5556
"run_cmd_main": "$#BIN_FILE#$ ",
5657
"run_cmd_out1": "tmp-output1.tmp",

program/polybench-cuda-2mm/2mm.cu

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,18 @@ void compareResults(DATA_TYPE *E, DATA_TYPE *E_outputFromGpu)
126126

127127
void GPU_argv_init()
128128
{
129+
/* Grigori Fursin added support for CK widgets */
130+
int gpgpu_device_id=GPU_DEVICE;
131+
129132
int devID = 0;
130133
cudaError_t error;
131134
cudaDeviceProp deviceProp;
132135
error = cudaGetDevice(&devID);
133136

134-
cudaGetDeviceProperties(&deviceProp, GPU_DEVICE);
135-
137+
if (getenv("CK_GPGPU_DEVICE_ID")!=NULL) gpgpu_device_id=atol(getenv("CK_GPGPU_DEVICE_ID"));
138+
139+
cudaGetDeviceProperties(&deviceProp, gpgpu_device_id);
140+
136141
if (deviceProp.computeMode == cudaComputeModeProhibited)
137142
{
138143
printf("Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
@@ -144,7 +149,7 @@ void GPU_argv_init()
144149
else
145150
printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
146151

147-
cudaSetDevice( GPU_DEVICE );
152+
cudaSetDevice( gpgpu_device_id );
148153
}
149154

150155

program/polybench-cuda-3dconv/.cm/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
],
5151
"ignore_return_code": "no",
5252
"run_time": {
53+
"need_gpgpu_device":"cuda",
5354
"fine_grain_timer_file": "tmp-ck-timer.json",
5455
"run_cmd_main": "$#BIN_FILE#$ ",
5556
"run_cmd_out1": "tmp-output1.tmp",

program/polybench-cuda-3dconv/3DConvolution.cu

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,18 @@ void compareResults(DATA_TYPE* B, DATA_TYPE* B_outputFromGpu)
136136

137137
void GPU_argv_init()
138138
{
139+
/* Grigori Fursin added support for CK widgets */
140+
int gpgpu_device_id=GPU_DEVICE;
141+
139142
int devID = 0;
140143
cudaError_t error;
141144
cudaDeviceProp deviceProp;
142145
error = cudaGetDevice(&devID);
143146

144-
cudaGetDeviceProperties(&deviceProp, GPU_DEVICE);
145-
147+
if (getenv("CK_GPGPU_DEVICE_ID")!=NULL) gpgpu_device_id=atol(getenv("CK_GPGPU_DEVICE_ID"));
148+
149+
cudaGetDeviceProperties(&deviceProp, gpgpu_device_id);
150+
146151
if (deviceProp.computeMode == cudaComputeModeProhibited)
147152
{
148153
printf("Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
@@ -154,7 +159,7 @@ void GPU_argv_init()
154159
else
155160
printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
156161

157-
cudaSetDevice( GPU_DEVICE );
162+
cudaSetDevice( gpgpu_device_id );
158163
}
159164

160165

program/polybench-cuda-3mm/.cm/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
],
5353
"ignore_return_code": "no",
5454
"run_time": {
55+
"need_gpgpu_device":"cuda",
5556
"fine_grain_timer_file": "tmp-ck-timer.json",
5657
"run_cmd_main": "$#BIN_FILE#$ ",
5758
"run_cmd_out1": "tmp-output1.tmp",

program/polybench-cuda-3mm/3mm.cu

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,18 @@ void compareResults(DATA_TYPE *G, DATA_TYPE *G_outputFromGpu)
129129

130130
void GPU_argv_init()
131131
{
132+
/* Grigori Fursin added support for CK widgets */
133+
int gpgpu_device_id=GPU_DEVICE;
134+
132135
int devID = 0;
133136
cudaError_t error;
134137
cudaDeviceProp deviceProp;
135138
error = cudaGetDevice(&devID);
136139

137-
cudaGetDeviceProperties(&deviceProp, GPU_DEVICE);
138-
140+
if (getenv("CK_GPGPU_DEVICE_ID")!=NULL) gpgpu_device_id=atol(getenv("CK_GPGPU_DEVICE_ID"));
141+
142+
cudaGetDeviceProperties(&deviceProp, gpgpu_device_id);
143+
139144
if (deviceProp.computeMode == cudaComputeModeProhibited)
140145
{
141146
printf("Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n");
@@ -147,7 +152,7 @@ void GPU_argv_init()
147152
else
148153
printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
149154

150-
cudaSetDevice( GPU_DEVICE );
155+
cudaSetDevice( gpgpu_device_id );
151156
}
152157

153158

program/polybench-cuda-atax/.cm/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
],
5050
"ignore_return_code": "no",
5151
"run_time": {
52+
"need_gpgpu_device":"cuda",
5253
"fine_grain_timer_file": "tmp-ck-timer.json",
5354
"run_cmd_main": "$#BIN_FILE#$ ",
5455
"run_cmd_out1": "tmp-output1.tmp",

0 commit comments

Comments
 (0)