File: mpi_Intercomm.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (124 lines) | stat: -rw-r--r-- 3,617 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */
/*
 * This file is almost a complete re-write for Open MPI compared to the
 * original mpiJava package. Its license and copyright are listed below.
 * See <path to ompi/mpi/java/README> for more information.
 */
/*
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
/*
 * File         : mpi_Intercomm.c
 * Headerfile   : mpi_Intercomm.h
 * Author       : Xinying Li
 * Created      : Thu Apr  9 12:22:15 1998
 * Revision     : $Revision: 1.3 $
 * Updated      : $Date: 2003/01/16 16:39:34 $
 * Copyright: Northeast Parallel Architectures Center
 *            at Syracuse University 1998
 */

#include "ompi_config.h"

#ifdef HAVE_TARGETCONDITIONALS_H
#include <TargetConditionals.h>
#endif

#include "mpi.h"
#include "mpi_Intercomm.h"
#include "mpiJava.h"


/*
 * Class:     mpi_Intercomm
 * Method:    getRemoteSize_jni
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_mpi_Intercomm_getRemoteSize_1jni(
                       JNIEnv *env, jobject jthis)
{
    int size, rc;

    rc = MPI_Comm_remote_size(
         (MPI_Comm)((*env)->GetLongField(env,jthis,ompi_java.CommHandle)),
         &size);

    ompi_java_exceptionCheck(env, rc);
    return size;
}

/*
 * Class:     mpi_Intercomm
 * Method:    getRemoteGroup_jni
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_mpi_Intercomm_getRemoteGroup_1jni(
                        JNIEnv *env, jobject jthis)
{
    MPI_Group group;

    int rc = MPI_Comm_remote_group(
             (MPI_Comm)((*env)->GetLongField(env,jthis,ompi_java.CommHandle)),
             &group);

    ompi_java_exceptionCheck(env, rc);
    return (jlong)group;
}

/*
 * Class:     mpi_Intercomm
 * Method:    merge_jni
 * Signature: (Z)Lmpi/Intracomm;
 */
JNIEXPORT jlong JNICALL Java_mpi_Intercomm_merge_1jni(
                        JNIEnv *env, jobject jthis, jboolean high)
{
    MPI_Comm newintracomm;

    int rc = MPI_Intercomm_merge(
             (MPI_Comm)((*env)->GetLongField(env,jthis,ompi_java.CommHandle)),
             high, &newintracomm);

    ompi_java_exceptionCheck(env, rc);
    return (jlong)newintracomm;
}

/*
 * Class:     mpi_Intercomm
 * Method:    getParent_jni
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_mpi_Intercomm_getParent_1jni(
                        JNIEnv *env, jclass clazz)
{
    MPI_Comm parent;
    int rc = MPI_Comm_get_parent(&parent);
    ompi_java_exceptionCheck(env, rc);
    return (jlong)parent;
}