Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 32192200B41 for ; Thu, 23 Jun 2016 05:56:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 30A7C160A64; Thu, 23 Jun 2016 03:56:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 52290160A36 for ; Thu, 23 Jun 2016 05:56:17 +0200 (CEST) Received: (qmail 25420 invoked by uid 500); 23 Jun 2016 03:56:16 -0000 Mailing-List: contact dev-help@reef.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@reef.apache.org Delivered-To: mailing list dev@reef.apache.org Received: (qmail 25405 invoked by uid 99); 23 Jun 2016 03:56:16 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jun 2016 03:56:16 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 3E1B72C14E1 for ; Thu, 23 Jun 2016 03:56:16 +0000 (UTC) Date: Thu, 23 Jun 2016 03:56:16 +0000 (UTC) From: "Dhruv Mahajan (JIRA)" To: dev@reef.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (REEF-1456) Develop distributed counters framework in REEF MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 23 Jun 2016 03:56:18 -0000 [ https://issues.apache.org/jira/browse/REEF-1456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345682#comment-15345682 ] Dhruv Mahajan commented on REEF-1456: ------------------------------------- {code} /// /// Interface for the distributed counter. The implementation will not be thread-safe. /// /// Type of counter: typical values: int, float, double public interface IDistributedCounter { /// /// Unique name of the counter. No two cunters should have same names. /// string Name {get; private set;} /// /// Value of the counter /// T Counter {get; private set;} /// /// Updates the counter by value. For += update these are simple /// increments while for Most recently updated (MRU) case this is the latest /// value. Actually for MRU case T itself is a structure with the value and /// timestamp. /// /// Type of counter. /// Value to update the counter. void Update(ref T value); /// /// Whether the value of the counter is default or not. Useful to /// check during serialization to determine whether to send it or not. /// /// True if value os default, False otherwise. bool EqualsDefault(); /// /// Resets the counter to default value. /// void Reset(); /// /// Serialize the counter. It will contain all the information to create /// a new counter by reflection on driver or update the existing counter. /// /// writer to write the serialized data void Serialize(IDataWriter writer); /// /// Deseralizes the update and then update the counter. This function will be /// used at the driver side to get the counter value sent from tasks and then /// update the existing value. /// /// void DeSerializeValueAndUpdate(IDataReader reader); } /// /// Client side that manages counters. This interface will be injected on evaluators /// either as part of task or context. A default implementation would be provided. /// This class will be thread-safe in a sense that updates to a counter will be /// applied sequentially and at a given time we can enter only one of the functions. /// public interface IDistributedCountersClient { /// /// Registers the new counter. /// /// Type of counter. /// Counter class. void Register(IDistributedCounter counter); /// /// Update counter by name. /// /// Type of counter /// Name of counter /// Value with which the counter should be updated void Update(string counterName, ref T value); /// /// Resets counter by name to default vlaue. /// /// Type of counter /// Name of the counter void Reset(string counterName); /// /// Resets all the counter. /// void ResetAll(); /// /// Serialize all the counters with non-default values /// /// Writer to which serialized counters are written. void SerializeCounters(IDataWriter writer); } /// /// Server or driver side that manages counters. This interface will be used on driver side. /// A default implementation would be provided. This class will be threadsafe in a sense that /// that at any given point of time we can enter only one of the functions. /// public interface IDistributedCountersServer { /// /// Serializes the counters by providing the names. This function will be called by driver /// when REEF client asks for the values of some counters. /// /// The name of counters that need to be serialized /// Writer to write the serialized counters. void SerializeCountersByName(IEnumerable counterNames, IDataWriter writer); /// /// Enumerates the name of the counters currently available. This function will be called /// by driver when REEF client asks for the names of existing counters. /// /// IEnumerable EnumerateCounterNames(); /// /// Deserializes the counter from stream and use them to update existing counters. /// Creates new counter by reflection if it does not exist. /// /// Reader from which to read the data. void DeSerializeAndUpdateCounters(IDataReader reader); } {code} > Develop distributed counters framework in REEF > ---------------------------------------------- > > Key: REEF-1456 > URL: https://issues.apache.org/jira/browse/REEF-1456 > Project: REEF > Issue Type: Sub-task > Components: REEF.NET > Environment: C# > Reporter: Dhruv Mahajan > > The aim of this JIRA is to develop distributed counters framework in REEF. Each task can emit pairs of {counter name, incremental value} which are aggregated and sent to driver, which can then aggregate them from all the tasks/ evaluators. The aggregation strategy can be simple addition, most recently used, etc. Via these counters, we can implement some common metrics for ML - like amount (bytes) of data read, current loss function value etc. > We will develop interfaces for Counters for evaluators and driver along with default implementations and aggregation strategies. -- This message was sent by Atlassian JIRA (v6.3.4#6332)