File: mpiJava.h

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 (201 lines) | stat: -rw-r--r-- 7,554 bytes parent folder | download | duplicates (2)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
 * 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 (c) 2015      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * Copyright (c) 2019       FUJITSU LIMITED.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef _MPIJAVA_H_
#define _MPIJAVA_H_

#include "mpi.h"
#include "opal/class/opal_free_list.h"

typedef struct {
    jfieldID  CommHandle;
    jfieldID  GroupHandle;
    jclass    CartParmsClass;
    jmethodID CartParmsInit;
    jclass    ShiftParmsClass;
    jmethodID ShiftParmsInit;
    jclass    VersionClass;
    jmethodID VersionInit;
    jclass    CountClass;
    jmethodID CountInit;
    jclass    GraphParmsClass;
    jmethodID GraphParmsInit;
    jclass    DistGraphNeighborsClass;
    jmethodID DistGraphNeighborsInit;
    jfieldID  DatatypeHandle;
    jfieldID  DatatypeBaseType;
    jfieldID  DatatypeBaseSize;
    jfieldID  MessageHandle;
    jfieldID  OpHandle;
    jfieldID  OpCommute;
    jmethodID OpCall;
    jfieldID  ReqHandle;
    jclass    StatusClass;
    jfieldID  StatusData;
    jclass    ExceptionClass;
    jmethodID ExceptionInit;
    jclass    IntegerClass;
    jmethodID IntegerValueOf;
    jclass    LongClass;
    jmethodID LongValueOf;
} ompi_java_globals_t;

extern ompi_java_globals_t ompi_java;

typedef struct ompi_java_buffer_t
{
    opal_free_list_item_t super;
    void *buffer;
} ompi_java_buffer_t;

OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_java_buffer_t);

void* ompi_java_getArrayCritical(void** bufBase, JNIEnv *env,
                                 jobject buf, int offset);

void* ompi_java_getDirectBufferAddress(JNIEnv *env, jobject buf);

/* Gets a buffer pointer for reading (copy from Java). */
void ompi_java_getReadPtr(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env, jobject buf,
        jboolean db, int offset, int count, MPI_Datatype type, int baseType);

/* Gets a buffer pointer for reading.
 * It only copies from java the rank data.
 * 'size' is the number of processes. */
void ompi_java_getReadPtrRank(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env,
        jobject buf, jboolean db, int offset, int count, int size,
        int rank, MPI_Datatype type, int baseType);

/* Gets a buffer pointer for reading, but it
 * 'size' is the number of processes.
 * if rank == -1 it copies all data from Java.
 * if rank != -1 it only copies from Java the rank data. */
void ompi_java_getReadPtrv(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env,
        jobject buf, jboolean db, int off, int *counts, int *displs,
        int size, int rank, MPI_Datatype type, int baseType);

/* Gets a buffer pointer for reading, but it
 * 'size' is the number of processes.
 * if rank == -1 it copies all data from Java.
 * if rank != -1 it only copies from Java the rank data. */
void ompi_java_getReadPtrw(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env,
        jobject buf, jboolean db, int *offs, int *counts, int *displs,
        int size, int rank, MPI_Datatype *types, int *baseTypes);

/* Releases a buffer used for reading. */
void ompi_java_releaseReadPtr(
        void *ptr, ompi_java_buffer_t *item, jobject buf, jboolean db);

/* Gets a buffer pointer for writing. */
void ompi_java_getWritePtr(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env,
        jobject buf, jboolean db, int count, MPI_Datatype type);

/* Gets a buffer pointer for writing.
 * 'size' is the number of processes. */
void ompi_java_getWritePtrv(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env, jobject buf,
        jboolean db, int *counts, int *displs, int size, MPI_Datatype type);

/* Gets a buffer pointer for writing.
 * 'size' is the number of processes. */
void ompi_java_getWritePtrw(
        void **ptr, ompi_java_buffer_t **item, JNIEnv *env, jobject buf,
        jboolean db, int *counts, int *displs, int size, MPI_Datatype *types);

/* Releases a buffer used for writing.
 * It copies data to Java. */
void ompi_java_releaseWritePtr(
        void *ptr, ompi_java_buffer_t *item, JNIEnv *env, jobject buf,
        jboolean db, int offset, int count, MPI_Datatype type, int baseType);

/* Releases a buffer used for writing.
 * It copies data to Java.
 * 'size' is the number of processes. */
void ompi_java_releaseWritePtrv(
        void *ptr, ompi_java_buffer_t *item, JNIEnv *env,
        jobject buf, jboolean db, int off, int *counts, int *displs,
        int size, MPI_Datatype type, int baseType);

/* Releases a buffer used for writing.
 * It copies data to Java.
 * 'size' is the number of processes. */
void ompi_java_releaseWritePtrw(
        void *ptr, ompi_java_buffer_t *item, JNIEnv *env,
        jobject buf, jboolean db, int *offs, int *counts, int *displs,
        int size, MPI_Datatype *types, int *baseTypes);

void ompi_java_setStaticLongField(JNIEnv *env, jclass c,
                                  char *field, jlong value);

void ompi_java_setIntField(JNIEnv *env, jclass c, jobject obj,
                           char *field, jint value);

jobject ompi_java_Integer_valueOf(JNIEnv *env, jint i);
jobject ompi_java_Long_valueOf(JNIEnv *env, jlong i);

void ompi_java_getIntArray(
        JNIEnv *env, jintArray array, jint **jptr, int **cptr);
void ompi_java_releaseIntArray(
        JNIEnv *env, jintArray array, jint *jptr, int *cptr);
void ompi_java_forgetIntArray(
        JNIEnv *env, jintArray array, jint *jptr, int *cptr);

void ompi_java_getDatatypeArray(
        JNIEnv *env, jlongArray array, jlong **jptr, MPI_Datatype **cptr);
void ompi_java_forgetDatatypeArray(
        JNIEnv *env, jlongArray array, jlong *jptr, MPI_Datatype *cptr);

void ompi_java_getBooleanArray(
        JNIEnv *env, jbooleanArray array, jboolean **jptr, int **cptr);
void ompi_java_releaseBooleanArray(
        JNIEnv *env, jbooleanArray array, jboolean *jptr, int *cptr);
void ompi_java_forgetBooleanArray(
        JNIEnv *env, jbooleanArray array, jboolean *jptr, int *cptr);

void ompi_java_getPtrArray(
        JNIEnv *env, jlongArray array, jlong **jptr, void ***cptr);
void ompi_java_releasePtrArray(
        JNIEnv *env, jlongArray array, jlong *jptr, void **cptr);

jboolean ompi_java_exceptionCheck(JNIEnv *env, int rc);

void*      ompi_java_attrSet(JNIEnv *env, jbyteArray jval);
jbyteArray ompi_java_attrGet(JNIEnv *env, void *cval);
int        ompi_java_attrCopy(void *attrValIn, void *attrValOut, int *flag);
int        ompi_java_attrDelete(void *attrVal);

MPI_Op ompi_java_op_getHandle(
        JNIEnv *env, jobject jOp, jlong hOp, int baseType);

jobject ompi_java_status_new(JNIEnv *env, MPI_Status *status);
jobject ompi_java_status_newIndex(JNIEnv *env, MPI_Status *status, int index);

void ompi_java_status_set(
        JNIEnv *env, jlongArray jData, MPI_Status *status);
void ompi_java_status_setIndex(
        JNIEnv *env, jlongArray jData, MPI_Status *status, int index);

#endif /* _MPIJAVA_H_ */