void Run(std::string fname) { if (!m_reader.Read(fname)) { std::cerr << "Can not read input data\n"; assert(0); } { LogEx("Read field\n" << m_reader); } int needTasks = m_reader.GetGridSize() * m_reader.GetGridSize() + 1; if (m_env.m_procCnt < needTasks) { std::stringstream ss; ss << "not enough tasks: need " << needTasks << " got " << m_env.m_procCnt; throw ss.str(); } else if (needTasks < m_env.m_procCnt) { for (int i = needTasks; i < m_env.m_procCnt; ++i) { SendCmd(CMD_DIE, i); } } SendTasks(); SendGo(); if (WaitFinish()) { NotifyAllTasks(CMD_FIN_FOUND); std::string way; GetWay(way); LogEx("Way found: " << way); std::cerr << "Way found: " << way << "\n"; } else { std::cerr << "Can not find way\n"; } NotifyAllTasks(CMD_DIE); }
void TestManyChildAllocsParent::Main() { if (!SendGo()) fail("can't send Go()"); }