This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.io.network.group.api.operators;
020
021import org.apache.reef.exception.evaluator.NetworkException;
022import org.apache.reef.wake.Identifier;
023
024import java.util.List;
025
026/**
027 * MPI Reduce Scatter operator.
028 * <p>
029 * Each task has a list of elements. Assume that each task reduces
030 * each element in the list to form a list of reduced elements at a dummy root.
031 * The dummy root then keeps the portion of the list assigned to it and
032 * scatters the remaining among the other tasks
033 */
034public interface ReduceScatter<T> extends GroupCommOperator {
035
036  /**
037   * Apply this operation on elements where counts specify the distribution of
038   * elements to each task. Ordering is assumed to be default.
039   * <p>
040   * Here counts is of the same size as the entire group not just children.
041   *
042   * @return List of values that result from applying reduce function on
043   * corresponding elements of each list received as a result of
044   * applying scatter.
045   */
046  List<T> apply(List<T> elements, List<Integer> counts) throws InterruptedException, NetworkException;
047
048  /**
049   * Apply this operation on elements where counts specify the distribution of
050   * elements to each task. Ordering is specified using order
051   * <p>
052   * Here counts is of the same size as the entire group not just children
053   *
054   * @return List of values that result from applying reduce function on
055   * corresponding elements of each list received as a result of
056   * applying scatter.
057   */
058  List<T> apply(List<T> elements, List<Integer> counts,
059                List<? extends Identifier> order) throws InterruptedException, NetworkException;
060
061  /**
062   * get {@link org.apache.reef.io.network.group.api.operators.Reduce.ReduceFunction} configured.
063   *
064   * @return {@link org.apache.reef.io.network.group.api.operators.Reduce.ReduceFunction}
065   */
066  Reduce.ReduceFunction<T> getReduceFunction();
067}