QUDA
v1.1.0
A library for QCD on GPUs
quda
lib
numa_affinity.cpp
Go to the documentation of this file.
1
2
/* Originally from Galen Arnold, NCSA arnoldg@ncsa.illinois.edu
3
* modified by Guochun Shi
4
*
5
*/
6
7
#include <
numa_affinity.h
>
8
#include <
quda_internal.h
>
9
10
#ifdef NUMA_NVML
11
#include <nvml.h>
12
#endif
13
14
15
int
setNumaAffinityNVML
(
int
devid)
16
{
17
#ifdef NUMA_NVML
18
nvmlReturn_t result;
19
20
result = nvmlInit();
21
if
(NVML_SUCCESS != result)
22
{
23
warningQuda
(
"Failed to determine NUMA affinity for device %d (NVML Init failed)"
, devid);
24
return
-1;
25
}
26
nvmlDevice_t device;
27
result = nvmlDeviceGetHandleByIndex(devid, &device);
28
if
(NVML_SUCCESS != result)
29
{
30
warningQuda
(
"Failed to determine NUMA affinity for device %d (NVML DeviceGetHandle failed)"
, devid);
31
return
-1;
32
}
33
result = nvmlDeviceSetCpuAffinity(device);
34
if
(NVML_SUCCESS != result)
35
{
36
warningQuda
(
"Failed to determine NUMA affinity for device %d (NVML DeviceSetCpuAffinity failed)"
, devid);
37
return
-1;
38
}
39
else
{
40
printfQuda
(
"Set NUMA affinity for device %d (NVML DeviceSetCpuAffinity)\n"
, devid);
41
}
42
result = nvmlShutdown();
43
if
(NVML_SUCCESS != result)
44
{
45
warningQuda
(
"Failed to determine NUMA affinity for device %d (NVML Shutdown failed)"
, devid);
46
return
-1;
47
}
48
return
0;
49
#else
50
warningQuda
(
"Failed to determine NUMA affinity for device %d (NVML not supported in quda build)"
, devid);
51
return
-1;
52
#endif
53
}
setNumaAffinityNVML
int setNumaAffinityNVML(int devid)
Definition:
numa_affinity.cpp:15
numa_affinity.h
quda_internal.h
printfQuda
#define printfQuda(...)
Definition:
util_quda.h:114
warningQuda
#define warningQuda(...)
Definition:
util_quda.h:132
Generated on Thu Oct 28 2021 16:10:27 for QUDA by
1.9.1