Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using cuda synthetic face data in MXFaceDataset #2578

Open
ericyq opened this issue May 11, 2024 · 0 comments
Open

using cuda synthetic face data in MXFaceDataset #2578

ericyq opened this issue May 11, 2024 · 0 comments

Comments

@ericyq
Copy link

ericyq commented May 11, 2024

latents = net(inputs.to("cuda").float(), randomize_noise=False, return_latents=True)
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

1st method
torch.multiprocessing.set_start_method("spawn", force=True)
or
2nd method
from multiprocessing import Pool

def test(arg1, arg2):
return "hello," + arg1, arg2 + ' test', [2222, 5, 356]

if name == 'main':
p = Pool(2)
results = []
rslt1 = p.apply_async(test, ('world1', 'tea',))
results.append(rslt1)
rslt2 = p.apply_async(test, ('world2', 'cat',))
results.append(rslt2)
for r in results:
a, b, c = r.get()
print(a, b, c)
hello,world1 tea test [2222, 5, 356]
hello,world1 cat test [2222, 5, 356]

Stop for a long time to report errors:
RuntimeError: Timed out initializing process group in store based barrier on rank: 1, for key: store_based_barrier_key:1 (world_size=2, worker_count=4, timeout=0:30:00)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant