void RandomLoop() { int free_global_count_max = 20; while (true) { g_scopeClosure.clear(); g_scopeString.clear(); g_scopeTable.clear(); int scope_count = RandomRange(1, 1000); RunScope(scope_count); TouchGlobalTable(RandomNum(scope_count)); int free_count = RandomRange(1, free_global_count_max++); FreeGlobal(free_count); if (free_global_count_max >= 1000) free_global_count_max = 20; g_gc.CheckGC(); #ifdef _MSC_VER Sleep(RandomRange(1, 20)); #else usleep(RandomRange(1000, 20000)); #endif // _MSC_VER } }
auto DIA<ValueType, Stack>::Max( const MaxFunction &max_function, const ValueType &initial_value) const { assert(IsValid()); using MaxNode = api::AllReduceNode<DIA, MaxFunction>; static_assert( std::is_convertible< ValueType, typename FunctionTraits<MaxFunction>::template arg<0> >::value, "MaxFunction has the wrong input type"); static_assert( std::is_convertible< ValueType, typename FunctionTraits<MaxFunction>::template arg<1> >::value, "MaxFunction has the wrong input type"); static_assert( std::is_convertible< typename FunctionTraits<MaxFunction>::result_type, ValueType>::value, "MaxFunction has the wrong input type"); auto node = common::MakeCounting<MaxNode>( *this, "Max", max_function, initial_value); node->RunScope(); return node->result(); }