test_ipc.py 431 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import dgl
import torch as th
import torch.multiprocessing as mp
import os
import unittest

def sub_ipc(g):
    print(g)
    return g

@unittest.skipIf(os.name == 'nt', reason='Do not support windows yet')
def test_torch_ipc():
    g = dgl.graph([(0, 1), (1, 2), (2, 3)])
    ctx = mp.get_context("spawn")
    p = ctx.Process(target=sub_ipc, args=(g, ))

    p.start()
    p.join()


if __name__ == "__main__":
    test_torch_ipc()