Skip to content

Commit

Permalink
replaced with xmp spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
lezwon committed Aug 30, 2020
1 parent 4a1701c commit 6835380
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/models/test_tpu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from multiprocessing import Process, Queue
from multiprocessing import Queue

import pytest
from torch.utils.data import DataLoader
Expand All @@ -21,9 +21,7 @@ def tpu_device_exists(q):
q.put(device_type == 'TPU')

queue = Queue()
p = Process(target=tpu_device_exists, args=(queue, ))
p.start()
p.join()
xmp.spawn(lambda rank, queue: tpu_device_exists(queue), (queue, ), nprocs=1, start_method='fork')
TPU_AVAILABLE = queue.get()
except ImportError:
TPU_AVAILABLE = False
Expand Down

0 comments on commit 6835380

Please sign in to comment.