flandre/test/legacy/test_process_cupy.py
2025-05-11 15:50:08 +08:00

32 lines
681 B
Python

import multiprocessing
from multiprocessing import Process
from threading import Thread
import cupy as cp
class TestProcessCupy:
def __init__(self):
pass
def t1(self):
print(cp.zeros((10, 10, 10)))
def __call__(self, *args, **kwargs):
print(cp.zeros((10, 10, 10)))
def p1():
# import cupy as cp
print(cp.zeros((10, 10, 10)))
# print(cp.asarray(z))
if __name__ == '__main__':
def ff():
print(cp.zeros((10, 10, 10)))
tpc = TestProcessCupy()
p2 = p1
z = cp.zeros((10, 10, 10))
multiprocessing.set_start_method('spawn')
# p = Process(target=p2)
p = Process(target=tpc)
p.start()
p.join()