Fix #163 : remove warnings
This commit is contained in:
parent
8606cdb8b2
commit
469b69a5d0
@ -12,13 +12,16 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define BUSID_SIZE (sizeof("0000:00:00.0"))
|
||||||
|
#define BUSID_REDUCED_SIZE (sizeof("0000:00"))
|
||||||
|
|
||||||
static ncclResult_t getCudaPath(int cudaDev, char** path) {
|
static ncclResult_t getCudaPath(int cudaDev, char** path) {
|
||||||
char busId[16];
|
char busId[BUSID_SIZE];
|
||||||
CUDACHECK(cudaDeviceGetPCIBusId(busId, 16, cudaDev));
|
CUDACHECK(cudaDeviceGetPCIBusId(busId, BUSID_SIZE, cudaDev));
|
||||||
for (int i=0; i<16; i++) busId[i] = tolower(busId[i]);
|
for (int i=0; i<BUSID_SIZE; i++) busId[i] = tolower(busId[i]);
|
||||||
char busPath[] = "/sys/class/pci_bus/0000:00/../../0000:00:00.0";
|
char busPath[] = "/sys/class/pci_bus/0000:00/../../0000:00:00.0";
|
||||||
memcpy(busPath+sizeof("/sys/class/pci_bus/")-1, busId, sizeof("0000:00")-1);
|
memcpy(busPath+sizeof("/sys/class/pci_bus/")-1, busId, BUSID_REDUCED_SIZE-1);
|
||||||
memcpy(busPath+sizeof("/sys/class/pci_bus/0000:00/../../")-1, busId, sizeof("0000:00:00.0")-1);
|
memcpy(busPath+sizeof("/sys/class/pci_bus/0000:00/../../")-1, busId, BUSID_SIZE-1);
|
||||||
*path = realpath(busPath, NULL);
|
*path = realpath(busPath, NULL);
|
||||||
if (*path == NULL) {
|
if (*path == NULL) {
|
||||||
WARN("Could not find real path of %s", busPath);
|
WARN("Could not find real path of %s", busPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user