root/ompi/mpi/java/java/Intercomm.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. clone
  2. dup
  3. iDup
  4. dupWithInfo
  5. getRemoteSize
  6. getRemoteSize_jni
  7. getRemoteGroup
  8. getRemoteGroup_jni
  9. merge
  10. merge_jni
  11. getParent
  12. getParent_jni

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  13  *                         reserved.
  14  * $COPYRIGHT$
  15  *
  16  * Additional copyrights may follow
  17  *
  18  * $HEADER$
  19  *
  20  *
  21  * This file is almost a complete re-write for Open MPI compared to the
  22  * original mpiJava package. Its license and copyright are listed below.
  23  * See <path to ompi/mpi/java/README> for more information.
  24  *
  25  *
  26  *  Licensed under the Apache License, Version 2.0 (the "License");
  27  *  you may not use this file except in compliance with the License.
  28  *  You may obtain a copy of the License at
  29  *
  30  *     http://www.apache.org/licenses/LICENSE-2.0
  31  *
  32  *  Unless required by applicable law or agreed to in writing, software
  33  *  distributed under the License is distributed on an "AS IS" BASIS,
  34  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  35  *  See the License for the specific language governing permissions and
  36  *  limitations under the License.
  37  *
  38  *
  39  * File         : Intercomm.java
  40  * Author       : Xinying Li
  41  * Created      : Thu Apr  9 12:22:15 1998
  42  * Revision     : $Revision: 1.5 $
  43  * Updated      : $Date: 1999/09/14 20:50:11 $
  44  * Copyright: Northeast Parallel Architectures Center
  45  *            at Syracuse University 1998
  46  */
  47 
  48 package mpi;
  49 
  50 /**
  51  * This class represents intercommunicators.
  52  */
  53 public final class Intercomm extends Comm
  54 {
  55         protected Intercomm(long handle)
  56         {
  57                 super(handle);
  58         }
  59 
  60         protected Intercomm(long[] commRequest)
  61         {
  62                 super(commRequest);
  63         }
  64 
  65         /**
  66          * Duplicates this communicator.
  67          * <p>Java binding of {@code MPI_COMM_DUP}.
  68          * <p>It is recommended to use {@link #dup} instead of {@link #clone}
  69          * because the last can't throw an {@link mpi.MPIException}.
  70          * @return copy of this communicator
  71          */
  72         @Override public Intercomm clone()
  73         {
  74                 try
  75                 {
  76                         return dup();
  77                 }
  78                 catch(MPIException e)
  79                 {
  80                         throw new RuntimeException(e.getMessage());
  81                 }
  82         }
  83 
  84         /**
  85          * Duplicates this communicator.
  86          * <p>Java binding of {@code MPI_COMM_DUP}.
  87          * @return copy of this communicator
  88          * @throws MPIException Signals that an MPI exception of some sort has occurred.
  89          */
  90         @Override public Intercomm dup() throws MPIException
  91         {
  92                 MPI.check();
  93                 return new Intercomm(dup(handle));
  94         }
  95 
  96         /**
  97          * Duplicates this communicator.
  98          * <p>Java binding of {@code MPI_COMM_IDUP}.
  99          * <p>The new communicator can't be used before the operation completes.
 100          * The request object must be obtained calling {@link #getRequest}.
 101          * @return copy of this communicator
 102          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 103          */
 104         @Override public Intercomm iDup() throws MPIException
 105         {
 106                 MPI.check();
 107                 return new Intercomm(iDup(handle));
 108         }
 109 
 110         /**
 111         * Duplicates this communicator with the info object used in the call.
 112         * <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
 113         * @param info   info object to associate with the new communicator
 114         * @return copy of this communicator
 115         * @throws MPIException Signals that an MPI exception of some sort has occurred.
 116         */
 117         @Override public Intercomm dupWithInfo(Info info) throws MPIException
 118         {
 119             MPI.check();
 120             return new Intercomm(dupWithInfo(handle, info.handle));
 121         }
 122 
 123         // Inter-Communication
 124 
 125         /**
 126          * Size of remote group.
 127          * <p>Java binding of the MPI operation {@code MPI_COMM_REMOTE_SIZE}.
 128          * @return number of process in remote group of this communicator
 129          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 130          */
 131         public int getRemoteSize() throws MPIException
 132         {
 133                 MPI.check();
 134                 return getRemoteSize_jni();
 135         }
 136 
 137         private native int getRemoteSize_jni() throws MPIException;
 138 
 139         /**
 140          * Return the remote group.
 141          * <p>Java binding of the MPI operation {@code MPI_COMM_REMOTE_GROUP}.
 142          * @return remote group of this communicator
 143          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 144          */
 145         public Group getRemoteGroup() throws MPIException
 146         {
 147                 MPI.check();
 148                 return new Group(getRemoteGroup_jni());
 149         }
 150 
 151         private native long getRemoteGroup_jni();
 152 
 153         /**
 154          * Creates an intracommuncator from an intercommunicator
 155          * <p>Java binding of the MPI operation {@code MPI_INTERCOMM_MERGE}.
 156          * @param high true if the local group has higher ranks in combined group
 157          * @return new intra-communicator
 158          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 159          */
 160         public Intracomm merge(boolean high) throws MPIException
 161         {
 162                 MPI.check();
 163                 return new Intracomm(merge_jni(high));
 164         }
 165 
 166         private native long merge_jni(boolean high);
 167 
 168         /**
 169          * Java binding of {@code MPI_COMM_GET_PARENT}.
 170          * @return the parent communicator
 171          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 172          */
 173         public static Intercomm getParent() throws MPIException
 174         {
 175                 MPI.check();
 176                 return new Intercomm(getParent_jni());
 177         }
 178 
 179         private native static long getParent_jni() throws MPIException;
 180 
 181 } // Intercomm

/* [<][>][^][v][top][bottom][index][help] */