[go: nahoru, domu]

Skip to content

Commit

Permalink
Add multi worker mirrored strategy combinations to enable easier test…
Browse files Browse the repository at this point in the history
…ing again

The previous was rolled back because it breaks windows builds.

The change adds has_chief and num_workers to NamedDistribution. If there're more than one workers (chief+workers), the distribute flavor of combinations library will run the test in multiple processes to simulate a multi worker setup. Users are required to call combinations.main() instead of test.main().

Note that it's the same as running the test concurrently in multiple processes. You're expected to program your test in the same as if you're writing a multi client program. There's no way to get the return value from all processes. If you need that, use multi_process_runner directly.

This is very slow at this moment. Do not use it for a large number of tests.

PiperOrigin-RevId: 305136390
Change-Id: I814323cccaee5b8b7eed3b4dfef2971ab9d09cb4
  • Loading branch information
crccw authored and tensorflower-gardener committed Apr 6, 2020
1 parent fdee589 commit 64f4a59
Show file tree
Hide file tree
Showing 6 changed files with 481 additions and 108 deletions.
1 change: 1 addition & 0 deletions tensorflow/examples/saved_model/integration_tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ cuda_py_test(
":distribution_strategy_utils",
":integration_scripts",
"//tensorflow:tensorflow_py",
"//tensorflow/python:framework_combinations",
"//tensorflow/python/distribute:combinations",
"@absl_py//absl/testing:parameterized",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

from tensorflow.examples.saved_model.integration_tests import distribution_strategy_utils as ds_utils
from tensorflow.examples.saved_model.integration_tests import integration_scripts as scripts
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import combinations as distribute_combinations
from tensorflow.python.framework import combinations


class SavedModelTest(scripts.TestCase, parameterized.TestCase):
Expand Down Expand Up @@ -89,8 +90,8 @@ def test_text_embedding_in_dataset(self):
retrain_flag_value=["true", "false"],
regularization_loss_multiplier=[None, 2], # Test for b/134528831.
)),
test_combinations=(combinations.NamedGPUCombination(),
combinations.NamedTPUCombination()))
test_combinations=(distribute_combinations.NamedGPUCombination(),
distribute_combinations.NamedTPUCombination()))

@combinations.generate(**TEST_MNIST_CNN_GENERATE_KWARGS)
def test_mnist_cnn(self, use_keras_save_api, named_strategy,
Expand Down
Loading

0 comments on commit 64f4a59

Please sign in to comment.