From 353f69c9edaab368a44746ecba8c2bf2cda8e4d9 Mon Sep 17 00:00:00 2001 From: Keith Alcock Date: Wed, 1 Jul 2020 11:21:53 -0700 Subject: [PATCH] Modify test to show it periodically failing --- tests/test-exec-dynamic.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test-exec-dynamic.cc b/tests/test-exec-dynamic.cc index 23b5b6971..f18916c2c 100644 --- a/tests/test-exec-dynamic.cc +++ b/tests/test-exec-dynamic.cc @@ -109,15 +109,18 @@ BOOST_AUTO_TEST_CASE( param_after_node_2 ) { } BOOST_AUTO_TEST_CASE( multi_lstm ) { - vector> results(4); + const int threadCount = 8; + + vector> results(threadCount); dynet::ParameterCollection mod; dynet::VanillaLSTMBuilder lstm_proto(2, 3, 10, mod); dynet::LookupParameter lp_proto = mod.add_lookup_parameters(10, {3}); dynet::autobatch_flag = 0; - vector threads(4); - for (size_t t = 0; t < 4; ++t) { + vector threads(threadCount); + for (size_t t = 0; t < threadCount; ++t) { threads[t] = thread([&, t]() { + cout << "Starting thread " << t << endl; dynet::ComputationGraph cg; dynet::VanillaLSTMBuilder lstm(lstm_proto); dynet::LookupParameter lp(lp_proto); @@ -135,11 +138,12 @@ BOOST_AUTO_TEST_CASE( multi_lstm ) { losses.push_back(losses[0] + losses[2]); Expression z = dynet::sum(losses); results[t].push_back(as_scalar(z.value())); + cout << "Finishing thread " << t << endl; }); } - for (size_t t = 0; t < 4; ++t) { threads[t].join(); } - for (size_t t = 0; t < 4; ++t) { + for (size_t t = 0; t < threadCount; ++t) { threads[t].join(); } + for (size_t t = 0; t < threadCount; ++t) { for(size_t i = 1; i < results[t].size(); ++i) { BOOST_CHECK_CLOSE(results[t][0], results[t][i], 0.0001); }