test_ipc.py 429 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
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():
13
    g = dgl.graph(([0, 1, 2], [1, 2, 3]))
14
15
16
17
18
19
20
21
22
    ctx = mp.get_context("spawn")
    p = ctx.Process(target=sub_ipc, args=(g, ))

    p.start()
    p.join()


if __name__ == "__main__":
    test_torch_ipc()