diff --git a/parl/remote/tests/paddle_gpu_test.py b/parl/remote/tests/paddle_gpu_test.py index 256814c24ad533b107308d04b6f4b13d5291b3b1..d2d433ab089d93653a152c1a22350922636b7df1 100644 --- a/parl/remote/tests/paddle_gpu_test.py +++ b/parl/remote/tests/paddle_gpu_test.py @@ -28,8 +28,8 @@ import os @parl.remote_class class Actor(object): - def __init__(self): - if parl.utils.is_gpu_available(): + def __init__(self, cuda=False): + if cuda: place = fluid.CUDAPlace(0) else: place = fluid.CPUPlace() @@ -51,7 +51,10 @@ class TestCluster(unittest.TestCase): parl.connect('localhost:8241') - actor = Actor() + if parl.utils.is_gpu_available(): + actor = Actor(cuda=True) + else: + actor = Actor(cuda=False) del actor master.exit()