diff --git a/python/paddle/v2/framework/tests/test_nccl_init_op.py b/python/paddle/v2/framework/tests/test_nccl_init_op.py index 03d46d1c600afc40de0ee5d28d8259135999436a..9fd4b3e07c3f58f6ac2c396ba913f276a953f5a7 100644 --- a/python/paddle/v2/framework/tests/test_nccl_init_op.py +++ b/python/paddle/v2/framework/tests/test_nccl_init_op.py @@ -8,7 +8,7 @@ from op_test import OpTest, create_op, set_input if not core.is_compile_gpu(): exit(0) -gpu_count = core.get_cuda_device_count +gpu_count = core.get_cuda_device_count() g_scope = core.Scope() g_ctx = core.DeviceContext.create(core.CPUPlace()) @@ -16,7 +16,7 @@ g_ctx = core.DeviceContext.create(core.CPUPlace()) class TestNCCLInit(unittest.TestCase): def test_init(self): self.op_type = "ncclInit" - self.gpus = [int(g) for g in range(gpu_count)] + self.gpus = range(gpu_count) self.inputs = {} self.attrs = {"gpus": self.gpus}