MCPcopy Create free account
hub / github.com/Niko1221/Strata / prop_of

Function prop_of

engine/src/split/src/store.cpp:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41bool is_host(int loc) { return loc >= NCARD; }
42int card_of(int loc) { return loc % NCARD; }
43CUmemAllocationProp prop_of(int loc) {
44 CUmemAllocationProp p{};
45 p.type = CU_MEM_ALLOCATION_TYPE_PINNED;
46 p.requestedHandleTypes = CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR;
47 if (is_host(loc)) {
48 CUdevice d;
49 cu(cuDeviceGet(&d, card_of(loc)), "device");
50 int numa = 0;
51 cu(cuDeviceGetAttribute(&numa, CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID, d), "host NUMA id");
52 p.location.type = CU_MEM_LOCATION_TYPE_HOST_NUMA;
53 p.location.id = numa < 0 ? 0 : numa;
54 } else {
55 p.location.type = CU_MEM_LOCATION_TYPE_DEVICE;
56 p.location.id = loc;
57 }
58 return p;
59}
60// device chunks: their card; host chunks: every card and the CPU. A worker maps the holder's chunks read only: the
61// weights are shared by every later worker, and a stray write by a faulting kernel (CUDA traps none inside an
62// allocation) would poison them for all of them; read only, it faults in the worker that made it

Callers 2

grantFunction · 0.85
takeMethod · 0.85

Calls 3

is_hostFunction · 0.85
card_ofFunction · 0.85
cuFunction · 0.70

Tested by

no test coverage detected