Skip to content

Commit 2d6ee2a

Browse files
committed
Correction: using driver API instead of runtime API.
Recompiled and retested successfully.
1 parent 2bcb605 commit 2d6ee2a

3 files changed

Lines changed: 2 additions & 47 deletions

File tree

src/gpuarray_buffer_cuda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ static int cuda_property(gpucontext *c, gpudata *buf, gpukernel *k, int prop_id,
15151515
cuda_exit(ctx);
15161516
return GA_MEMORY_ERROR;
15171517
}
1518-
ctx->err = cudaDeviceGetPCIBusId(s, 13, id);
1518+
ctx->err = cuDeviceGetPCIBusId(s, 13, id);
15191519
if (ctx->err != CUDA_SUCCESS) {
15201520
/* PS: in GA_CTX_PROP_DEVNAME above, s is not freed here.
15211521
* I think it should be freed, isn't it ? */

src/gpuarray_buffer_opencl.c

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,14 +1152,6 @@ static int cl_property(gpucontext *c, gpudata *buf, gpukernel *k, int prop_id,
11521152
size_t *psz;
11531153
cl_device_id id;
11541154
cl_uint ui;
1155-
/* For GA_CTX_PROP_PCIBUSID (currently desactivated).
1156-
* According to http://www.makelinux.net/ldd3/chp-12-sect-1
1157-
* (accessed on 2016/11/09:15h41 EST):
1158-
* domain: 16 bits, bus: 8 bits, device: 5 bits, function: 3 bits. */
1159-
/*
1160-
uint32_t* busid;
1161-
uint32_t domain = 0, bus = 0, device = 0, function = 0;
1162-
*/
11631155

11641156
case GA_CTX_PROP_DEVNAME:
11651157
ctx->err = clGetContextInfo(ctx->ctx, CL_CONTEXT_DEVICES, sizeof(id),
@@ -1181,42 +1173,7 @@ static int cl_property(gpucontext *c, gpudata *buf, gpukernel *k, int prop_id,
11811173
return GA_NO_ERROR;
11821174

11831175
case GA_CTX_PROP_PCIBUSID:
1184-
/* PS: Currently desactivated. This does not print the same
1185-
* Bus ID as cuda and nvidia-smi. For the moment, I don't find
1186-
* which info will display the correct PCI Bus ID with OpenCL. */
1187-
/*
1188-
ctx->err = clGetContextInfo(ctx->ctx, CL_CONTEXT_DEVICES, sizeof(id),
1189-
&id, NULL);
1190-
if (ctx->err != CL_SUCCESS)
1191-
return GA_IMPL_ERROR;
1192-
ctx->err = clGetDeviceInfo(id, CL_DEVICE_VENDOR_ID, 0, NULL, &sz);
1193-
if (ctx->err != CL_SUCCESS)
1194-
return GA_IMPL_ERROR;
1195-
if(sz != 4)
1196-
return GA_IMPL_ERROR;
1197-
busid = malloc(sz);
1198-
if (busid == NULL)
1199-
return GA_MEMORY_ERROR;
1200-
ctx->err = clGetDeviceInfo(id, CL_DEVICE_VENDOR_ID, sz, busid, NULL);
1201-
if (ctx->err != CL_SUCCESS) {
1202-
free(busid);
1203-
return GA_IMPL_ERROR;
1204-
}
1205-
domain = *busid >> (32-16);
1206-
bus = *busid << 16 >> (32-8);
1207-
device = *busid << 24 >> (32-5);
1208-
function = *busid << 29 >> (32-3);
1209-
free(busid);
1210-
s = malloc(13);
1211-
sprintf(s, "%04x", domain);
1212-
sprintf(s + 5, "%02x", bus);
1213-
sprintf(s + 8, "%02x", device);
1214-
sprintf(s + 11, "%01x", function);
1215-
s[4] = s[7] = ':';
1216-
s[10] = '.';
1217-
*((char **)res) = s;
1218-
return GA_NO_ERROR;
1219-
*/
1176+
/* For the moment, PCI Bus ID is not supported for OpenCL. */
12201177
*((void **)res) = NULL;
12211178
return GA_DEVSUP_ERROR;
12221179

src/private_cuda.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
#ifdef __APPLE__
55
#include <CUDA/cuda.h>
6-
#include <CUDA/cuda_runtime_api.h>
76
#else
87
#include <cuda.h>
9-
#include <cuda_runtime_api.h>
108
#endif
119

1210
#include <cache.h>

0 commit comments

Comments
 (0)