MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / shared_open

Function shared_open

csrc/cpu/comm/shm.cpp:50–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50void shared_open(SharedData* data, const char* name, size_t nbytes)
51{
52 int d = shm_open(name, O_RDWR, S_IRUSR | S_IWUSR);
53 if (d != -1) {
54 void* bytes = mmap(NULL, nbytes, PROT_READ | PROT_WRITE, MAP_SHARED, d, 0);
55 data->name = name;
56 data->descriptor = d;
57 data->bytes = bytes;
58 data->nbytes = nbytes;
59 } else {
60 if (errno != ENOENT) {
61 // don't print if shm can not be found because we want to loop over from
62 // caller again until the other ranks created the shm
63 printf("shared_open %s failed, errno=%d\n", name, errno);
64 }
65 data->descriptor = -1;
66 }
67}
68
69void shared_create(SharedData* data, const char* name, void* bytes, size_t nbytes)
70{

Callers 2

shared_createFunction · 0.85
shm_initializeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected