diff --git a/python/paddle/fluid/tests/unittests/ipu/ernie_training.py b/python/paddle/fluid/tests/unittests/ipu/ernie_training.py index bedf0a38549b8ebd23563389e05dff6f26967933..ddda666db2c0cb043624ff7249d0ea08c455c0a4 100644 --- a/python/paddle/fluid/tests/unittests/ipu/ernie_training.py +++ b/python/paddle/fluid/tests/unittests/ipu/ernie_training.py @@ -856,16 +856,15 @@ if __name__ == "__main__": paddle.static.load(main_prog, "model/ernie") if args.run_on_ipu: - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.num_ipus = args.num_ipus - ipu_strategy.enable_manual_shard = args.num_ipus > 1 - ipu_strategy.enable_pipelining = args.enable_pipelining - if args.enable_pipelining: - if args.is_training: - ipu_strategy.batches_per_step = args.num_ipus + 1 - else: - ipu_strategy.batches_per_step = args.num_ipus - ipu_strategy.is_training = args.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig( + num_ipus=args.num_ipus, + is_training=args.is_training, + enable_manual_shard=args.num_ipus > 1) + ipu_strategy.SetPipeliningConfig( + enable_pipelining=args.enable_pipelining, + batches_per_step=args.num_ipus + 1) + ipu_compiler = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy) program = ipu_compiler.compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_activation_x_op.py b/python/paddle/fluid/tests/unittests/ipu/test_activation_x_op.py index 0f726accfa83c66784ef51bddd660c20e7968ffd..58a88c113fc0b6b82c1c58d50a1b0824cb530632 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_activation_x_op.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_activation_x_op.py @@ -72,8 +72,8 @@ class TestRelu(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IpuCompiler( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_avg_shard_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_avg_shard_ipu.py index c4d8b3ee89f439091e065dbfe5d3277c3e16b64b..a23cacf47636b434b3211ca377e8e6a5e79fa64b 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_avg_shard_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_avg_shard_ipu.py @@ -81,10 +81,12 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training - # enable avg shard pass - ipu_strategy.need_avg_shard = True + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig( + num_ipus=2, + is_training=self.is_training, + enable_manual_shard=True, + need_avg_shard=True) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_batch_norm_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_batch_norm_op_ipu.py index ee81354c44620e3807e3c191be7fa62c0a9473c4..87f783dbd1c1aef2f5bcc40b407dff9f4bbe0916 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_batch_norm_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_batch_norm_op_ipu.py @@ -79,8 +79,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_cast_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_cast_op_ipu.py index 19026f5e05989c97b655da020a94a15f7b4fe0fe..6e58f809046000bb7a41b9875f9ebf945b86fd07 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_cast_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_cast_op_ipu.py @@ -81,8 +81,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_concat_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_concat_op_ipu.py index 2b59f2bb729e4f5e12eec0c1f72dec2ff292536f..094b19ce99da9c73c188f000dc7080504bc9ff3e 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_concat_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_concat_op_ipu.py @@ -83,8 +83,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_conv_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_conv_op_ipu.py index fb237c30d49cdc7345275558de3350c69fcd480b..f28733de6b1a12a8aac362e30c8478a145520506 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_conv_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_conv_op_ipu.py @@ -81,8 +81,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_cross_entropy2_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_cross_entropy2_op_ipu.py index 9d49b054370b7a9bad1f85bd2a57dfcf840d8b25..3987c6cd5b386ae22a2fcac1a985e5e915a3e5ae 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_cross_entropy2_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_cross_entropy2_op_ipu.py @@ -93,8 +93,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_dropout_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_dropout_op_ipu.py index 1cd2037f2283e012918303b051396b9b0abb1977..8b1560edfd81de65f495a1bd0609bfa09c5f7810 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_dropout_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_dropout_op_ipu.py @@ -83,8 +83,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_elemetwise_x_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_elemetwise_x_op_ipu.py index 4aa202ace2fc278c9c0835d7910448e9d0871cce..07b06d77c90ffb41d3a221c94d52bdc2c7d1a3a5 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_elemetwise_x_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_elemetwise_x_op_ipu.py @@ -75,8 +75,8 @@ class TestMul(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_equal_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_equal_op_ipu.py index b2548a17634d721b882509ea5bd27bc459120f38..c319894bfae250789bf9931343ac29106629a148 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_equal_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_equal_op_ipu.py @@ -84,8 +84,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_expand_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_expand_op_ipu.py index 018c9a7876f886093c9e8345f073ceaa08eb237a..5b7ea61568ecd5772d574dd3cc63fac74535c903 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_expand_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_expand_op_ipu.py @@ -76,8 +76,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) @@ -142,8 +142,8 @@ class TestCase1(TestBase): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_fill_constant_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_fill_constant_op_ipu.py index 6a43fb46eea496ca42f2863cdbf4b20ace1677fe..c62e0c08f9c79c2ee1217b2b74df84c26cf30f1f 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_fill_constant_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_fill_constant_op_ipu.py @@ -78,8 +78,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_gather_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_gather_op_ipu.py index af220a34ddb02652edf690c700309830b5914733..d5be8ae0cf77526a6aefa1fd060a510689c43cc0 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_gather_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_gather_op_ipu.py @@ -83,8 +83,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_gelu_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_gelu_op_ipu.py index 6c9d3f29adf3c0674045e653572e892141b699c7..ca8c0935d782cc275838871e2c73a3eba9454e5b 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_gelu_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_gelu_op_ipu.py @@ -81,8 +81,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list)