Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions ompi/mpi/java/c/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -22,23 +24,24 @@ ompi_HEADERS = \

lib_LTLIBRARIES = libmpi_java.la
libmpi_java_la_SOURCES = \
mpi_CartComm.c \
mpi_Comm.c \
mpi_CartComm.c \
mpi_Comm.c \
mpi_Constant.c \
mpi_Datatype.c \
mpi_Errhandler.c \
mpi_Count.c \
mpi_Datatype.c \
mpi_Errhandler.c \
mpi_File.c \
mpi_GraphComm.c \
mpi_Group.c \
mpi_GraphComm.c \
mpi_Group.c \
mpi_Info.c \
mpi_Intercomm.c \
mpi_Intracomm.c \
mpi_Intercomm.c \
mpi_Intracomm.c \
mpi_Message.c \
mpi_MPI.c \
mpi_Op.c \
mpi_Request.c \
mpi_Prequest.c \
mpi_Status.c \
mpi_MPI.c \
mpi_Op.c \
mpi_Request.c \
mpi_Prequest.c \
mpi_Status.c \
mpi_Win.c

libmpi_java_la_LIBADD = $(top_builddir)/ompi/libmpi.la
Expand Down
2 changes: 2 additions & 0 deletions ompi/mpi/java/c/mpiJava.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ typedef struct {
jmethodID ShiftParmsInit;
jclass VersionClass;
jmethodID VersionInit;
jclass CountClass;
jmethodID CountInit;
jclass GraphParmsClass;
jmethodID GraphParmsInit;
jclass DistGraphNeighborsClass;
Expand Down
52 changes: 52 additions & 0 deletions ompi/mpi/java/c/mpi_Count.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2015 Los Alamos National Security, LLC. 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 : Version.java
* Author : Nathaniel Graham
* Created : Thu Jul 30 09:34 2015
*/

#include "ompi_config.h"

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

#include "mpi.h"
#include "mpi_Count.h"
#include "mpiJava.h"

JNIEXPORT void JNICALL Java_mpi_Count_initCount(JNIEnv *env, jclass jthis)
{
jclass c = (*env)->FindClass(env, "mpi/Count");
ompi_java.CountClass = (*env)->NewGlobalRef(env, c);
ompi_java.CountInit = (*env)->GetMethodID(env, ompi_java.CountClass, "<init>", "(J)V");

(*env)->DeleteLocalRef(env, c);
}
1 change: 1 addition & 0 deletions ompi/mpi/java/c/mpi_MPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ static void deleteClasses(JNIEnv *env)
(*env)->DeleteGlobalRef(env, ompi_java.CartParmsClass);
(*env)->DeleteGlobalRef(env, ompi_java.ShiftParmsClass);
(*env)->DeleteGlobalRef(env, ompi_java.VersionClass);
(*env)->DeleteGlobalRef(env, ompi_java.CountClass);
(*env)->DeleteGlobalRef(env, ompi_java.GraphParmsClass);
(*env)->DeleteGlobalRef(env, ompi_java.DistGraphNeighborsClass);
(*env)->DeleteGlobalRef(env, ompi_java.StatusClass);
Expand Down
28 changes: 28 additions & 0 deletions ompi/mpi/java/c/mpi_Status.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ JNIEXPORT jint JNICALL Java_mpi_Status_getElements(
return count;
}

JNIEXPORT jobject JNICALL Java_mpi_Status_getElementsX(
JNIEnv *env, jobject jthis, jint source, jint tag,
jint error, jint cancelled, jlong ucount, jlong jType)
{
MPI_Count count;
MPI_Status stat;
getStatus(&stat, source, tag, error, cancelled, ucount);
MPI_Datatype datatype = (MPI_Datatype)jType;
int rc = MPI_Get_elements_x(&stat, datatype, &count);
ompi_java_exceptionCheck(env, rc);

return (*env)->NewObject(env, ompi_java.CountClass,
ompi_java.CountInit, (jlong)count);
}

JNIEXPORT jint JNICALL Java_mpi_Status_setElements(
JNIEnv *env, jobject jthis, jint source, jint tag,
jint error, jint cancelled, jlong ucount, jlong jType, int count)
Expand All @@ -121,6 +136,19 @@ JNIEXPORT jint JNICALL Java_mpi_Status_setElements(
return stat._ucount;
}

JNIEXPORT jlong JNICALL Java_mpi_Status_setElementsX(
JNIEnv *env, jobject jthis, jint source, jint tag,
jint error, jint cancelled, jlong ucount, jlong jType, jlong jcount)
{
MPI_Status stat;
MPI_Count count = (long)jcount;
getStatus(&stat, source, tag, error, cancelled, ucount);
MPI_Datatype datatype = (MPI_Datatype)jType;
int rc = MPI_Status_set_elements_x(&stat, datatype, count);
ompi_java_exceptionCheck(env, rc);
return (jlong)stat._ucount;
}

JNIEXPORT void JNICALL Java_mpi_Status_setCancelled(
JNIEnv *env, jobject jthis, jint source, jint tag,
jint error, jint cancelled, jlong ucount, int flag)
Expand Down
96 changes: 96 additions & 0 deletions ompi/mpi/java/java/Count.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2015 Los Alamos National Security, LLC. 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 : Count.java
* Author : Nathaniel Graham
* Created : Thu Jul 29 17:13 2015
*/

package mpi;

/**
* This class represents {@code MPI_Count}.
*/
public final class Count implements Comparable
{
private long count;

static
{
System.loadLibrary("mpi_java");
initCount();
}

private static native void initCount();

public Count(long count)
{
this.count = count;
}

/**
* Gets value associated with this Count object.
* @return Count value
*/
public long getCount()
{
return this.count;
}

/**
* Sets the value associated with this Count object.
* @param count the value to set for this count object
*/
public void setCount(long count)
{
this.count = count;
}

@Override
public boolean equals(Object obj)
{
if(obj instanceof Count) {
if(this.count == ((Count)obj).getCount()) {
return true;
}
}
return false;
}

public int compareTo(Object obj)
{
if(obj instanceof Count) {
if(this.count - ((Count)obj).getCount() > 0) {
return 1;
} else if(this.count - ((Count)obj).getCount() == 0) {
return 0;
}
}
return -1;
}
} // Count
70 changes: 36 additions & 34 deletions ompi/mpi/java/java/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,38 @@ include $(top_srcdir)/Makefile.ompi-rules
# just list them here in EXTRA_DIST so that they get picked up by
# "make dist".
JAVA_SRC_FILES = \
CartComm.java \
CartParms.java \
Comm.java \
CartComm.java \
CartParms.java \
Comm.java \
Constant.java \
Datatype.java \
Count.java \
Datatype.java \
DistGraphNeighbors.java \
DoubleInt.java \
DoubleComplex.java \
Errhandler.java \
Errhandler.java \
FloatComplex.java \
FloatInt.java \
File.java \
FileView.java \
Freeable.java \
GraphComm.java \
GraphParms.java \
Group.java \
Freeable.java \
GraphComm.java \
GraphParms.java \
Group.java \
Info.java \
Int2.java \
Intercomm.java \
Intracomm.java \
Intercomm.java \
Intracomm.java \
LongInt.java \
Message.java \
MPI.java \
MPIException.java \
Op.java \
Prequest.java \
Request.java \
ShiftParms.java \
MPI.java \
MPIException.java \
Op.java \
Prequest.java \
Request.java \
ShiftParms.java \
ShortInt.java \
Status.java \
Status.java \
Struct.java \
UserFunction.java \
Version.java \
Expand All @@ -71,26 +72,27 @@ if OMPI_WANT_JAVA_BINDINGS
# we have a specific list of files here, as opposed to deriving them
# from JAVA_SRC_FILES.
JAVA_H = \
mpi_MPI.h \
mpi_CartParms.h \
mpi_CartComm.h \
mpi_Comm.h \
mpi_MPI.h \
mpi_CartParms.h \
mpi_CartComm.h \
mpi_Comm.h \
mpi_Constant.h \
mpi_Datatype.h \
mpi_Errhandler.h \
mpi_Count.h \
mpi_Datatype.h \
mpi_Errhandler.h \
mpi_File.h \
mpi_GraphParms.h \
mpi_GraphComm.h \
mpi_Group.h \
mpi_GraphParms.h \
mpi_GraphComm.h \
mpi_Group.h \
mpi_Info.h \
mpi_Intercomm.h \
mpi_Intracomm.h \
mpi_Intercomm.h \
mpi_Intracomm.h \
mpi_Message.h \
mpi_Op.h \
mpi_Prequest.h \
mpi_Request.h \
mpi_ShiftParms.h \
mpi_Status.h \
mpi_Op.h \
mpi_Prequest.h \
mpi_Request.h \
mpi_ShiftParms.h \
mpi_Status.h \
mpi_Version.h \
mpi_Win.h

Expand Down
Loading