Line data Source code
1 : /////////////////////////////////////////////////////////////////////////// 2 : // Spetabaru - Berenger Bramas MPCDF - 2017 3 : // Under LGPL Licence, please you must read the LICENCE file. 4 : /////////////////////////////////////////////////////////////////////////// 5 : 6 : #include "UTester.hpp" 7 : 8 : #include "Data/SpDataAccessMode.hpp" 9 : #include "Utils/SpUtils.hpp" 10 : 11 : #include "Task/SpTask.hpp" 12 : #include "Legacy/SpRuntime.hpp" 13 : 14 : class TestModel2SpecTaskRequestAccessToNonCopiedData : public UTester<TestModel2SpecTaskRequestAccessToNonCopiedData> { 15 : using Parent = UTester<TestModel2SpecTaskRequestAccessToNonCopiedData>; 16 : 17 1 : void Test(){ 18 1 : int a=0, b=0; 19 2 : std::promise<bool> promise1; 20 : 21 2 : SpRuntime<SpSpeculativeModel::SP_MODEL_2> runtime; 22 : 23 1 : runtime.setSpeculationTest([](const int /*inNbReadyTasks*/, const SpProbability& /*inProbability*/) -> bool{ 24 0 : return true; 25 : }); 26 : 27 0 : runtime.task(SpPotentialWrite(a), [&promise1]([[maybe_unused]] int ¶m_a) -> bool{ 28 1 : promise1.get_future().get(); 29 1 : return false; 30 3 : }); 31 : 32 1 : runtime.task(SpRead(a), SpPotentialWrite(b), []([[maybe_unused]] const int ¶m_a, [[maybe_unused]] int ¶m_b) -> bool{ 33 1 : return false; 34 5 : }); 35 : 36 1 : promise1.set_value(true); 37 : 38 1 : runtime.waitAllTasks(); 39 1 : runtime.stopAllThreads(); 40 1 : } 41 : 42 1 : void SetTests() { 43 1 : Parent::AddTest(&TestModel2SpecTaskRequestAccessToNonCopiedData::Test, 44 : "Test behavior when speculative model 2 is used and a to be inserted speculative task requests access to non copied data"); 45 1 : } 46 : }; 47 : 48 : // You must do this 49 1 : TestClass(TestModel2SpecTaskRequestAccessToNonCopiedData)