From 63bc655b535ab9d38a99adb8266987886a011921 Mon Sep 17 00:00:00 2001 From: Igor Ivanov Date: Wed, 2 Dec 2015 15:31:34 +0200 Subject: [PATCH] oshmem: Remove JAVA support There is a conclusion to remove java support (see https://github.com/open-mpi/ompi-release/pull/787) --- README | 1 - VERSION | 1 - config/oshmem_setup_java.m4 | 101 - configure.ac | 4 +- examples/Hello_oshmem.java | 12 - examples/Makefile | 30 +- examples/Makefile.include | 8 +- examples/Ring_oshmem.java | 54 - examples/oshmem_circular_shift.java | 24 - examples/oshmem_max_reduction.java | 43 - examples/oshmem_strided_puts.java | 33 - examples/oshmem_symmetric_data.java | 49 - oshmem/Makefile.am | 6 +- oshmem/shmem/java/Makefile.am | 1 - oshmem/shmem/java/c/Makefile.am | 33 - oshmem/shmem/java/c/shmemJava.h | 99 - oshmem/shmem/java/c/shmem_Addr.c | 951 -------- oshmem/shmem/java/c/shmem_Constant.c | 44 - oshmem/shmem/java/c/shmem_PSync.c | 31 - oshmem/shmem/java/c/shmem_ShMem.c | 488 ---- oshmem/shmem/java/java/Addr.java | 2422 -------------------- oshmem/shmem/java/java/Constant.java | 21 - oshmem/shmem/java/java/Makefile.am | 152 -- oshmem/shmem/java/java/PSync.java | 40 - oshmem/shmem/java/java/ShMem.java | 496 ---- oshmem/shmem/java/java/ShMemException.java | 17 - oshmem/tools/wrappers/Makefile.am | 10 +- 27 files changed, 7 insertions(+), 5164 deletions(-) delete mode 100644 config/oshmem_setup_java.m4 delete mode 100644 examples/Hello_oshmem.java delete mode 100644 examples/Ring_oshmem.java delete mode 100644 examples/oshmem_circular_shift.java delete mode 100644 examples/oshmem_max_reduction.java delete mode 100644 examples/oshmem_strided_puts.java delete mode 100644 examples/oshmem_symmetric_data.java delete mode 100644 oshmem/shmem/java/Makefile.am delete mode 100644 oshmem/shmem/java/c/Makefile.am delete mode 100644 oshmem/shmem/java/c/shmemJava.h delete mode 100644 oshmem/shmem/java/c/shmem_Addr.c delete mode 100644 oshmem/shmem/java/c/shmem_Constant.c delete mode 100644 oshmem/shmem/java/c/shmem_PSync.c delete mode 100644 oshmem/shmem/java/c/shmem_ShMem.c delete mode 100644 oshmem/shmem/java/java/Addr.java delete mode 100644 oshmem/shmem/java/java/Constant.java delete mode 100644 oshmem/shmem/java/java/Makefile.am delete mode 100644 oshmem/shmem/java/java/PSync.java delete mode 100644 oshmem/shmem/java/java/ShMem.java delete mode 100644 oshmem/shmem/java/java/ShMemException.java diff --git a/README b/README index 6883d1f6e6..696500cca5 100644 --- a/README +++ b/README @@ -1561,7 +1561,6 @@ Here's how we apply those rules specifically to Open MPI: * libmpi_cxx * libmpi_java * liboshmem - * liboshmem_java =========================================================================== diff --git a/VERSION b/VERSION index 4b7b0735d2..5b0ab39d29 100644 --- a/VERSION +++ b/VERSION @@ -91,7 +91,6 @@ libopen_rte_so_version=0:0:0 libopen_pal_so_version=0:0:0 libmpi_java_so_version=0:0:0 liboshmem_so_version=0:0:0 -liboshmem_java_so_version=0:0:0 # "Common" components install standalone libraries that are run-time # linked by one or more components. So they need to be versioned as diff --git a/config/oshmem_setup_java.m4 b/config/oshmem_setup_java.m4 deleted file mode 100644 index b879613429..0000000000 --- a/config/oshmem_setup_java.m4 +++ /dev/null @@ -1,101 +0,0 @@ -dnl -*- shell-script -*- -dnl -dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -dnl University Research and Technology -dnl Corporation. All rights reserved. -dnl Copyright (c) 2004-2006 The University of Tennessee and The University -dnl of Tennessee Research Foundation. All rights -dnl reserved. -dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, -dnl University of Stuttgart. All rights reserved. -dnl Copyright (c) 2004-2006 The Regents of the University of California. -dnl All rights reserved. -dnl Copyright (c) 2006-2012 Los Alamos National Security, LLC. All rights -dnl reserved. -dnl Copyright (c) 2007-2012 Oracle and/or its affiliates. All rights reserved. -dnl Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2015 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. -dnl $COPYRIGHT$ -dnl -dnl Additional copyrights may follow -dnl -dnl $HEADER$ -dnl - -# This macro is necessary to get the title to be displayed first. :-) -AC_DEFUN([OSHMEM_SETUP_JAVA_BINDINGS_BANNER],[ - opal_show_subtitle "Java OSHMEM bindings" -]) - -# OSHMEM_SETUP_JAVA_BINDINGS() -# ---------------- -# Do everything required to setup the Java OSHMEM bindings. Safe to AC_REQUIRE -# this macro. -AC_DEFUN([OSHMEM_SETUP_JAVA_BINDINGS],[ - # must have Java setup - AC_REQUIRE([OPAL_SETUP_JAVA]) - - AC_REQUIRE([OSHMEM_SETUP_JAVA_BINDINGS_BANNER]) - - AC_MSG_CHECKING([if want Java bindings]) - AC_ARG_ENABLE(oshmem-java, - AC_HELP_STRING([--enable-oshmem-java], - [enable Java OSHMEM bindings (default: disabled)])) - - # check for required support - if test "$opal_java_happy" = "no" && test "$enable_oshmem_java" = "yes"; then - AC_MSG_RESULT([yes]) - AC_MSG_WARN([Java bindings requested but no Java support found]) - AC_MSG_ERROR([cannot continue]) - fi - - # Only build the Java bindings if requested - if test "$opal_java_happy" = "yes" && test "$enable_oshmem_java" = "yes"; then - AC_MSG_RESULT([yes]) - WANT_OSHMEM_JAVA_SUPPORT=1 - AC_MSG_CHECKING([if shared libraries are enabled]) - AS_IF([test "$enable_shared" != "yes"], - [AC_MSG_RESULT([no]) - AC_MSG_WARN([Java bindings cannot be built without shared libraries]) - AC_MSG_WARN([Please reconfigure with --enable-shared]) - AC_MSG_ERROR([Cannot continue])], - [AC_MSG_RESULT([yes])]) - # must have Java support - AC_MSG_CHECKING([if Java support was found]) - AS_IF([test "$opal_java_happy" = "yes"], - [AC_MSG_RESULT([yes])], - [AC_MSG_WARN([Java OSHMEM bindings requested, but Java support was not found]) - AC_MSG_WARN([Please reconfigure the --with-jdk options to where Java]) - AC_MSG_WARN([support can be found]) - AC_MSG_ERROR([Cannot continue])]) - - # Mac Java requires this file (i.e., some other Java-related - # header file needs this file, so we need to check for - # it/include it in our sources when compiling on Mac). - AC_CHECK_HEADERS([TargetConditionals.h]) - else - AC_MSG_RESULT([no]) - WANT_OSHMEM_JAVA_SUPPORT=0 - fi - AC_DEFINE_UNQUOTED([OSHMEM_WANT_JAVA_BINDINGS], [$WANT_OSHMEM_JAVA_SUPPORT], - [do we want java oshmem bindings]) - AM_CONDITIONAL(OSHMEM_WANT_JAVA_BINDINGS, test "$WANT_OSHMEM_JAVA_SUPPORT" = "1") - - # Are we happy? - AS_IF([test "$WANT_OSHMEM_JAVA_SUPPORT" = "1"], - [AC_MSG_WARN([******************************************************]) - AC_MSG_WARN([*** Java OSHMEM bindings are provided on a provisional]) - AC_MSG_WARN([*** basis. They are NOT part of the current or]) - AC_MSG_WARN([*** proposed OSHMEM standard. Continued inclusion of]) - AC_MSG_WARN([*** the Java OSHMEM bindings OSHMEM is contingent]) - AC_MSG_WARN([*** upon user interest and developer support.]) - AC_MSG_WARN([******************************************************]) - ]) - - AC_CONFIG_FILES([ - oshmem/shmem/java/Makefile - oshmem/shmem/java/java/Makefile - oshmem/shmem/java/c/Makefile - ]) -]) diff --git a/configure.ac b/configure.ac index 6348daedb9..eec43fc57d 100644 --- a/configure.ac +++ b/configure.ac @@ -136,8 +136,7 @@ m4_ifdef([project_ompi], m4_ifdef([project_orte], [AC_SUBST(libopen_rte_so_version)]) m4_ifdef([project_oshmem], - [AC_SUBST(liboshmem_so_version) - AC_SUBST(liboshmem_java_so_version)]) + [AC_SUBST(liboshmem_so_version)]) AC_SUBST(libopen_pal_so_version) # It's icky that we have to hard-code the names of the # common components here. :-( This could probably be done @@ -524,7 +523,6 @@ OPAL_CHECK_COMPILER_VERSION_ID ################################## # Only needed for OMPI m4_ifdef([project_ompi], [OMPI_SETUP_JAVA_BINDINGS]) -m4_ifdef([project_oshmem], [OSHMEM_SETUP_JAVA_BINDINGS]) ################################## diff --git a/examples/Hello_oshmem.java b/examples/Hello_oshmem.java deleted file mode 100644 index dc6595858a..0000000000 --- a/examples/Hello_oshmem.java +++ /dev/null @@ -1,12 +0,0 @@ -import shmem.*; - -public class Hello_oshmem -{ - public static void main(String[] args) - { - ShMem.startPEs(0); - int nproc = ShMem.getNumPEs(); - int proc = ShMem.getMyPE(); - System.out.println("Hello, world, I am "+ proc +" of "+ nproc); - } -} diff --git a/examples/Makefile b/examples/Makefile index 372ca32d19..92b53ddda2 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -53,8 +53,7 @@ EXAMPLES = \ hello_oshmem \ hello_oshmemfh \ Hello.class \ - Hello_oshmem.class \ - ring_c \ + ring_c \ ring_cxx \ ring_mpifh \ ring_usempi \ @@ -62,17 +61,12 @@ EXAMPLES = \ ring_oshmem \ ring_oshmemfh \ Ring.class \ - Ring_oshmem.class \ connectivity_c \ oshmem_shmalloc \ oshmem_circular_shift \ - oshmem_circular_shift.class \ oshmem_max_reduction \ - oshmem_max_reduction.class \ oshmem_strided_puts \ - oshmem_strided_puts.class \ - oshmem_symmetric_data \ - oshmem_symmetric_data.class + oshmem_symmetric_data # Default target. Always build the C MPI examples. Only build the @@ -122,14 +116,6 @@ oshmem: $(MAKE) hello_oshmemfh; \ $(MAKE) ring_oshmemfh; \ fi - @ if oshmem_info --parsable | grep bindings:java:yes >/dev/null; then \ - $(MAKE) Hello_oshmem.class; \ - $(MAKE) Ring_oshmem.class; \ - $(MAKE) oshmem_circular_shift.class; \ - $(MAKE) oshmem_max_reduction.class; \ - $(MAKE) oshmem_strided_puts.class; \ - $(MAKE) oshmem_symmetric_data.class; \ - fi # The usual "clean" target @@ -162,35 +148,23 @@ hello_oshmem: hello_oshmem_c.c $(SHMEMCC) $(CFLAGS) $? -o $@ hello_oshmemfh: hello_oshmemfh.f90 $(SHMEMFC) $(FCFLAGS) $? -o $@ -Hello_oshmem.class: Hello_oshmem.java - $(JAVAC) Hello_oshmem.java ring_oshmem: ring_oshmem_c.c $(SHMEMCC) $(CFLAGS) $? -o $@ ring_oshmemfh: ring_oshmemfh.f90 $(SHMEMFC) $(FCFLAGS) $? -o $@ -Ring_oshmem.class: Ring_oshmem.java - $(JAVAC) Ring_oshmem.java oshmem_shmalloc: oshmem_shmalloc.c $(SHMEMCC) $(CCFLAGS) $? -o $@ oshmem_circular_shift: oshmem_circular_shift.c $(SHMEMCC) $(CFLAGS) $? -o $@ -oshmem_circular_shift.class: oshmem_circular_shift.java - $(JAVAC) oshmem_circular_shift.java oshmem_max_reduction: oshmem_max_reduction.c $(SHMEMCC) $(CFLAGS) $? -o $@ -oshmem_max_reduction.class: oshmem_max_reduction.java - $(JAVAC) oshmem_max_reduction.java oshmem_strided_puts: oshmem_strided_puts.c $(SHMEMCC) $(CFLAGS) $? -o $@ -oshmem_strided_puts.class: oshmem_strided_puts.java - $(JAVAC) oshmem_strided_puts.java oshmem_symmetric_data: oshmem_symmetric_data.c $(SHMEMCC) $(CFLAGS) $? -o $@ -oshmem_symmetric_data.class: oshmem_symmetric_data.java - $(JAVAC) oshmem_symmetric_data.java diff --git a/examples/Makefile.include b/examples/Makefile.include index 2ac1d873cb..7707521c94 100644 --- a/examples/Makefile.include +++ b/examples/Makefile.include @@ -54,10 +54,4 @@ EXTRA_DIST += \ examples/oshmem_strided_puts.c \ examples/oshmem_symmetric_data.c \ examples/Hello.java \ - examples/Ring.java \ - examples/Hello_oshmem.java \ - examples/Ring_oshmem.java \ - examples/oshmem_circular_shift.java \ - examples/oshmem_max_reduction.java \ - examples/oshmem_strided_puts.java \ - examples/oshmem_symmetric_data.java + examples/Ring.java diff --git a/examples/Ring_oshmem.java b/examples/Ring_oshmem.java deleted file mode 100644 index 2bc126f12d..0000000000 --- a/examples/Ring_oshmem.java +++ /dev/null @@ -1,54 +0,0 @@ -import shmem.*; - -public class Ring_oshmem -{ - public static void main(String[] args) throws ShMemException - { - ShMem.startPEs(0); - int nproc = ShMem.getNumPEs(); - int proc = ShMem.getMyPE(); - Addr rbuf = new Addr(4); // One integer value. - rbuf.putInt(-1); - int message = 10; - - // Calculate the PE number of the next process in the ring. Use the - // modulus operator so that the last process "wraps around" to PE 0. - int next = (proc + 1) % nproc; - - if(proc == 0) - { - System.out.println("Process 0 puts message "+ message +" to "+ - next +" ("+ nproc +" processes in ring)"); - - rbuf.putInt(message, next); - } - - // Pass the message around the ring. The exit mechanism works as - // follows: the message (a positive integer) is passed around the - // ring. Each time it passes PE 0, it is decremented. When each - // processes receives a message containing a 0 value, it passes the - // message on to the next process and then quits. By passing the 0 - // message first, every process gets the 0 message and can quit - // normally. - - while(message > 0) - { - rbuf.waitUntilInt(ShMem.CMP_EQ, message); - - if(proc == 0) - { - message--; - System.out.println("Process 0 decremented value: "+ message); - } - - rbuf.putInt(message, next); - - if(proc != 0) - message--; - } - - // All done - rbuf.free(); - System.out.println("Process "+ proc +" exiting"); - } -} diff --git a/examples/oshmem_circular_shift.java b/examples/oshmem_circular_shift.java deleted file mode 100644 index 776d166d27..0000000000 --- a/examples/oshmem_circular_shift.java +++ /dev/null @@ -1,24 +0,0 @@ -import shmem.*; - -public class oshmem_circular_shift -{ - public static void main(String[] args) throws ShMemException - { - ShMem.startPEs(0); - - int numPEs = ShMem.getNumPEs(), - myPE = ShMem.getMyPE(), - peer = (myPE + 1) % numPEs; - - int[] aaa = new int[1]; - Addr bbb = new Addr(4); - - System.out.println("Process "+ myPE +" gets message from "+ - peer +" ("+ numPEs +" processes in ring)"); - - bbb.getInt(aaa, peer); - ShMem.barrierAll(); - bbb.free(); - System.out.println("Process "+ myPE +" exiting"); - } -} diff --git a/examples/oshmem_max_reduction.java b/examples/oshmem_max_reduction.java deleted file mode 100644 index 499427d656..0000000000 --- a/examples/oshmem_max_reduction.java +++ /dev/null @@ -1,43 +0,0 @@ -import shmem.*; -import java.nio.*; - -public class oshmem_max_reduction -{ - private static final int N = 3; - - public static void main(String[] args) throws ShMemException - { - ShMem.startPEs(0); - - int numPEs = ShMem.getNumPEs(), - myPE = ShMem.getMyPE(); - - Addr src = new Addr(8 * N), // long is 8 bytes. - dst = new Addr(8 * N), - pWrk = new Addr(8 * ShMem.REDUCE_SYNC_SIZE); - PSync pSync = new PSync(ShMem.BCAST_SYNC_SIZE); - - LongBuffer srcBuf = src.asLongBuffer(), - dstBuf = dst.asLongBuffer(); - - for(int i = 0; i < N; i++) - srcBuf.put(i, myPE + i); - - ShMem.barrierAll(); - dst.maxToAllLong(src, N, 0, 0, numPEs, pWrk, pSync); - - StringBuilder sb = new StringBuilder(); - sb.append(myPE +"/"+ numPEs +" dst ="); - - for(int i = 0; i < N; i++) - sb.append(" "+ dstBuf.get(i)); - - sb.append("\n"); - System.out.print(sb); - - src.free(); - dst.free(); - pWrk.free(); - pSync.free(); - } -} diff --git a/examples/oshmem_strided_puts.java b/examples/oshmem_strided_puts.java deleted file mode 100644 index 0213213e2e..0000000000 --- a/examples/oshmem_strided_puts.java +++ /dev/null @@ -1,33 +0,0 @@ -import shmem.*; -import java.nio.*; - -public class oshmem_strided_puts -{ - public static void main(String[] args) throws ShMemException - { - ShMem.startPEs(0); - int me = ShMem.getMyPE(); - - short[] source = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - Addr target = new Addr(2 * 10); // short is 2 bytes. - - if(me == 0) - { - /* put 10 words into target on PE 1 */ - target.iPutShort(source, 1, 2, 5, 1); - } - - ShMem.barrierAll(); // sync sender and receiver - - if(me == 1) - { - ShortBuffer buf = target.asShortBuffer(); - System.out.printf("target on PE %d is %d %d %d %d %d\n", me, - buf.get(0), buf.get(1), buf.get(2), - buf.get(3), buf.get(4)); - } - - ShMem.barrierAll(); // sync before exiting - target.free(); - } -} diff --git a/examples/oshmem_symmetric_data.java b/examples/oshmem_symmetric_data.java deleted file mode 100644 index d21ef48955..0000000000 --- a/examples/oshmem_symmetric_data.java +++ /dev/null @@ -1,49 +0,0 @@ -import shmem.*; -import java.nio.*; - -public class oshmem_symmetric_data -{ - private static final int SIZE = 16; - - public static void main(String[] args) throws ShMemException - { - ShMem.startPEs(0); - - int numPE = ShMem.getNumPEs(), - myPE = ShMem.getMyPE(); - - int[] source = new int[SIZE]; - Addr target = new Addr(4 * SIZE); // int is 4 bytes - - if(myPE == 0) - { - // initialize array - for(int i = 0; i < SIZE; i++) - source[i] = i; - - // local, not symmetric - // static makes it symmetric - // put "size" words into target on each PE - for(int i = 1; i < numPE; i++) - target.putInt(source, i); - } - - ShMem.barrierAll(); // sync sender and receiver - - if(myPE != 0) - { - StringBuilder sb = new StringBuilder(); - sb.append("Target on PE "+ myPE +" is \t"); - IntBuffer buf = target.asIntBuffer(); - - for(int i = 0; i < SIZE; i++) - sb.append(buf.get(i) +" \t"); - - sb.append('\n'); - System.out.print(sb); - } - - ShMem.barrierAll(); // sync before exiting - target.free(); - } -} diff --git a/oshmem/Makefile.am b/oshmem/Makefile.am index 96c65b1766..b79d84fe5e 100644 --- a/oshmem/Makefile.am +++ b/oshmem/Makefile.am @@ -43,8 +43,7 @@ SUBDIRS += \ $(MCA_oshmem_FRAMEWORKS_SUBDIRS) \ $(MCA_oshmem_FRAMEWORK_COMPONENT_STATIC_SUBDIRS) \ . \ - $(MCA_oshmem_FRAMEWORK_COMPONENT_DSO_SUBDIRS) \ - shmem/java + $(MCA_oshmem_FRAMEWORK_COMPONENT_DSO_SUBDIRS) endif DIST_SUBDIRS = \ @@ -52,8 +51,7 @@ DIST_SUBDIRS = \ shmem/c \ shmem/fortran \ $(MCA_oshmem_FRAMEWORKS_SUBDIRS) \ - $(MCA_oshmem_FRAMEWORK_COMPONENT_ALL_SUBDIRS) \ - shmem/java + $(MCA_oshmem_FRAMEWORK_COMPONENT_ALL_SUBDIRS) # Build The main OSHMEM library, but only if we're building OSHMEM lib_LTLIBRARIES = diff --git a/oshmem/shmem/java/Makefile.am b/oshmem/shmem/java/Makefile.am deleted file mode 100644 index 9bf6ce3c35..0000000000 --- a/oshmem/shmem/java/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = java c diff --git a/oshmem/shmem/java/c/Makefile.am b/oshmem/shmem/java/c/Makefile.am deleted file mode 100644 index ac358cf755..0000000000 --- a/oshmem/shmem/java/c/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -if OMPI_WANT_JAVA_BINDINGS - -# Get the include files that were generated from the .java source files -AM_CPPFLAGS = -I$(OSHMEM_TOP_BUILDDIR)/oshmem/shmem/java/java $(OPAL_JDK_CPPFLAGS) -DOPAL_DYN_LIB_SUFFIX=\"$(OPAL_DYN_LIB_SUFFIX)\" - -headers = \ - shmemJava.h -oshmemdir = $(oshmemincludedir)/oshmem/shmem/java -oshmem_HEADERS = \ - $(headers) - -lib_LTLIBRARIES = liboshmem_java.la -liboshmem_java_la_SOURCES = \ - shmem_Addr.c \ - shmem_Constant.c \ - shmem_PSync.c \ - shmem_ShMem.c - -liboshmem_java_la_LIBADD = $(OSHMEM_TOP_BUILDDIR)/oshmem/liboshmem.la -liboshmem_java_la_LDFLAGS = -version-info $(liboshmem_java_so_version) - -endif diff --git a/oshmem/shmem/java/c/shmemJava.h b/oshmem/shmem/java/c/shmemJava.h deleted file mode 100644 index 249fdeb708..0000000000 --- a/oshmem/shmem/java/c/shmemJava.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef _SHMEMJAVA_H_ -#define _SHMEMJAVA_H_ - -#include "shmem.h" -#include "opal/class/opal_free_list.h" - -typedef struct { - jfieldID AddrHandle; - jclass ExceptionClass; -} shmem_java_globals_t; - -extern shmem_java_globals_t shmem_java; - -typedef struct shmem_java_buffer_t -{ - opal_free_list_item_t super; - void *buffer; -} shmem_java_buffer_t; - -OMPI_DECLSPEC OBJ_CLASS_DECLARATION(shmem_java_buffer_t); - -void* shmem_java_getBuffer(shmem_java_buffer_t **item, JNIEnv *env, int size); -void shmem_java_releaseBuffer(void *ptr, shmem_java_buffer_t *item); - -jbyte* shmem_java_getReadByteArray( - shmem_java_buffer_t **item, JNIEnv *env, - jbyteArray array, int off, int len); -jshort* shmem_java_getReadShortArray( - shmem_java_buffer_t **item, JNIEnv *env, - jshortArray array, int off, int len); -jint* shmem_java_getReadIntArray( - shmem_java_buffer_t **item, JNIEnv *env, - jintArray array, int off, int len); -jlong* shmem_java_getReadLongArray( - shmem_java_buffer_t **item, JNIEnv *env, - jlongArray array, int off, int len); -jfloat* shmem_java_getReadFloatArray( - shmem_java_buffer_t **item, JNIEnv *env, - jfloatArray array, int off, int len); -jdouble* shmem_java_getReadDoubleArray( - shmem_java_buffer_t **item, JNIEnv *env, - jdoubleArray array, int off, int len); - -void shmem_java_releaseWriteByteArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jbyteArray array, int off, int len); -void shmem_java_releaseWriteShortArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jshortArray array, int off, int len); -void shmem_java_releaseWriteIntArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jintArray array, int off, int len); -void shmem_java_releaseWriteLongArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jlongArray array, int off, int len); -void shmem_java_releaseWriteFloatArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jfloatArray array, int off, int len); -void shmem_java_releaseWriteDoubleArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jdoubleArray array, int off, int len); - -void* shmem_java_iGetBuffer( - shmem_java_buffer_t **item, JNIEnv *env, - int stride, int len, int elementSize); - -jshort* shmem_java_iGetReadShortArray( - shmem_java_buffer_t **item, JNIEnv *env, - jshortArray array, int off, int stride, int len); -jint* shmem_java_iGetReadIntArray( - shmem_java_buffer_t **item, JNIEnv *env, - jintArray array, int off, int stride, int len); -jlong* shmem_java_iGetReadLongArray( - shmem_java_buffer_t **item, JNIEnv *env, - jlongArray array, int off, int stride, int len); -jfloat* shmem_java_iGetReadFloatArray( - shmem_java_buffer_t **item, JNIEnv *env, - jfloatArray array, int off, int stride, int len); -jdouble* shmem_java_iGetReadDoubleArray( - shmem_java_buffer_t **item, JNIEnv *env, - jdoubleArray array, int off, int stride, int len); - -void shmem_java_iReleaseWriteShortArray( - jshort *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jshortArray array, int off, int stride, int len); -void shmem_java_iReleaseWriteIntArray( - jint *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jintArray array, int off, int stride, int len); -void shmem_java_iReleaseWriteLongArray( - jlong *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jlongArray array, int off, int stride, int len); -void shmem_java_iReleaseWriteFloatArray( - jfloat *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jfloatArray array, int off, int stride, int len); -void shmem_java_iReleaseWriteDoubleArray( - jdouble *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jdoubleArray array, int off, int stride, int len); - -#endif /* _SHMEMJAVA_H_ */ diff --git a/oshmem/shmem/java/c/shmem_Addr.c b/oshmem/shmem/java/c/shmem_Addr.c deleted file mode 100644 index e5ffcd6aff..0000000000 --- a/oshmem/shmem/java/c/shmem_Addr.c +++ /dev/null @@ -1,951 +0,0 @@ -#include "oshmem_config.h" - -#include -#include -#include - -#ifdef HAVE_TARGETCONDITIONALS_H -#include -#endif - -#include "shmem.h" -#include "shmem_Addr.h" -#include "shmemJava.h" - -JNIEXPORT void JNICALL Java_shmem_Addr_init(JNIEnv *env, jclass clazz) -{ - shmem_java.AddrHandle = (*env)->GetFieldID(env, clazz, "handle", "J"); -} - -JNIEXPORT jobject JNICALL Java_shmem_Addr_malloc( - JNIEnv *env, jobject jthis, jint size) -{ - void *addr = shmalloc(size); - (*env)->SetLongField(env, jthis, shmem_java.AddrHandle, (jlong)addr); - return addr ? (*env)->NewDirectByteBuffer(env, addr, size) : NULL; -} - -JNIEXPORT jobject JNICALL Java_shmem_Addr_memalign( - JNIEnv *env, jobject jthis, jint align, jint size) -{ - void *addr = shmemalign(align, size); - (*env)->SetLongField(env, jthis, shmem_java.AddrHandle, (jlong)addr); - return addr ? (*env)->NewDirectByteBuffer(env, addr, size) : NULL; -} - -JNIEXPORT jobject JNICALL Java_shmem_Addr_realloc( - JNIEnv *env, jobject jthis, jlong jaddr, jint size) -{ - void *addr = shrealloc((void*)jaddr, size); - (*env)->SetLongField(env, jthis, shmem_java.AddrHandle, (jlong)addr); - return addr ? (*env)->NewDirectByteBuffer(env, addr, size) : NULL; -} - -JNIEXPORT jboolean JNICALL Java_shmem_Addr_isAccessible( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_addr_accessible((void*)addr, pe) ? JNI_TRUE : JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_shmem_Addr_free( - JNIEnv *env, jobject jthis, jlong addr) -{ - shfree((void*)addr); -} - -JNIEXPORT jobject JNICALL Java_shmem_Addr_getAddr( - JNIEnv *env, jobject jthis, jobject buff, jint pe, jobject obj) -{ - void *addr = (*env)->GetDirectBufferAddress(env, buff); - jlong size = (*env)->GetDirectBufferCapacity(env, buff); - void *ptr = shmem_ptr(addr, pe); - (*env)->SetLongField(env, obj, shmem_java.AddrHandle, (jlong)ptr); - return ptr ? (*env)->NewDirectByteBuffer(env, ptr, size) : NULL; -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putByte( - JNIEnv *env, jobject jthis, jlong addr, jbyte value, jint pe) -{ - shmem_char_p((char*)addr, (char)value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putShort( - JNIEnv *env, jobject jthis, jlong addr, jshort value, jint pe) -{ - shmem_int16_p((int16_t*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putInt( - JNIEnv *env, jobject jthis, jlong addr, jint value, jint pe) -{ - shmem_int32_p((int32_t*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putLong( - JNIEnv *env, jobject jthis, jlong addr, jlong value, jint pe) -{ - shmem_int64_p((int64_t*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putFloat( - JNIEnv *env, jobject jthis, jlong addr, jfloat value, jint pe) -{ - shmem_float_p((float*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putDouble( - JNIEnv *env, jobject jthis, jlong addr, jdouble value, jint pe) -{ - shmem_double_p((double*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putByteBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_char_put((char*)addr, source, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putByteArray( - JNIEnv *env, jobject jthis, jlong addr, - jbyteArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_getReadByteArray(&item, env, array, off, len); - shmem_char_put((char*)addr, source, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putShortBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_put16((void*)addr, source, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putShortArray( - JNIEnv *env, jobject jthis, jlong addr, - jshortArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_getReadShortArray(&item, env, array, off, len); - shmem_put16((void*)addr, source, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putIntBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_put32((void*)addr, source, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putIntArray( - JNIEnv *env, jobject jthis, jlong addr, - jintArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_getReadIntArray(&item, env, array, off, len); - shmem_put32((void*)addr, source, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putLongBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_put64((void*)addr, source, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putLongArray( - JNIEnv *env, jobject jthis, jlong addr, - jlongArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_getReadLongArray(&item, env, array, off, len); - shmem_put64((void*)addr, source, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putFloatBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_float_put((float*)addr, source, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putFloatArray( - JNIEnv *env, jobject jthis, jlong addr, - jfloatArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_getReadFloatArray(&item, env, array, off, len); - shmem_float_put((float*)addr, source, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putDoubleBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_double_put((double*)addr, source, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_putDoubleArray( - JNIEnv *env, jobject jthis, jlong addr, - jdoubleArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_getReadDoubleArray(&item, env, array, off, len); - shmem_double_put((double*)addr, source, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutShortBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_iput16((void*)addr, source, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutShortArray( - JNIEnv *env, jobject jthis, jlong addr, - jshortArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_iGetReadShortArray(&item,env,array,off,sst,len); - shmem_iput16((void*)addr, source, tst, sst, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutIntBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_iput32((void*)addr, source, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutIntArray( - JNIEnv *env, jobject jthis, jlong addr, - jintArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_iGetReadIntArray(&item,env,array,off,sst,len); - shmem_iput32((void*)addr, source, tst, sst, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutLongBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_iput64((void*)addr, source, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutLongArray( - JNIEnv *env, jobject jthis, jlong addr, - jlongArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_iGetReadLongArray(&item,env,array,off,sst,len); - shmem_iput64((void*)addr, source, tst, sst, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutFloatBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_float_iput((float*)addr, source, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutFloatArray( - JNIEnv *env, jobject jthis, jlong addr, - jfloatArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_iGetReadFloatArray(&item,env,array,off,sst,len); - shmem_float_iput((float*)addr, source, tst, sst, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutDoubleBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *source = (*env)->GetDirectBufferAddress(env, buffer); - shmem_double_iput((double*)addr, source, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iPutDoubleArray( - JNIEnv *env, jobject jthis, jlong addr, - jdoubleArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *source = shmem_java_iGetReadDoubleArray(&item,env,array,off,sst,len); - shmem_double_iput((double*)addr, source, tst, sst, len, pe); - shmem_java_releaseBuffer(source, item); -} - -JNIEXPORT jbyte JNICALL Java_shmem_Addr_getByte( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_char_g((char*)addr, pe); -} - -JNIEXPORT jshort JNICALL Java_shmem_Addr_getShort( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_int16_g((int16_t*)addr, pe); -} - -JNIEXPORT jint JNICALL Java_shmem_Addr_getInt( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_int32_g((int32_t*)addr, pe); -} - -JNIEXPORT jlong JNICALL Java_shmem_Addr_getLong( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_int64_g((int64_t*)addr, pe); -} - -JNIEXPORT jfloat JNICALL Java_shmem_Addr_getFloat( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_float_g((float*)addr, pe); -} - -JNIEXPORT jdouble JNICALL Java_shmem_Addr_getDouble( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_double_g((double*)addr, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getByteBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_char_get(target, (char*)addr, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getByteArray( - JNIEnv *env, jobject jthis, jlong addr, - jbyteArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_getBuffer(&item, env, len); - shmem_char_get(target, (char*)addr, len, pe); - shmem_java_releaseWriteByteArray(target, item, env, array, off, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getShortBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_get16(target, (void*)addr, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getShortArray( - JNIEnv *env, jobject jthis, jlong addr, - jshortArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_getBuffer(&item, env, len * 2); - shmem_get16(target, (void*)addr, len, pe); - shmem_java_releaseWriteShortArray(target, item, env, array, off, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getIntBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_get32(target, (void*)addr, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getIntArray( - JNIEnv *env, jobject jthis, jlong addr, - jintArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_getBuffer(&item, env, len * 4); - shmem_get32(target, (void*)addr, len, pe); - shmem_java_releaseWriteIntArray(target, item, env, array, off, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getLongBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_get64(target, (void*)addr, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getLongArray( - JNIEnv *env, jobject jthis, jlong addr, - jlongArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_getBuffer(&item, env, len * 8); - shmem_get64(target, (void*)addr, len, pe); - shmem_java_releaseWriteLongArray(target, item, env, array, off, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getFloatBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_float_get(target, (float*)addr, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getFloatArray( - JNIEnv *env, jobject jthis, jlong addr, - jfloatArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_getBuffer(&item, env, len * 4); - shmem_float_get(target, (float*)addr, len, pe); - shmem_java_releaseWriteFloatArray(target, item, env, array, off, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getDoubleBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_double_get(target, (double*)addr, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_getDoubleArray( - JNIEnv *env, jobject jthis, jlong addr, - jdoubleArray array, jint off, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_getBuffer(&item, env, len * 8); - shmem_double_get(target, (double*)addr, len, pe); - shmem_java_releaseWriteDoubleArray(target, item, env, array, off, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetShortBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_iget16(target, (void*)addr, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetShortArray( - JNIEnv *env, jobject jthis, jlong addr, - jshortArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_iGetBuffer(&item, env, tst, len, 2); - shmem_iget16(target, (void*)addr, tst, sst, len, pe); - shmem_java_iReleaseWriteShortArray(target, item, env, array, off, tst, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetIntBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_iget32(target, (void*)addr, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetIntArray( - JNIEnv *env, jobject jthis, jlong addr, - jintArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_iGetBuffer(&item, env, tst, len, 4); - shmem_iget32(target, (void*)addr, tst, sst, len, pe); - shmem_java_iReleaseWriteIntArray(target, item, env, array, off, tst, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetLongBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_iget64(target, (void*)addr, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetLongArray( - JNIEnv *env, jobject jthis, jlong addr, - jlongArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_iGetBuffer(&item, env, tst, len, 8); - shmem_iget64(target, (void*)addr, tst, sst, len, pe); - shmem_java_iReleaseWriteLongArray(target, item, env, array, off, tst, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetFloatBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_float_iget(target, (float*)addr, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetFloatArray( - JNIEnv *env, jobject jthis, jlong addr, - jfloatArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_iGetBuffer(&item, env, tst, len, 4); - shmem_float_iget(target, (void*)addr, tst, sst, len, pe); - shmem_java_iReleaseWriteFloatArray(target, item, env, array, off, tst, len); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetDoubleBuffer( - JNIEnv *env, jobject jthis, jlong addr, - jobject buffer, jint tst, jint sst, jint len, jint pe) -{ - void *target = (*env)->GetDirectBufferAddress(env, buffer); - shmem_double_iget(target, (double*)addr, tst, sst, len, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_iGetDoubleArray( - JNIEnv *env, jobject jthis, jlong addr, - jdoubleArray array, jint off, jint tst, jint sst, jint len, jint pe) -{ - shmem_java_buffer_t *item; - void *target = shmem_java_iGetBuffer(&item, env, tst, len, 8); - shmem_double_iget(target, (void*)addr, tst, sst, len, pe); - shmem_java_iReleaseWriteDoubleArray(target,item, env, array, off, tst, len); -} - -JNIEXPORT jint JNICALL Java_shmem_Addr_swapInt( - JNIEnv *env, jobject jthis, jlong addr, jint value, jint pe) -{ - return shmem_int32_swap((int32_t*)addr, value, pe); -} - -JNIEXPORT jlong JNICALL Java_shmem_Addr_swapLong( - JNIEnv *env, jobject jthis, jlong addr, jlong value, jint pe) -{ - return shmem_int64_swap((int64_t*)addr, value, pe); -} - -JNIEXPORT jfloat JNICALL Java_shmem_Addr_swapFloat( - JNIEnv *env, jobject jthis, jlong addr, jfloat value, jint pe) -{ - return shmem_float_swap((float*)addr, value, pe); -} - -JNIEXPORT jdouble JNICALL Java_shmem_Addr_swapDouble( - JNIEnv *env, jobject jthis, jlong addr, jdouble value, jint pe) -{ - return shmem_double_swap((double*)addr, value, pe); -} - -JNIEXPORT jint JNICALL Java_shmem_Addr_cSwapInt( - JNIEnv *env, jobject jthis, jlong addr, jint cond, jint value, jint pe) -{ - return shmem_int32_cswap((int32_t*)addr, cond, value, pe); -} - -JNIEXPORT jlong JNICALL Java_shmem_Addr_cSwapLong( - JNIEnv *env, jobject jthis, jlong addr, - jlong cond, jlong value, jint pe) -{ - return shmem_int64_cswap((int64_t*)addr, cond, value, pe); -} - -JNIEXPORT jint JNICALL Java_shmem_Addr_fAddInt( - JNIEnv *env, jobject jthis, jlong addr, jint value, jint pe) -{ - return shmem_int32_fadd((int32_t*)addr, value, pe); -} - -JNIEXPORT jlong JNICALL Java_shmem_Addr_fAddLong( - JNIEnv *env, jobject jthis, jlong addr, jlong value, jint pe) -{ - return shmem_int64_fadd((int64_t*)addr, value, pe); -} - -JNIEXPORT jint JNICALL Java_shmem_Addr_fIncInt( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_int32_finc((int32_t*)addr, pe); -} - -JNIEXPORT jlong JNICALL Java_shmem_Addr_fIncLong( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - return shmem_int64_finc((int64_t*)addr, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_addInt( - JNIEnv *env, jobject jthis, jlong addr, jint value, jint pe) -{ - shmem_int32_add((int32_t*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_addLong( - JNIEnv *env, jobject jthis, jlong addr, jlong value, jint pe) -{ - shmem_int64_add((int64_t*)addr, value, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_incInt( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - shmem_int32_inc((int32_t*)addr, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_incLong( - JNIEnv *env, jobject jthis, jlong addr, jint pe) -{ - shmem_int64_inc((int64_t*)addr, pe); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_setLock( - JNIEnv *env, jobject jthis, jlong addr) -{ - shmem_set_lock((long*)addr); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_clearLock( - JNIEnv *env, jobject jthis, jlong addr) -{ - shmem_clear_lock((long*)addr); -} - -JNIEXPORT jboolean JNICALL Java_shmem_Addr_testLock( - JNIEnv *env, jobject jthis, jlong addr) -{ - int r = shmem_test_lock((long*)addr); - - if (0 == r) { - return JNI_FALSE; - } else if (1 == r) { - return JNI_TRUE; - } - - /* Should never get here */ - opal_output(0, "*** Java lock is neither true nor false; something is very wrong!"); - abort(); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_waitInt( - JNIEnv *env, jobject jthis, jlong addr, jint value) -{ - shmem_int32_wait((void*)addr, value); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_waitLong( - JNIEnv *env, jobject jthis, jlong addr, jlong value) -{ - shmem_int64_wait((void*)addr, value); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_waitUntilInt( - JNIEnv *env, jobject jthis, jlong addr, jint cmp, jint value) -{ - shmem_int32_wait_until((void*)addr, cmp, value); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_waitUntilLong( - JNIEnv *env, jobject jthis, jlong addr, jint cmp, jlong value) -{ - shmem_int64_wait_until((void*)addr, cmp, value); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_broadcast32( - JNIEnv *env, jobject jthis, jlong target, jlong source, - jint nlong, jint PE_root, jint PE_start, jint logPE_stride, - jint PE_size, jlong pSync) -{ - shmem_broadcast32((void*)target, (void*)source, nlong, PE_root, - PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_broadcast64( - JNIEnv *env, jobject jthis, jlong target, jlong source, - jint nlong, jint PE_root, jint PE_start, jint logPE_stride, - jint PE_size, jlong pSync) -{ - shmem_broadcast64((void*)target, (void*)source, nlong, PE_root, - PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_collect32( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nlong, - jint PE_start, jint logPE_stride, jint PE_size, jlong pSync) -{ - shmem_collect32((void*)target, (void*)source, nlong, - PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_collect64( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nlong, - jint PE_start, jint logPE_stride, jint PE_size, jlong pSync) -{ - shmem_collect64((void*)target, (void*)source, nlong, - PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_fcollect32( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nlong, - jint PE_start, jint logPE_stride, jint PE_size, jlong pSync) -{ - shmem_fcollect32((void*)target, (void*)source, nlong, - PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_fcollect64( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nlong, - jint PE_start, jint logPE_stride, jint PE_size, jlong pSync) -{ - shmem_fcollect64((void*)target, (void*)source, nlong, - PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_andToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_and_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_andToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_and_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_andToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_and_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_orToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_or_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_orToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_or_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_orToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_or_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_xorToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_xor_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_xorToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_xor_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_xorToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_xor_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_maxToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_max_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_maxToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_max_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_maxToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_max_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_maxToAllFloat( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_float_max_to_all((float*)target, (float*)source, nreduce, PE_start, - logPE_stride, PE_size, (float*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_maxToAllDouble( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_double_max_to_all((double*)target, (double*)source, nreduce, PE_start, - logPE_stride, PE_size, (double*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_minToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_min_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_minToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_min_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_minToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_min_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_minToAllFloat( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_float_min_to_all((float*)target, (float*)source, nreduce, PE_start, - logPE_stride, PE_size, (float*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_minToAllDouble( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_double_min_to_all((double*)target, (double*)source, nreduce, PE_start, - logPE_stride, PE_size, (double*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_sumToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_sum_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_sumToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_sum_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_sumToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_sum_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_sumToAllFloat( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_float_sum_to_all((float*)target, (float*)source, nreduce, PE_start, - logPE_stride, PE_size, (float*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_sumToAllDouble( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_double_sum_to_all((double*)target, (double*)source, nreduce, PE_start, - logPE_stride, PE_size, (double*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_prodToAllShort( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int16_prod_to_all((int16_t*)target, (int16_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int16_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_prodToAllInt( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int32_prod_to_all((int32_t*)target, (int32_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int32_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_prodToAllLong( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_int64_prod_to_all((int64_t*)target, (int64_t*)source, nreduce, PE_start, - logPE_stride, PE_size, (int64_t*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_prodToAllFloat( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_float_prod_to_all((float*)target, (float*)source, nreduce, PE_start, - logPE_stride, PE_size, (float*)pWrk, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_Addr_prodToAllDouble( - JNIEnv *env, jobject jthis, jlong target, jlong source, jint nreduce, - jint PE_start, jint logPE_stride, jint PE_size, jlong pWrk, jlong pSync) -{ - shmem_double_prod_to_all((double*)target, (double*)source, nreduce, PE_start, - logPE_stride, PE_size, (double*)pWrk, (long*)pSync); -} diff --git a/oshmem/shmem/java/c/shmem_Constant.c b/oshmem/shmem/java/c/shmem_Constant.c deleted file mode 100644 index 7e35eab075..0000000000 --- a/oshmem/shmem/java/c/shmem_Constant.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "oshmem_config.h" - -#include -#include -#include - -#ifdef HAVE_TARGETCONDITIONALS_H -#include -#endif - -#include "shmem.h" -#include "shmem_Constant.h" -#include "shmemJava.h" /* must come AFTER the related .h so JNI is included */ - -static void setIntField(JNIEnv *env, jclass c, jobject obj, - char *field, jint value) -{ - jfieldID id = (*env)->GetFieldID(env, c, field, "I"); - (*env)->SetIntField(env, obj, id, value); -} - -JNIEXPORT void JNICALL Java_shmem_Constant_setConstant(JNIEnv *env, jobject obj) -{ - jclass c = (*env)->GetObjectClass(env, obj); - setIntField(env, c, obj, "CMP_EQ", SHMEM_CMP_EQ); - setIntField(env, c, obj, "CMP_GE", SHMEM_CMP_GE); - setIntField(env, c, obj, "CMP_GT", SHMEM_CMP_GT); - setIntField(env, c, obj, "CMP_LE", SHMEM_CMP_LE); - setIntField(env, c, obj, "CMP_LT", SHMEM_CMP_LT); - setIntField(env, c, obj, "CMP_NE", SHMEM_CMP_NE); - - setIntField(env, c, obj, "BARRIER_SYNC_SIZE", - SHMEM_BARRIER_SYNC_SIZE); - setIntField(env, c, obj, "BCAST_SYNC_SIZE", - SHMEM_BCAST_SYNC_SIZE); - setIntField(env, c, obj, "COLLECT_SYNC_SIZE", - SHMEM_COLLECT_SYNC_SIZE); - setIntField(env, c, obj, "REDUCE_SYNC_SIZE", - SHMEM_REDUCE_SYNC_SIZE); - setIntField(env, c, obj, "REDUCE_MIN_WRKDATA_SIZE", - SHMEM_REDUCE_MIN_WRKDATA_SIZE); - setIntField(env, c, obj, "SYNC_VALUE", - SHMEM_SYNC_VALUE); -} diff --git a/oshmem/shmem/java/c/shmem_PSync.c b/oshmem/shmem/java/c/shmem_PSync.c deleted file mode 100644 index 90620cac86..0000000000 --- a/oshmem/shmem/java/c/shmem_PSync.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "oshmem_config.h" - -#include -#include -#include - -#ifdef HAVE_TARGETCONDITIONALS_H -#include -#endif - -#include "shmem.h" -#include "shmem_PSync.h" -#include "shmemJava.h" - -JNIEXPORT jlong JNICALL Java_shmem_PSync_newPSync( - JNIEnv *env, jobject jthis, jint size) -{ - long *pSync = shmalloc(size * sizeof(long)); - int i; - - for(i = 0; i < size; i++) - pSync[i] = _SHMEM_SYNC_VALUE; - - return (jlong)pSync; -} - -JNIEXPORT void JNICALL Java_shmem_PSync_free( - JNIEnv *env, jobject jthis, jlong handle) -{ - shfree((void*)handle); -} diff --git a/oshmem/shmem/java/c/shmem_ShMem.c b/oshmem/shmem/java/c/shmem_ShMem.c deleted file mode 100644 index 2ea5210a6d..0000000000 --- a/oshmem/shmem/java/c/shmem_ShMem.c +++ /dev/null @@ -1,488 +0,0 @@ -#include "oshmem_config.h" - -#include -#include -#include - -#ifdef HAVE_TARGETCONDITIONALS_H -#include -#endif - -#include "shmem.h" -#include "shmem_ShMem.h" -#include "shmemJava.h" /* must come AFTER the related .h so JNI is included */ - -shmem_java_globals_t shmem_java; -int oshmem_shmem_java_eager = 65536; -opal_free_list_t shmem_java_buffers; -static void *liboshmem = NULL; - -static void bufferConstructor(shmem_java_buffer_t *item) -{ - item->buffer = malloc(oshmem_shmem_java_eager); -} - -static void bufferDestructor(shmem_java_buffer_t *item) -{ - free(item->buffer); -} - -OBJ_CLASS_INSTANCE(shmem_java_buffer_t, - opal_free_list_item_t, - bufferConstructor, - bufferDestructor); - -static void initFreeList(void) -{ - mca_base_var_register("oshmem", "shmem", "java", "eager", - "Java buffers eager size", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_READONLY, - &oshmem_shmem_java_eager); - - OBJ_CONSTRUCT(&shmem_java_buffers, opal_free_list_t); - - int r = opal_free_list_init(&shmem_java_buffers, - sizeof(shmem_java_buffer_t), - opal_cache_line_size, - OBJ_CLASS(shmem_java_buffer_t), - 0, /* payload size */ - 0, /* payload align */ - 2, /* initial elements to alloc */ - -1, /* max elements */ - 2, /* num elements per alloc */ - NULL, /* mpool */ - 0, /* mpool reg flags */ - NULL, /* unused0 */ - NULL, /* item_init */ - NULL /* inem_init context */); - if(r != OPAL_SUCCESS) - { - fprintf(stderr, "Unable to initialize shmem_java_buffers.\n"); - exit(1); - } -} - -static jclass findClass(JNIEnv *env, const char *className) -{ - jclass c = (*env)->FindClass(env, className), - r = (*env)->NewGlobalRef(env, c); - - (*env)->DeleteLocalRef(env, c); - return r; -} - -jint JNI_OnLoad(JavaVM *vm, void *reserved) -{ - /* These are the equivalences between the Java and C types. */ - if( sizeof(jbyte) != sizeof(char) || - sizeof(jshort) != sizeof(int16_t) || - sizeof(jint) != sizeof(int32_t) || - sizeof(jlong) != sizeof(int64_t)) - { - fprintf(stderr, "C types not match with Java.\n"); - exit(1); - } - - liboshmem = dlopen("liboshmem." OPAL_DYN_LIB_SUFFIX, - RTLD_NOW | RTLD_GLOBAL); - - if(liboshmem == NULL) - { - fprintf(stderr, "Java bindings failed to load liboshmem: %s\n",dlerror()); - exit(1); - } - - initFreeList(); - return JNI_VERSION_1_6; -} - -void JNI_OnUnload(JavaVM *vm, void *reserved) -{ - OBJ_DESTRUCT(&shmem_java_buffers); - JNIEnv *env; - (*vm)->GetEnv(vm, (void**)&env, 6); - (*env)->DeleteGlobalRef(env, shmem_java.ExceptionClass); - dlclose(liboshmem); -} - -JNIEXPORT void JNICALL Java_shmem_ShMem_init(JNIEnv *env, jclass clazz) -{ - shmem_java.ExceptionClass = findClass(env, "shmem/ShMemException"); -} - -JNIEXPORT void JNICALL Java_shmem_ShMem_startPEs( - JNIEnv *env, jclass clazz, jint i) -{ - start_pes(i); -} - -JNIEXPORT jint JNICALL Java_shmem_ShMem_getNumPEs(JNIEnv *env, jclass clazz) -{ - return _num_pes(); -} - -JNIEXPORT jint JNICALL Java_shmem_ShMem_getMyPE(JNIEnv *env, jclass clazz) -{ - return _my_pe(); -} - -JNIEXPORT void JNICALL Java_shmem_ShMem_barrier( - JNIEnv *env, jclass clazz, jint PE_start, - jint logPE_stride, jint PE_size, jlong pSync) -{ - shmem_barrier(PE_start, logPE_stride, PE_size, (long*)pSync); -} - -JNIEXPORT void JNICALL Java_shmem_ShMem_barrierAll(JNIEnv *env, jclass clazz) -{ - shmem_barrier_all(); -} - -JNIEXPORT void JNICALL Java_shmem_ShMem_fence(JNIEnv *env, jclass clazz) -{ - shmem_fence(); -} - -JNIEXPORT void JNICALL Java_shmem_ShMem_quiet(JNIEnv *env, jclass clazz) -{ - shmem_quiet(); -} - -void* shmem_java_getBuffer(shmem_java_buffer_t **item, JNIEnv *env, int size) -{ - if(size > oshmem_shmem_java_eager) - { - *item = NULL; - return malloc(size); - } - else - { - opal_free_list_item_t *freeListItem; - OPAL_FREE_LIST_GET(&shmem_java_buffers, freeListItem); - - if (NULL == item) { - (*env)->ThrowNew(env, shmem_java.ExceptionClass, - "Error in OPAL_FREE_LIST_GET"); - } - - *item = (shmem_java_buffer_t*)freeListItem; - return (*item)->buffer; - } -} - -void shmem_java_releaseBuffer(void *ptr, shmem_java_buffer_t *item) -{ - if(item == NULL) - { - free(ptr); - } - else - { - assert(item->buffer == ptr); - OPAL_FREE_LIST_RETURN(&shmem_java_buffers, (opal_free_list_item_t*)item); - } -} - -jbyte* shmem_java_getReadByteArray(shmem_java_buffer_t **item, JNIEnv *env, - jbyteArray array, int off, int len) -{ - jbyte *ptr = shmem_java_getBuffer(item, env, len); - (*env)->GetByteArrayRegion(env, array, off, len, ptr); - return ptr; -} - -jshort* shmem_java_getReadShortArray(shmem_java_buffer_t **item, JNIEnv *env, - jshortArray array, int off, int len) -{ - jshort *ptr = shmem_java_getBuffer(item, env, len * 2); - (*env)->GetShortArrayRegion(env, array, off, len, ptr); - return ptr; -} - -jint* shmem_java_getReadIntArray(shmem_java_buffer_t **item, JNIEnv *env, - jintArray array, int off, int len) -{ - jint *ptr = shmem_java_getBuffer(item, env, len * 4); - (*env)->GetIntArrayRegion(env, array, off, len, ptr); - return ptr; -} - -jlong* shmem_java_getReadLongArray(shmem_java_buffer_t **item, JNIEnv *env, - jlongArray array, int off, int len) -{ - jlong *ptr = shmem_java_getBuffer(item, env, len * 8); - (*env)->GetLongArrayRegion(env, array, off, len, ptr); - return ptr; -} - -jfloat* shmem_java_getReadFloatArray(shmem_java_buffer_t **item, JNIEnv *env, - jfloatArray array, int off, int len) -{ - jfloat *ptr = shmem_java_getBuffer(item, env, len * 4); - (*env)->GetFloatArrayRegion(env, array, off, len, ptr); - return ptr; -} - -jdouble* shmem_java_getReadDoubleArray(shmem_java_buffer_t **item, JNIEnv *env, - jdoubleArray array, int off, int len) -{ - jdouble *ptr = shmem_java_getBuffer(item, env, len * 8); - (*env)->GetDoubleArrayRegion(env, array, off, len, ptr); - return ptr; -} - -void shmem_java_releaseWriteByteArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jbyteArray array, int off, int len) -{ - (*env)->SetByteArrayRegion(env, array, off, len, ptr); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_releaseWriteShortArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jshortArray array, int off, int len) -{ - (*env)->SetShortArrayRegion(env, array, off, len, ptr); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_releaseWriteIntArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jintArray array, int off, int len) -{ - (*env)->SetIntArrayRegion(env, array, off, len, ptr); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_releaseWriteLongArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jlongArray array, int off, int len) -{ - (*env)->SetLongArrayRegion(env, array, off, len, ptr); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_releaseWriteFloatArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jfloatArray array, int off, int len) -{ - (*env)->SetFloatArrayRegion(env, array, off, len, ptr); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_releaseWriteDoubleArray( - void *ptr, shmem_java_buffer_t *item, - JNIEnv *env, jdoubleArray array, int off, int len) -{ - (*env)->SetDoubleArrayRegion(env, array, off, len, ptr); - shmem_java_releaseBuffer(ptr, item); -} - -void* shmem_java_iGetBuffer( - shmem_java_buffer_t **item, JNIEnv *env, - int stride, int len, int elementSize) -{ - int size = (stride * (len - 1) + 1) * elementSize; - assert(size >= 0); - return shmem_java_getBuffer(item, env, size); -} - -jshort* shmem_java_iGetReadShortArray( - shmem_java_buffer_t **item, JNIEnv *env, - jshortArray array, int off, int stride, int len) -{ - jshort *ptr = shmem_java_iGetBuffer(item, env, stride, len, 2), - *des = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *src = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, JNI_ABORT); - return ptr; -} - -jint* shmem_java_iGetReadIntArray( - shmem_java_buffer_t **item, JNIEnv *env, - jintArray array, int off, int stride, int len) -{ - jint *ptr = shmem_java_iGetBuffer(item, env, stride, len, 4), - *des = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *src = arr + off; - - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, JNI_ABORT); - return ptr; -} - -jlong* shmem_java_iGetReadLongArray( - shmem_java_buffer_t **item, JNIEnv *env, - jlongArray array, int off, int stride, int len) -{ - jlong *ptr = shmem_java_iGetBuffer(item, env, stride, len, 8), - *des = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *src = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, JNI_ABORT); - return ptr; -} - -jfloat* shmem_java_iGetReadFloatArray( - shmem_java_buffer_t **item, JNIEnv *env, - jfloatArray array, int off, int stride, int len) -{ - jfloat *ptr = shmem_java_iGetBuffer(item, env, stride, len, 4), - *des = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *src = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, JNI_ABORT); - return ptr; -} - -jdouble* shmem_java_iGetReadDoubleArray( - shmem_java_buffer_t **item, JNIEnv *env, - jdoubleArray array, int off, int stride, int len) -{ - jdouble *ptr = shmem_java_iGetBuffer(item, env, stride, len, 8), - *des = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *src = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, JNI_ABORT); - return ptr; -} - -void shmem_java_iReleaseWriteShortArray( - jshort *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jshortArray array, int off, int stride, int len) -{ - jshort *src = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *des = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, 0); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_iReleaseWriteIntArray( - jint *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jintArray array, int off, int stride, int len) -{ - jint *src = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *des = arr + off; - - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, 0); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_iReleaseWriteLongArray( - jlong *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jlongArray array, int off, int stride, int len) -{ - jlong *src = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *des = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, 0); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_iReleaseWriteFloatArray( - jfloat *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jfloatArray array, int off, int stride, int len) -{ - jfloat *src = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *des = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, 0); - shmem_java_releaseBuffer(ptr, item); -} - -void shmem_java_iReleaseWriteDoubleArray( - jdouble *ptr, shmem_java_buffer_t *item, JNIEnv *env, - jdoubleArray array, int off, int stride, int len) -{ - jdouble *src = ptr, - *arr = (*env)->GetPrimitiveArrayCritical(env, array, NULL), - *des = arr + off; - int i; - for(i = 0; i < len; i++) - { - *des = *src; - des += stride; - src += stride; - } - - (*env)->ReleasePrimitiveArrayCritical(env, array, arr, 0); - shmem_java_releaseBuffer(ptr, item); -} diff --git a/oshmem/shmem/java/java/Addr.java b/oshmem/shmem/java/java/Addr.java deleted file mode 100644 index cafd5287ed..0000000000 --- a/oshmem/shmem/java/java/Addr.java +++ /dev/null @@ -1,2422 +0,0 @@ -package shmem; - -import java.nio.*; - -/** - * Symmetric data object. - */ -public final class Addr -{ -private long handle; // Address of the block memory. -private int offset; // Current offset of the data object. -private ByteBuffer buffer; // Direct buffer of the block memory. - -static -{ - init(); -} - -private static native void init(); - -private Addr() -{ -} - -/** - * Allocates a block of memory in the symmetric heap of the calling PE. - *

Java binding of {@code shmalloc}. - * @param size Size of the requested memory block, in bytes. - * @throws ShMemException Allocation error. - */ -public Addr(int size) throws ShMemException -{ - buffer = malloc(size); - checkAllocation(); -} - -private native ByteBuffer malloc(int size); - -/** - * Allocates a block from the symmetric heap with a byte alignment - * specified by the programmer. - *

Java binding of {@code shmemalign}. - * @param align Size of the alignment block, in bytes. - * @param size Size for the memory block, in bytes. - * @throws ShMemException Allocation error. - */ -public Addr(int align, int size) throws ShMemException -{ - buffer = memalign(align, size); - checkAllocation(); -} - -private native ByteBuffer memalign(int align, int size); - -/** - * Expands or reduces the size of the block. - *

Java binding of {@code shrealloc}. - * @param size New size for the memory block, in bytes. - * @throws ShMemException Allocation error. - */ -public void realloc(int size) throws ShMemException -{ - buffer = realloc(handle, size); - checkAllocation(); -} - -private native ByteBuffer realloc(long addr, int size); - -/** - * Creates a new object that shares this object's content. - * @param offset Offset of the new data object, in bytes. - * @return New data object. - */ -public Addr slice(int offset) -{ - Addr addr = new Addr(); - addr.handle = handle; - addr.offset = offset; - addr.buffer = buffer; - return addr; -} - -/** - * Gets a view of this object as a byte buffer. - * @return Byte buffer. - */ -public ByteBuffer asByteBuffer() -{ - return ShMem.slice(buffer, offset); -} - -/** - * Gets a view of this object as a short buffer. - * @return Short buffer. - */ -public ShortBuffer asShortBuffer() -{ - buffer.position(offset); - return buffer.asShortBuffer(); -} - -/** - * Gets a view of this object as an int buffer. - * @return Int buffer. - */ -public IntBuffer asIntBuffer() -{ - buffer.position(offset); - return buffer.asIntBuffer(); -} - -/** - * Gets a view of this object as a long buffer. - * @return Long buffer. - */ -public LongBuffer asLongBuffer() -{ - buffer.position(offset); - return buffer.asLongBuffer(); -} - -/** - * Gets a view of this object as a float buffer. - * @return Float buffer. - */ -public FloatBuffer asFloatBuffer() -{ - buffer.position(offset); - return buffer.asFloatBuffer(); -} - -/** - * Gets a view of this object as a double buffer. - * @return Double buffer. - */ -public DoubleBuffer asDoubleBuffer() -{ - buffer.position(offset); - return buffer.asDoubleBuffer(); -} - -/** - * Writes a {@code byte} value to symmetric data object. - * @param value Value to be written. - */ -public void putByte(byte value) -{ - buffer.put(offset, value); -} - -/** - * Writes a {@code short} value to symmetric data object. - * @param value Value to be written. - */ -public void putShort(short value) -{ - buffer.putShort(offset, value); -} - -/** - * Writes a {@code int} value to symmetric data object. - * @param value Value to be written. - */ -public void putInt(int value) -{ - buffer.putInt(offset, value); -} - -/** - * Writes a {@code long} value to symmetric data object. - * @param value Value to be written. - */ -public void putLong(long value) -{ - buffer.putLong(offset, value); -} - -/** - * Writes a {@code float} value to symmetric data object. - * @param value Value to be written. - */ -public void putFloat(float value) -{ - buffer.putFloat(offset, value); -} - -/** - * Writes a {@code double} value to symmetric data object. - * @param value Value to be written. - */ -public void putDouble(double value) -{ - buffer.putDouble(offset, value); -} - -/** - * Reads a {@code short} value from the symmetric data object. - * @return Value readed. - */ -public short getShort() -{ - return buffer.getShort(offset); -} - -/** - * Reads a {@code int} value from the symmetric data object. - * @return Value readed. - */ -public int getInt() -{ - return buffer.getInt(offset); -} - -/** - * Reads a {@code long} value from the symmetric data object. - * @return Value readed. - */ -public long getLong() -{ - return buffer.getLong(offset); -} - -/** - * Reads a {@code float} value from the symmetric data object. - * @return Value readed. - */ -public float getFloat() -{ - return buffer.getFloat(offset); -} - -/** - * Reads a {@code double} value from the symmetric data object. - * @return Value readed. - */ -public double getDouble() -{ - return buffer.getDouble(offset); -} - -/** - * Indicates if an address is accessible via OpenSHMEM operations - * from the specified target PE. - *

Java binding of {@code shmem_addr_accessible}. - * @param pe PE number of the target PE. - * @return true if the address is accessible, false otherwise. - */ -public boolean isAccessible(int pe) -{ - return isAccessible(handle, pe); -} - -private native boolean isAccessible(long addr, int pe); - -/** - * Frees a memory block. - *

Java binding of {@code shfree}. - */ -public void free() -{ - free(handle); - handle = 0; - buffer = null; -} - -private native void free(long addr); - -private void checkAllocation() throws ShMemException -{ - if(buffer == null) - throw new ShMemException("Allocation error."); - - buffer.order(ByteOrder.nativeOrder()); -} - -/** - * Returns an address that can be used to directly reference - * target (this object) on the target PE. - *

Java binding of {@code shmem_ptr}. - * @param pe Target PE. - * @return Address to the data object on the target PE. - * @throws ShMemException if the target cannot be accessed directly. - */ -public Addr getAddr(int pe) throws ShMemException -{ - // If native getAddr returns null maybe we also must - // return null instead of throwing an exception. - Addr addr = new Addr(); - addr.buffer = getAddr(buffer, pe, addr); - addr.offset = offset; - addr.checkAllocation(); - return addr; -} - -private native ByteBuffer getAddr(ByteBuffer buff, int pe, Addr addr); - -/** - * Writes a {@code byte} to symmetric data object on the target PE. - *

Java binding of {@code shmem_char_p}. - * @param value Value to be transferred. - * @param pe Target PE. - */ -public void putByte(byte value, int pe) -{ - putByte(addr(), value, pe); -} - -private native void putByte(long addr, byte value, int pe); - -/** - * Writes a {@code short} value to symmetric data object on the target PE. - *

Java binding of {@code shmem_short_p}. - * @param value Value to be transferred. - * @param pe Target PE. - */ -public void putShort(short value, int pe) -{ - putShort(addr(), value, pe); -} - -private native void putShort(long addr, short value, int pe); - -/** - * Writes an {@code int} value to symmetric data object on the target PE. - *

Java binding of {@code shmem_int_p}. - * @param value Value to be transferred. - * @param pe Target PE. - */ -public void putInt(int value, int pe) -{ - putInt(addr(), value, pe); -} - -private native void putInt(long addr, int value, int pe); - -/** - * Writes a {@code long} value to symmetric data object on the target PE. - *

Java binding of {@code shmem_long_p}. - * @param value Value to be transferred. - * @param pe Target PE. - */ -public void putLong(long value, int pe) -{ - putLong(addr(), value, pe); -} - -private native void putLong(long addr, long value, int pe); - -/** - * Writes a {@code float} value to symmetric data object on the target PE. - *

Java binding of {@code shmem_float_p}. - * @param value Value to be transferred. - * @param pe Target PE. - */ -public void putFloat(float value, int pe) -{ - putFloat(addr(), value, pe); -} - -private native void putFloat(long addr, float value, int pe); - -/** - * Writes a {@code double} value to symmetric data object on the target PE. - *

Java binding of {@code shmem_double_p}. - * @param value Value to be transferred. - * @param pe Target PE. - */ -public void putDouble(double value, int pe) -{ - putDouble(addr(), value, pe); -} - -private native void putDouble(long addr, double value, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source capacity. - *

Java binding of {@code shmem_char_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putByte(ByteBuffer source, int pe) -{ - int len = source.capacity(); - - if(source.isDirect()) - putByteBuffer(addr(), source, len, pe); - else - putByteArray(addr(), source.array(), source.arrayOffset(), len, pe); -} - -private native void putByteBuffer(long addr, Buffer src, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source length. - *

Java binding of {@code shmem_char_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putByte(byte[] source, int pe) -{ - putByteArray(addr(), source, 0, source.length, pe); -} - -private native void putByteArray( - long addr, byte[] src, int off, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source capacity. - *

Java binding of {@code shmem_short_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putShort(ShortBuffer source, int pe) -{ - int len = source.capacity(); - - if(source.isDirect()) - putShortBuffer(addr(), source, len, pe); - else - putShortArray(addr(), source.array(), source.arrayOffset(), len, pe); -} - -private native void putShortBuffer(long addr, Buffer src, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source length. - *

Java binding of {@code shmem_short_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putShort(short[] source, int pe) -{ - putShortArray(addr(), source, 0, source.length, pe); -} - -private native void putShortArray( - long addr, short[] src, int off, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source capacity. - *

Java binding of {@code shmem_int_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putInt(IntBuffer source, int pe) -{ - int len = source.capacity(); - - if(source.isDirect()) - putIntBuffer(addr(), source, len, pe); - else - putIntArray(addr(), source.array(), source.arrayOffset(), len, pe); -} - -private native void putIntBuffer(long addr, Buffer src, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source length. - *

Java binding of {@code shmem_int_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putInt(int[] source, int pe) -{ - putIntArray(addr(), source, 0, source.length, pe); -} - -private native void putIntArray(long addr, int[] src, int off, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source capacity. - *

Java binding of {@code shmem_long_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putLong(LongBuffer source, int pe) -{ - int len = source.capacity(); - - if(source.isDirect()) - putLongBuffer(addr(), source, len, pe); - else - putLongArray(addr(), source.array(), source.arrayOffset(), len, pe); -} - -private native void putLongBuffer(long addr, Buffer src, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source length. - *

Java binding of {@code shmem_long_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putLong(long[] source, int pe) -{ - putLongArray(addr(), source, 0, source.length, pe); -} - -private native void putLongArray( - long addr, long[] src, int off, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source capacity. - *

Java binding of {@code shmem_float_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putFloat(FloatBuffer source, int pe) -{ - int len = source.capacity(); - - if(source.isDirect()) - putFloatBuffer(addr(), source, len, pe); - else - putFloatArray(addr(), source.array(), source.arrayOffset(), len, pe); -} - -private native void putFloatBuffer(long addr, Buffer src, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source length. - *

Java binding of {@code shmem_float_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putFloat(float[] source, int pe) -{ - putFloatArray(addr(), source, 0, source.length, pe); -} - -private native void putFloatArray( - long addr, float[] src, int off, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source capacity. - *

Java binding of {@code shmem_double_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putDouble(DoubleBuffer source, int pe) -{ - int len = source.capacity(); - - if(source.isDirect()) - putDoubleBuffer(addr(), source, len, pe); - else - putDoubleArray(addr(), source.array(), source.arrayOffset(), len, pe); -} - -private native void putDoubleBuffer(long addr, Buffer src, int len, int pe); - -/** - * Copies contiguous data from a local object to an object - * on the destination PE. - *

The number of elements to be transferred is the source length. - *

Java binding of {@code shmem_double_put}. - * @param source Buffer to be transferred to the target data object. - * @param pe Target PE. - */ -public void putDouble(double[] source, int pe) -{ - putDoubleArray(addr(), source, 0, source.length, pe); -} - -private native void putDoubleArray( - long addr, double[] src, int off, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_short_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutShort(ShortBuffer source, int tst, int sst, int len, int pe) -{ - if(source.isDirect()) - { - iPutShortBuffer(addr(), source, tst, sst, len, pe); - } - else - { - iPutShortArray(addr(), source.array(), - source.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iPutShortBuffer( - long addr, ShortBuffer src, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_short_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutShort(short[] source, int tst, int sst, int len, int pe) -{ - iPutShortArray(addr(), source, 0, tst, sst, len, pe); -} - -private native void iPutShortArray( - long addr, short[] src, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_int_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutInt(IntBuffer source, int tst, int sst, int len, int pe) -{ - if(source.isDirect()) - { - iPutIntBuffer(addr(), source, tst, sst, len, pe); - } - else - { - iPutIntArray(addr(), source.array(), - source.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iPutIntBuffer( - long addr, Buffer src, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_int_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutInt(int[] source, int tst, int sst, int len, int pe) -{ - iPutIntArray(addr(), source, 0, tst, sst, len, pe); -} - -private native void iPutIntArray( - long addr, int[] src, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_long_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutLong(LongBuffer source, int tst, int sst, int len, int pe) -{ - if(source.isDirect()) - { - iPutLongBuffer(addr(), source, tst, sst, len, pe); - } - else - { - iPutLongArray(addr(), source.array(), - source.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iPutLongBuffer( - long addr, Buffer src, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_long_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutLong(long[] source, int tst, int sst, int len, int pe) -{ - iPutLongArray(addr(), source, 0, tst, sst, len, pe); -} - -private native void iPutLongArray( - long addr, long[] src, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_float_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutFloat(FloatBuffer source, int tst, int sst, int len, int pe) -{ - if(source.isDirect()) - { - iPutFloatBuffer(addr(), source, tst, sst, len, pe); - } - else - { - iPutFloatArray(addr(), source.array(), - source.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iPutFloatBuffer( - long addr, Buffer src, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_float_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutFloat(float[] source, int tst, int sst, int len, int pe) -{ - iPutFloatArray(addr(), source, 0, tst, sst, len, pe); -} - -private native void iPutFloatArray( - long addr, float[] src, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_double_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutDouble(DoubleBuffer source, int tst, int sst, int len, int pe) -{ - if(source.isDirect()) - { - iPutDoubleBuffer(addr(), source, tst, sst, len, pe); - } - else - { - iPutDoubleArray(addr(), source.array(), - source.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iPutDoubleBuffer( - long addr, Buffer src, int tst, int sst, int len, int pe); - -/** - * Copies strided data from a local object to a strided data object - * on the destination PE. - *

Java binding of {@code shmem_double_iput}. - * @param source Buffer to be transferred to the target data object. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iPutDouble(double[] source, int tst, int sst, int len, int pe) -{ - iPutDoubleArray(addr(), source, 0, tst, sst, len, pe); -} - -private native void iPutDoubleArray( - long addr, double[] src, int off, int tst, int sst, int len, int pe); - -/** - * Reads a {@code byte} from the symmetric data object on the target PE. - *

Java binding of {@code shmem_char_g}. - * @param pe Target PE. - * @return The value at the symmetric data object on the target PE. - */ -public byte getByte(int pe) -{ - return getByte(addr(), pe); -} - -private native byte getByte(long addr, int pe); - -/** - * Reads a {@code short} value from the symmetric data object on the target PE. - *

Java binding of {@code shmem_short_g}. - * @param pe Target PE. - * @return The value at the symmetric data object on the target PE. - */ -public short getShort(int pe) -{ - return getShort(addr(), pe); -} - -private native short getShort(long addr, int pe); - -/** - * Reads an {@code int} value from the symmetric data object on the target PE. - *

Java binding of {@code shmem_int_g}. - * @param pe Target PE. - * @return The value at the symmetric data object on the target PE. - */ -public int getInt(int pe) -{ - return getInt(addr(), pe); -} - -private native int getInt(long addr, int pe); - -/** - * Reads a {@code long} value from the symmetric data object on the target PE. - *

Java binding of {@code shmem_long_g}. - * @param pe Target PE. - * @return The value at the symmetric data object on the target PE. - */ -public long getLong(int pe) -{ - return getLong(addr(), pe); -} - -private native long getLong(long addr, int pe); - -/** - * Reads a {@code float} value from the symmetric data object on the target PE. - *

Java binding of {@code shmem_float_g}. - * @param pe Target PE. - * @return The value at the symmetric data object on the target PE. - */ -public float getFloat(int pe) -{ - return getFloat(addr(), pe); -} - -private native float getFloat(long addr, int pe); - -/** - * Reads a {@code double} value from the symmetric data object on the target PE. - *

Java binding of {@code shmem_double_g}. - * @param pe Target PE. - * @return The value at the symmetric data object on the target PE. - */ -public double getDouble(int pe) -{ - return getDouble(addr(), pe); -} - -private native double getDouble(long addr, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target capacity. - *

Java binding of {@code shmem_char_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getByte(ByteBuffer target, int pe) -{ - int len = target.capacity(); - - if(target.isDirect()) - getByteBuffer(addr(), target, len, pe); - else - getByteArray(addr(), target.array(), target.arrayOffset(), len, pe); -} - -private native void getByteBuffer(long addr, Buffer target, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target length. - *

Java binding of {@code shmem_char_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getByte(byte[] target, int pe) -{ - getByteArray(addr(), target, 0, target.length, pe); -} - -private native void getByteArray( - long addr, byte[] target, int off, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target capacity. - *

Java binding of {@code shmem_short_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getShort(ShortBuffer target, int pe) -{ - int len = target.capacity(); - - if(target.isDirect()) - getShortBuffer(addr(), target, len, pe); - else - getShortArray(addr(), target.array(), target.arrayOffset(), len, pe); -} - -private native void getShortBuffer(long addr, Buffer target, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target length. - *

Java binding of {@code shmem_short_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getShort(short[] target, int pe) -{ - getShortArray(addr(), target, 0, target.length, pe); -} - -private native void getShortArray( - long addr, short[] target, int off, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target capacity. - *

Java binding of {@code shmem_int_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getInt(IntBuffer target, int pe) -{ - int len = target.capacity(); - - if(target.isDirect()) - getIntBuffer(addr(), target, len, pe); - else - getIntArray(addr(), target.array(), target.arrayOffset(), len, pe); -} - -private native void getIntBuffer(long addr, Buffer target, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target length. - *

Java binding of {@code shmem_int_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getInt(int[] target, int pe) -{ - getIntArray(addr(), target, 0, target.length, pe); -} - -private native void getIntArray( - long addr, int[] target, int off, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target capacity. - *

Java binding of {@code shmem_long_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getLong(LongBuffer target, int pe) -{ - int len = target.capacity(); - - if(target.isDirect()) - getLongBuffer(addr(), target, len, pe); - else - getLongArray(addr(), target.array(), target.arrayOffset(), len, pe); -} - -private native void getLongBuffer(long addr, Buffer target, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target length. - *

Java binding of {@code shmem_long_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getLong(long[] target, int pe) -{ - getLongArray(addr(), target, 0, target.length, pe); -} - -private native void getLongArray( - long addr, long[] target, int off, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target capacity. - *

Java binding of {@code shmem_float_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getFloat(FloatBuffer target, int pe) -{ - int len = target.capacity(); - - if(target.isDirect()) - getFloatBuffer(addr(), target, len, pe); - else - getFloatArray(addr(), target.array(), target.arrayOffset(), len, pe); -} - -private native void getFloatBuffer(long addr, Buffer target, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target length. - *

Java binding of {@code shmem_float_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getFloat(float[] target, int pe) -{ - getFloatArray(addr(), target, 0, target.length, pe); -} - -private native void getFloatArray( - long addr, float[] target, int off, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target capacity. - *

Java binding of {@code shmem_double_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getDouble(DoubleBuffer target, int pe) -{ - int len = target.capacity(); - - if(target.isDirect()) - getDoubleBuffer(addr(), target, len, pe); - else - getDoubleArray(addr(), target.array(), target.arrayOffset(), len, pe); -} - -private native void getDoubleBuffer(long addr, Buffer target, int len, int pe); - -/** - * Copies contiguous data to a local object from an object on the target PE. - *

The number of elements to be transferred is the target length. - *

Java binding of {@code shmem_double_get}. - * @param target Buffer in which to save de data on the local PE. - * @param pe Target PE. - */ -public void getDouble(double[] target, int pe) -{ - getDoubleArray(addr(), target, 0, target.length, pe); -} - -private native void getDoubleArray( - long addr, double[] target, int off, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_short_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetShort(ShortBuffer target, int tst, int sst, int len, int pe) -{ - if(target.isDirect()) - { - iGetShortBuffer(addr(), target, tst, sst, len, pe); - } - else - { - iGetShortArray(addr(), target.array(), - target.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iGetShortBuffer( - long addr, Buffer target, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_short_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetShort(short[] target, int tst, int sst, int len, int pe) -{ - iGetShortArray(addr(), target, 0, tst, sst, len, pe); -} - -private native void iGetShortArray( - long addr, short[] target, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_int_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetInt(IntBuffer target, int tst, int sst, int len, int pe) -{ - if(target.isDirect()) - { - iGetIntBuffer(addr(), target, tst, sst, len, pe); - } - else - { - iGetIntArray(addr(), target.array(), - target.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iGetIntBuffer( - long addr, Buffer target, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_int_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetInt(int[] target, int tst, int sst, int len, int pe) -{ - iGetIntArray(addr(), target, 0, tst, sst, len, pe); -} - -private native void iGetIntArray( - long addr, int[] target, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_long_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetLong(LongBuffer target, int tst, int sst, int len, int pe) -{ - if(target.isDirect()) - { - iGetLongBuffer(addr(), target, tst, sst, len, pe); - } - else - { - iGetLongArray(addr(), target.array(), - target.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iGetLongBuffer( - long addr, Buffer target, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_long_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetLong(long[] target, int tst, int sst, int len, int pe) -{ - iGetLongArray(addr(), target, 0, tst, sst, len, pe); -} - -private native void iGetLongArray( - long addr, long[] target, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_float_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetFloat(FloatBuffer target, int tst, int sst, int len, int pe) -{ - if(target.isDirect()) - { - iGetFloatBuffer(addr(), target, tst, sst, len, pe); - } - else - { - iGetFloatArray(addr(), target.array(), - target.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iGetFloatBuffer( - long addr, Buffer target, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_float_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetFloat(float[] target, int tst, int sst, int len, int pe) -{ - iGetFloatArray(addr(), target, 0, tst, sst, len, pe); -} - -private native void iGetFloatArray( - long addr, float[] target, int off, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_double_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetDouble(DoubleBuffer target, int tst, int sst, int len, int pe) -{ - if(target.isDirect()) - { - iGetDoubleBuffer(addr(), target, tst, sst, len, pe); - } - else - { - iGetDoubleArray(addr(), target.array(), - target.arrayOffset(), tst, sst, len, pe); - } -} - -private native void iGetDoubleBuffer( - long addr, Buffer target, int tst, int sst, int len, int pe); - -/** - * Copies strided data located on a target PE to a local strided data object. - *

Java binding of {@code shmem_double_iget}. - * @param target Buffer in which to save the data on the local PE. - * @param tst Stride between consecutive elements in the target object. - * @param sst Stride between consecutive elements in the source object. - * @param len Number of elements in the target and source objects. - * @param pe Target PE. - */ -public void iGetDouble(double[] target, int tst, int sst, int len, int pe) -{ - iGetDoubleArray(addr(), target, 0, tst, sst, len, pe); -} - -private native void iGetDoubleArray( - long addr, double[] target, int off, int tst, int sst, int len, int pe); - -/** - * Performs an atomic swap operation. - *

Java binding of {@code shmem_int_swap}. - * @param value Value to be transferred. - * @param pe Target PE. - * @return Previous value of target. - */ -public int swapInt(int value, int pe) -{ - return swapInt(addr(), value, pe); -} - -private native int swapInt(long addr, int value, int pe); - -/** - * Performs an atomic swap operation. - *

Java binding of {@code shmem_long_swap}. - * @param value Value to be transferred. - * @param pe Target PE. - * @return Previous value of target. - */ -public long swapLong(long value, int pe) -{ - return swapLong(addr(), value, pe); -} - -private native long swapLong(long addr, long value, int pe); - -/** - * Performs an atomic swap operation. - *

Java binding of {@code shmem_float_swap}. - * @param value Value to be transferred. - * @param pe Target PE. - * @return Previous value of target. - */ -public float swapFloat(float value, int pe) -{ - return swapFloat(addr(), value, pe); -} - -private native float swapFloat(long addr, float value, int pe); - -/** - * Performs an atomic swap operation. - *

Java binding of {@code shmem_double_swap}. - * @param value Value to be transferred. - * @param pe Target PE. - * @return Previous value of target. - */ -public double swapDouble(double value, int pe) -{ - return swapDouble(addr(), value, pe); -} - -private native double swapDouble(long addr, double value, int pe); - -/** - * Performs an atomic conditional swap operation. - *

Java binding of {@code shmem_int_cswap}. - * @param cond Value compared to the target value. - * @param value Value to be written to the target PE. - * @param pe Target PE. - * @return Previous value of target. - */ -public int cSwapInt(int cond, int value, int pe) -{ - return cSwapInt(addr(), cond, value, pe); -} - -private native int cSwapInt(long addr, int cond, int value, int pe); - -/** - * Performs an atomic conditional swap operation. - *

Java binding of {@code shmem_long_cswap}. - * @param cond Value compared to the target value. - * @param value Value to be written to the target PE. - * @param pe Target PE. - * @return Previous value of target. - */ -public long cSwapLong(long cond, long value, int pe) -{ - return cSwapLong(addr(), cond, value, pe); -} - -private native long cSwapLong(long addr, long cond, long value, int pe); - -/** - * Performs an atomic fetch-and-add operation. - *

Java binding of {@code shmem_int_fadd}. - * @param value Value to be added. - * @param pe Target PE. - * @return Previous value of target. - */ -public int fAddInt(int value, int pe) -{ - return fAddInt(addr(), value, pe); -} - -private native int fAddInt(long addr, int value, int pe); - -/** - * Performs an atomic fetch-and-add operation. - *

Java binding of {@code shmem_long_fadd}. - * @param value Value to be added. - * @param pe Target PE. - * @return Previous value of target. - */ -public long fAddLong(long value, int pe) -{ - return fAddLong(addr(), value, pe); -} - -private native long fAddLong(long addr, long value, int pe); - -/** - * Performs an atomic fetch-and-increment operation. - *

Java binding of {@code shmem_int_finc}. - * @param pe Target PE. - * @return Previous value of target. - */ -public int fIncInt(int pe) -{ - return fIncInt(addr(), pe); -} - -private native int fIncInt(long addr, int pe); - -/** - * Performs an atomic fetch-and-increment operation. - *

Java binding of {@code shmem_long_finc}. - * @param pe Target PE. - * @return Previous value of target. - */ -public long fIncLong(int pe) -{ - return fIncLong(addr(), pe); -} - -private native long fIncLong(long addr, int pe); - -/** - * Performs an atomic add operation. - *

Java binding of {@code shmem_int_add}. - * @param value Value to be added. - * @param pe Target PE. - */ -public void addInt(int value, int pe) -{ - addInt(addr(), value, pe); -} - -private native void addInt(long addr, int value, int pe); - -/** - * Performs an atomic add operation. - *

Java binding of {@code shmem_long_add}. - * @param value Value to be added. - * @param pe Target PE. - */ -public void addLong(long value, int pe) -{ - addLong(addr(), value, pe); -} - -private native void addLong(long addr, long value, int pe); - -/** - * Performs an atomic increment operation. - *

Java binding of {@code shmem_int_inc}. - * @param pe Target PE. - */ -public void incInt(int pe) -{ - incInt(addr(), pe); -} - -private native void incInt(long addr, int pe); - -/** - * Performs an atomic increment operation. - *

Java binding of {@code shmem_long_inc}. - * @param pe Target PE. - */ -public void incLong(int pe) -{ - incLong(addr(), pe); -} - -private native void incLong(long addr, int pe); - -/** - * Sets a mutual exclusion memory lock. - *

Java binding of {@code shmem_set_lock}. - * The {@code long} value at address lock must be set to 0 on all PEs - * prior to the first use. - */ -public void setLock() -{ - setLock(handle); -} - -private native void setLock(long addr); - -/** - * Releases a lock previously set by the calling PE. - *

Java binding of {@code shmem_clear_lock}. - */ -public void clearLock() -{ - clearLock(handle); -} - -private native void clearLock(long addr); - -/** - * Sets a mutual exclusion lock only if it is currently cleared. - *

Java binding of {@code shmem_test_lock}. - * @return True if the lock had been set and the call returned without - * waiting to set the lock. False if the lock was originally - * cleared and this call was able to set the lock. - */ -public boolean testLock() -{ - return testLock(handle); -} - -private native boolean testLock(long addr); - -/** - * Forces the calling PE to wait until the value at {@code offset} - * is no longer equal to {@code value}. - *

Java binding of {@code shmem_short_wait}. - * @param value Value to be compared against the value at {@code offset}. - */ -public void waitShort(short value) -{ - waitShort(addr(), value); -} - -private native void waitShort(long addr, short value); - -/** - * Forces the calling PE to wait until the value at {@code offset} - * is no longer equal to {@code value}. - *

Java binding of {@code shmem_int_wait}. - * @param value Value to be compared against the value at {@code offset}. - */ -public void waitInt(int value) -{ - waitInt(addr(), value); -} - -private native void waitInt(long addr, int value); - -/** - * Forces the calling PE to wait until the value at {@code offset} - * is no longer equal to {@code value}. - *

Java binding of {@code shmem_long_wait}. - * @param value Value to be compared against the value at {@code offset}. - */ -public void waitLong(long value) -{ - waitLong(addr(), value); -} - -private native void waitLong(long addr, long value); - -/** - * Forces the calling PE to wait until the condition {@code cond} - * and {@code value} is satisfied. - *

Java binding of {@code shmem_short_wait_until}. - * @param cond Indicates how to compare the value at - * {@code offset} and {@code value}. - * @param value Value to compare. - */ -public void waitUntilShort(int cond, short value) -{ - waitUntilShort(addr(), cond, value); -} - -private native void waitUntilShort(long addr, int cmp, short value); - -/** - * Forces the calling PE to wait until the condition {@code cond} - * and {@code value} is satisfied. - *

Java binding of {@code shmem_int_wait_until}. - * @param cond Indicates how to compare the value at - * {@code offset} and {@code value}. - * @param value Value to compare. - */ -public void waitUntilInt(int cond, int value) -{ - waitUntilInt(addr(), cond, value); -} - -private native void waitUntilInt(long addr, int cmp, int value); - -/** - * Forces the calling PE to wait until the condition {@code cond} - * and {@code value} is satisfied. - *

Java binding of {@code shmem_long_wait_until}. - * @param cond Indicates how to compare the value at - * {@code offset} and {@code value}. - * @param value Value to compare. - */ -public void waitUntilLong(int cond, long value) -{ - waitUntilLong(addr(), cond, value); -} - -private native void waitUntilLong(long addr, int cmp, long value); - -/** - * Copy a data from a root PE to a target location on all other - * PEs of the active set. - *

Java binding of {@code shmem_broadcast32}. - * @param source Symmetric data to be copied. - * @param nlong Number of elements in the target and source objects. - * @param PE_root PE from which data will be copied. - * @param PE_start The lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric work array. - */ -public void broadcast32(Addr source, int nlong, int PE_root, int PE_start, - int logPE_stride, int PE_size, PSync pSync) -{ - broadcast32(addr(), source.addr(), nlong, PE_root, - PE_start, logPE_stride, PE_size, pSync.addr()); -} - -private native void broadcast32( - long target, long source, int nlong, int PE_root, - int PE_start, int logPE_stride, int PE_size, long pSync); - -/** - * Copy a data from a root PE to a target location on all other - * PEs of the active set. - *

Java binding of {@code shmem_broadcast64}. - * @param source Symmetric data to be copied. - * @param nlong Number of elements in the target and source objects. - * @param PE_root PE from which data will be copied. - * @param PE_start The lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric work array. - */ -public void broadcast64(Addr source, int nlong, int PE_root, int PE_start, - int logPE_stride, int PE_size, PSync pSync) -{ - broadcast64(addr(), source.addr(), nlong, PE_root, - PE_start, logPE_stride, PE_size, pSync.addr()); -} - -private native void broadcast64( - long target, long source, int nlong, int PE_root, - int PE_start, int logPE_stride, int PE_size, long pSync); - -/** - * Concatenates blocks of data from multiple PEs to an object in every PE. - *

Java binding of {@code shmem_collect32}. - * @param source Data to be concatenated. - * @param nlong Number of elements in the source objects. - * @param PE_start The lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric work array. - */ -public void collect32(Addr source, int nlong, int PE_start, - int logPE_stride, int PE_size, PSync pSync) -{ - collect32(addr(), source.addr(), nlong, PE_start, - logPE_stride, PE_size, pSync.addr()); -} - -private native void collect32( - long target, long source, int nlong, int PE_start, - int logPE_stride, int PE_size, long pSync); - -/** - * Concatenates blocks of data from multiple PEs to an object in every PE. - *

Java binding of {@code shmem_collect64}. - * @param source Symmetric data to be copied. - * @param nlong Number of elements in the source objects. - * @param PE_start The lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric work array. - */ -public void collect64(Addr source, int nlong, int PE_start, - int logPE_stride, int PE_size, PSync pSync) -{ - collect64(addr(), source.addr(), nlong, PE_start, - logPE_stride, PE_size, pSync.addr()); -} - -private native void collect64( - long target, long source, int nlong, int PE_start, - int logPE_stride, int PE_size, long pSync); - -/** - * Concatenates blocks of data from multiple PEs to an object in every PE. - *

Java binding of {@code shmem_fcollect32}. - * @param source Symmetric data to be copied. - * @param nlong Number of elements in the source objects. - * @param PE_start The lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric work array. - */ -public void fcollect32(Addr source, int nlong, int PE_start, - int logPE_stride, int PE_size, PSync pSync) -{ - fcollect32(addr(), source.addr(), nlong, PE_start, - logPE_stride, PE_size, pSync.addr()); -} - -private native void fcollect32( - long target, long source, int nlong, int PE_start, - int logPE_stride, int PE_size, long pSync); - -/** - * Concatenates blocks of data from multiple PEs to an object in every PE. - *

Java binding of {@code shmem_fcollect64}. - * @param source Symmetric data to be copied. - * @param nlong Number of elements in the source objects. - * @param PE_start The lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric work array. - */ -public void fcollect64(Addr source, int nlong, int PE_start, - int logPE_stride, int PE_size, PSync pSync) -{ - fcollect64(addr(), source.addr(), nlong, PE_start, - logPE_stride, PE_size, pSync.addr()); -} - -private native void fcollect64( - long target, long source, int nlong, int PE_start, - int logPE_stride, int PE_size, long pSync); - -/** - * Performs a bitwise AND operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_short_and_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void andToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - andToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void andToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise AND operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_int_and_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void andToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - andToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void andToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise AND operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_long_and_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void andToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - andToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void andToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise OR operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_short_or_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void orToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - orToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void orToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise OR operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_int_or_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void orToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - orToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void orToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise OR operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_long_or_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void orToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - orToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void orToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise XOR operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_short_xor_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void xorToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - xorToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void xorToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise XOR operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_int_xor_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void xorToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - xorToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void xorToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Performs a bitwise XOR operation on symmetric data over the active set of PEs. - *

Java binding of {@code shmem_long_xor_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void xorToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - xorToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void xorToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the maximum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_short_max_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void maxToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - maxToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void maxToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the maximum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_int_max_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void maxToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - maxToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void maxToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the maximum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_long_max_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void maxToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - maxToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void maxToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the maximum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_float_max_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code float} work array. - * @param pSync Symmetric work array. - */ -public void maxToAllFloat(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - maxToAllFloat(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void maxToAllFloat( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the maximum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_double_max_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code double} work array. - * @param pSync Symmetric work array. - */ -public void maxToAllDouble(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, - Addr pWrk, PSync pSync) -{ - maxToAllDouble(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void maxToAllDouble( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the minimum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_short_min_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void minToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - minToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void minToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the minimum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_int_min_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void minToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - minToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void minToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the minimum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_long_min_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void minToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - minToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void minToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the minimum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_float_min_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code float} work array. - * @param pSync Symmetric work array. - */ -public void minToAllFloat(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - minToAllFloat(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void minToAllFloat( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the minimum value of the source data over the active set of PEs. - *

Java binding of {@code shmem_double_min_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code double} work array. - * @param pSync Symmetric work array. - */ -public void minToAllDouble(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, - Addr pWrk, PSync pSync) -{ - minToAllDouble(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void minToAllDouble( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the summation of symmetric data over the active set of PEs. - *

Java binding of {@code shmem_short_sum_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void sumToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - sumToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void sumToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the summation of symmetric data over the active set of PEs. - *

Java binding of {@code shmem_int_sum_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void sumToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - sumToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void sumToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the summation of symmetric data over the active set of PEs. - *

Java binding of {@code shmem_long_sum_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void sumToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - sumToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void sumToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the summation of symmetric data over the active set of PEs. - *

Java binding of {@code shmem_float_sum_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code float} work array. - * @param pSync Symmetric work array. - */ -public void sumToAllFloat(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - sumToAllFloat(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void sumToAllFloat( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the summation of symmetric data over the active set of PEs. - *

Java binding of {@code shmem_double_sum_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code double} work array. - * @param pSync Symmetric work array. - */ -public void sumToAllDouble(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, - Addr pWrk, PSync pSync) -{ - sumToAllDouble(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void sumToAllDouble( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the product of symmetric arrays over the active set of PEs. - *

Java binding of {@code shmem_short_prod_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code short} work array. - * @param pSync Symmetric work array. - */ -public void prodToAllShort(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, - Addr pWrk, PSync pSync) -{ - prodToAllShort(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void prodToAllShort( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the product of symmetric arrays over the active set of PEs. - *

Java binding of {@code shmem_int_prod_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code int} work array. - * @param pSync Symmetric work array. - */ -public void prodToAllInt(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - prodToAllInt(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void prodToAllInt( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the product of symmetric arrays over the active set of PEs. - *

Java binding of {@code shmem_long_prod_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code long} work array. - * @param pSync Symmetric work array. - */ -public void prodToAllLong(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, Addr pWrk, PSync pSync) -{ - prodToAllLong(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void prodToAllLong( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the product of symmetric arrays over the active set of PEs. - *

Java binding of {@code shmem_float_prod_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code float} work array. - * @param pSync Symmetric work array. - */ -public void prodToAllFloat(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, - Addr pWrk, PSync pSync) -{ - prodToAllFloat(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void prodToAllFloat( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -/** - * Computes the product of symmetric arrays over the active set of PEs. - *

Java binding of {@code shmem_double_prod_to_all}. - * @param source Symmetric data object that contains the elements for each - * separate reduction operation. - * @param nreduce Number of elements in the target (this) and source data. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between PE numbers. - * @param PE_size Number of PEs in the active set. - * @param pWrk Symmetric {@code double} work array. - * @param pSync Symmetric work array. - */ -public void prodToAllDouble(Addr source, int nreduce, int PE_start, - int logPE_stride, int PE_size, - Addr pWrk, PSync pSync) -{ - prodToAllDouble(addr(), source.addr(), nreduce, PE_start, - logPE_stride, PE_size, pWrk.addr(), pSync.addr()); -} - -private native void prodToAllDouble( - long target, long source, int nreduce, int PE_start, - int logPE_stride, int PE_size, long pWrk, long pSync); - -protected long addr() -{ - return handle + offset; -} - -} // Addr diff --git a/oshmem/shmem/java/java/Constant.java b/oshmem/shmem/java/java/Constant.java deleted file mode 100644 index 1333918f84..0000000000 --- a/oshmem/shmem/java/java/Constant.java +++ /dev/null @@ -1,21 +0,0 @@ -package shmem; - -class Constant -{ - protected int CMP_EQ, CMP_GE, CMP_GT, CMP_LE, CMP_LT, CMP_NE; - - protected int BARRIER_SYNC_SIZE, - BCAST_SYNC_SIZE, - COLLECT_SYNC_SIZE, - REDUCE_SYNC_SIZE, - REDUCE_MIN_WRKDATA_SIZE, - SYNC_VALUE; - - protected Constant() - { - setConstant(); - } - - private native void setConstant(); - -} // Constant diff --git a/oshmem/shmem/java/java/Makefile.am b/oshmem/shmem/java/java/Makefile.am deleted file mode 100644 index f3b981d1f2..0000000000 --- a/oshmem/shmem/java/java/Makefile.am +++ /dev/null @@ -1,152 +0,0 @@ -# -# We generate three general things in this directory: -# -# 1. *.java files get compiled into shmem/*.class files. -# 2. The shmem/*.class files are then assembled into an shmem.jar file. -# 3. The shmem/*.class files are analyzed to make *.h JNI files. -# - -# These are the Java source files. However, Automake doesn't directly -# know about them, and we compile them via *.java below (ick!). So we -# just list them here in EXTRA_DIST so that they get picked up by -# "make dist". -JAVA_SRC_FILES = \ - Addr.java \ - Constant.java \ - PSync.java \ - ShMem.java \ - ShMemException.java - -EXTRA_DIST = $(JAVA_SRC_FILES) - -# Only do this stuff if we want the Java bindings -if OMPI_WANT_JAVA_BINDINGS - -# These files get generated. They have a 1:1 correspondence to .java -# files, but there is not a .h file for every .java file. That's why -# we have a specific list of files here, as opposed to deriving them -# from JAVA_SRC_FILES. -JAVA_H = \ - shmem_Addr.h \ - shmem_Constant.h \ - shmem_PSync.h \ - shmem_ShMem.h - -# A little verbosity magic; "make" will show the terse output. "make -# V=1" will show the actual commands used (just like the other -# Automake-generated compilation/linker rules). -V=0 -OMPI_V_JAVAC = $(ompi__v_JAVAC_$V) -ompi__v_JAVAC_ = $(ompi__v_JAVAC_$AM_DEFAULT_VERBOSITY) -ompi__v_JAVAC_0 = @echo " JAVAC " `basename $@`; - -OMPI_V_JAVAH = $(ompi__v_JAVAH_$V) -ompi__v_JAVAH_ = $(ompi__v_JAVAH_$AM_DEFAULT_VERBOSITY) -ompi__v_JAVAH_0 = @echo " JAVAH " `basename $@`; - -OMPI_V_JAR = $(ompi__v_JAR_$V) -ompi__v_JAR_ = $(ompi__v_JAR_$AM_DEFAULT_VERBOSITY) -ompi__v_JAR_0 = @echo " JAR " `basename $@`; - -OMPI_V_JAVADOC = $(ompi__v_JAVADOC_$V) -ompi__v_JAVADOC_ = $(ompi__v_JAVADOC_$AM_DEFAULT_VERBOSITY) -ompi__v_JAVADOC_0 = @echo "JAVADOC " `basename $@`; - -OMPI_V_JAVADOC_QUIET = $(ompi__v_JAVADOC_QUIET_$V) -ompi__v_JAVADOC_QUIET_ = $(ompi__v_JAVADOC_QUIET_$AM_DEFAULT_VERBOSITY) -ompi__v_JAVADOC_QUIET_0 = -quiet - -OMPI_V_MKDIR = $(ompi__v_MKDIR_$V) -ompi__v_MKDIR_ = $(ompi__v_MKDIR_$AM_DEFAULT_VERBOSITY) -ompi__v_MKDIR_0 = @echo " MKDIR " $@; - -# All the .java files seem to have circular references, such that I -# can't figure out a linear order in which to compile them -# sequentially that does not generate dependency errors. Hence, the -# only way I can figure out how to compile them is via *.java -- this -# could well be due to my own misunderstanding of Java or the -# compiler. Shrug. -# -# So instead of listing all the .class files, since the rule below -# will generate *all* the .class files simulanteously, just use -# shmem/ShMem.class as a token class file for both the rule and all the -# dependencies below. -# -# Note too, that all of them will be recompiled if any of them change, -# since Automake doesn't know how to automatically generate -# dependencies for Java source files. So I made the token ShMem.class -# file dependent upon *all* the .java source files. -# -# Note that the javac compile will generate all the .class files in -# the "shmem" subdirectory, because that's the java package that they're -# in. This, along with the fact that the .java files seem to have -# circular references, prevents us from using a .foo.bar: generic -# Makefile rule. :-( -shmem/ShMem.class: $(JAVA_SRC_FILES) - $(OMPI_V_JAVAC) CLASSPATH=. ; \ - export CLASSPATH ; \ - $(JAVAC) -d . $(OSHMEM_TOP_SRCDIR)/oshmem/shmem/java/java/*.java - -# Similar to above, all the generated .h files are dependent upon the -# token shmem/ShMem.class file. Hence, all the classes will be generated -# first, then we'll individually generate each of the .h files. -$(JAVA_H): shmem/ShMem.class - $(OMPI_V_JAVAH) sourcename=shmem.`echo $@ | sed -e s/^shmem_// -e s/.h$$//`; \ - CLASSPATH=. ; \ - export CLASSPATH ; \ - $(JAVAH) -d . -jni $$sourcename - -# Generate the .jar file from all the class files. List shmem/ShMem.class -# as a dependency so that it fires the rule above that will generate -# *all* the shmem/*.class files. -shmem.jar: shmem/ShMem.class - $(OMPI_V_JAR) $(JAR) cf shmem.jar shmem/*.class - -# Install the jar file into libdir. Use the DATA Automake primary, -# because Automake will complain if you try to use LIBRARIES with a -# filename that doesn't fit the lib.* format. Also use an -# indirection to get to the libdir -- Automake does not allow putting -# libdir for the DATA primary. -javadir = $(libdir) -java_DATA = shmem.jar - -# List all the header files in BUILT_SOURCES so that Automake's "all" -# target will build them. This will also force the building of the -# shmem/*.class files (for the jar file). -BUILT_SOURCES = $(JAVA_H) doc - -# Convenience for building Javadoc docs -jdoc: doc - -# Make the "doc" target (and subdir) dependent upon shmem/ShMem.class; if -# shmem.jar is ever rebuilt, then also make the docs eligible to be -# rebuilt. -doc: shmem/ShMem.class - $(OMPI_V_JAVADOC) javadoc $(OMPI_V_JAVADOC_QUIET) -d doc $(srcdir)/*.java - @touch doc - -jdoc-install: doc - -$(MKDIR_P) $(DESTDIR)$(docdir)/javadoc-oshmem - cp -rp doc/* $(DESTDIR)$(docdir)/javadoc-oshmem - -jdoc-uninstall: - -rm -rf $(DESTDIR)$(docdir)/../oshmem/javadoc - -install-data-hook: jdoc-install -uninstall-local: jdoc-uninstall - -# Clean up all the things that this Makefile.am generates. -CLEANFILES += $(JAVA_H) shmem.jar - -# Can only put *files* in CLEANFILES; need to remove the generated doc -# and shmem directories separately. -clean-local: - -rm -rf doc shmem - -# Conditionally install the header files -if WANT_INSTALL_HEADERS -oshmemdir = $(oshmemincludedir)/$(subdir) -oshmem_HEADERS = $(headers) -endif - -endif diff --git a/oshmem/shmem/java/java/PSync.java b/oshmem/shmem/java/java/PSync.java deleted file mode 100644 index 36258ec5b7..0000000000 --- a/oshmem/shmem/java/java/PSync.java +++ /dev/null @@ -1,40 +0,0 @@ -package shmem; - -/** - * Symmetric work array. - */ -public final class PSync -{ -private long handle; - -/** - * Allocates a symmetric work array. - * @param size Number of elements in the work array. - * @throws ShMemException Allocation error. - */ -public PSync(int size) throws ShMemException -{ - handle = newPSync(size); - - if(handle == 0) - throw new ShMemException("Allocation error."); -} - -private native long newPSync(int size); - -/** - * Frees a work array. - */ -public void free() -{ - free(handle); -} - -private native void free(long handle); - -protected long addr() -{ - return handle; -} - -} // PSync diff --git a/oshmem/shmem/java/java/ShMem.java b/oshmem/shmem/java/java/ShMem.java deleted file mode 100644 index 1b371d2709..0000000000 --- a/oshmem/shmem/java/java/ShMem.java +++ /dev/null @@ -1,496 +0,0 @@ -package shmem; - -import java.nio.*; - -/** - * Java bindings of OpenSHMEM. - */ -public final class ShMem -{ -private static final ByteOrder nativeOrder = ByteOrder.nativeOrder(); - -public static final int CMP_EQ, CMP_GE, CMP_GT, CMP_LE, CMP_LT, CMP_NE; - -public static final int BARRIER_SYNC_SIZE, - BCAST_SYNC_SIZE, - COLLECT_SYNC_SIZE, - REDUCE_SYNC_SIZE, - REDUCE_MIN_WRKDATA_SIZE, - SYNC_VALUE; -static -{ - System.loadLibrary("oshmem_java"); - init(); - Constant c = new Constant(); - - CMP_EQ = c.CMP_EQ; - CMP_GE = c.CMP_GE; - CMP_GT = c.CMP_GT; - CMP_LE = c.CMP_LE; - CMP_LT = c.CMP_LT; - CMP_NE = c.CMP_NE; - - BARRIER_SYNC_SIZE = c.BARRIER_SYNC_SIZE; - BCAST_SYNC_SIZE = c.BCAST_SYNC_SIZE; - COLLECT_SYNC_SIZE = c.COLLECT_SYNC_SIZE; - REDUCE_SYNC_SIZE = c.REDUCE_SYNC_SIZE; - REDUCE_MIN_WRKDATA_SIZE = c.REDUCE_MIN_WRKDATA_SIZE; - SYNC_VALUE = c.SYNC_VALUE; -} - -private static native void init(); - -/** - * Initializes OpenSHMEM. - *

Java binding of {@code start_pes}. - * @param npes Unused. Should be set to 0. - */ -public static native void startPEs(int npes); - -/** - * Returns the number of processing elements (PEs) used to run the application. - *

Java binding of {@code num_pes}. - * @return Number of processing elements (PEs) used to run the application. - */ -public static native int getNumPEs(); - -/** - * Returns the PE number of the calling PE. - *

Java binding of {@code shmem_my_pe}. - * @return PE number of the calling PE. - */ -public static native int getMyPE(); - -/** - * Determines if a target PE is reachable from the calling PE. - *

Java binding of {@code shmem_pe_accessible}. - * @param pe PE number of the target PE. - * @return true if the target PE is reachable, false otherwise. - */ -public static boolean isPEAccessible(int pe) -{ - return isPEAccessible_jni(pe); -} - -private static native boolean isPEAccessible_jni(int pe); - -/** - * Performs a barrier operation on a subset of PEs. - *

Java binding of {@code shmem_barrier}. - * @param PE_start Lowest PE number of the active set of PEs. - * @param logPE_stride Log (base 2) of the stride between consecutive - * PE numbers in the active set. - * @param PE_size Number of PEs in the active set. - * @param pSync Symmetric {@code long} work array. - */ -public static void barrier( - int PE_start, int logPE_stride, int PE_size, Addr pSync) -{ - barrier(PE_start, logPE_stride, PE_size, pSync.addr()); -} - -private static native void barrier( - int PE_start, int logPE_stride, int PE_size, long pSync); - -/** - * Suspends the execution of the calling PE until all other - * PEs issue a call to this statement. - *

Java binding of {@code shmem_barrier_all}. - */ -public static native void barrierAll(); - -/** - * Provides a separate ordering on the sequence of puts issued - * by this PE to each destination PE. - *

Java binding of {@code shmem_fence}. - */ -public static native void fence(); - -/** - * Provides an ordering on the sequence of puts issued by this - * PE across all destination PEs. - *

Java binding of {@code shmem_quiet}. - */ -public static native void quiet(); - -/** - * Allocates a new direct byte buffer. - * @param capacity The new buffer's capacity, in bytes - * @return The new byte buffer - */ -public static ByteBuffer newByteBuffer(int capacity) -{ - ByteBuffer buf = ByteBuffer.allocateDirect(capacity); - buf.order(nativeOrder); - return buf; -} - -/** - * Allocates a new direct short buffer. - * @param capacity The new buffer's capacity, in shorts - * @return The new short buffer - */ -public static ShortBuffer newShortBuffer(int capacity) -{ - assert capacity <= Integer.MAX_VALUE / 2; - ByteBuffer buf = ByteBuffer.allocateDirect(capacity * 2); - buf.order(nativeOrder); - return buf.asShortBuffer(); -} - -/** - * Allocates a new direct int buffer. - * @param capacity The new buffer's capacity, in ints - * @return The new int buffer - */ -public static IntBuffer newIntBuffer(int capacity) -{ - assert capacity <= Integer.MAX_VALUE / 4; - ByteBuffer buf = ByteBuffer.allocateDirect(capacity * 4); - buf.order(nativeOrder); - return buf.asIntBuffer(); -} - -/** - * Allocates a new direct long buffer. - * @param capacity The new buffer's capacity, in longs - * @return The new long buffer - */ -public static LongBuffer newLongBuffer(int capacity) -{ - assert capacity <= Integer.MAX_VALUE / 8; - ByteBuffer buf = ByteBuffer.allocateDirect(capacity * 8); - buf.order(nativeOrder); - return buf.asLongBuffer(); -} - -/** - * Allocates a new direct float buffer. - * @param capacity The new buffer's capacity, in floats - * @return The new float buffer - */ -public static FloatBuffer newFloatBuffer(int capacity) -{ - assert capacity <= Integer.MAX_VALUE / 4; - ByteBuffer buf = ByteBuffer.allocateDirect(capacity * 4); - buf.order(nativeOrder); - return buf.asFloatBuffer(); -} - -/** - * Allocates a new direct double buffer. - * @param capacity The new buffer's capacity, in doubles - * @return The new double buffer - */ -public static DoubleBuffer newDoubleBuffer(int capacity) -{ - assert capacity <= Integer.MAX_VALUE / 8; - ByteBuffer buf = ByteBuffer.allocateDirect(capacity * 8); - buf.order(nativeOrder); - return buf.asDoubleBuffer(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static ByteBuffer slice(ByteBuffer buf, int offset) -{ - return ((ByteBuffer)buf.clear().position(offset)) - .slice().order(nativeOrder); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static ByteBuffer slice(ByteBuffer buf, int offset, int length) -{ - return ((ByteBuffer)buf.limit(offset + length) - .position(offset)).slice().order(nativeOrder); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static ShortBuffer slice(ShortBuffer buf, int offset) -{ - return ((ShortBuffer)buf.clear().position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static ShortBuffer slice(ShortBuffer buf, int offset, int length) -{ - return ((ShortBuffer)buf.limit(offset + length).position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static IntBuffer slice(IntBuffer buf, int offset) -{ - return ((IntBuffer)buf.clear().position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static IntBuffer slice(IntBuffer buf, int offset, int length) -{ - return ((IntBuffer)buf.limit(offset + length).position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static LongBuffer slice(LongBuffer buf, int offset) -{ - return ((LongBuffer)buf.clear().position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static LongBuffer slice(LongBuffer buf, int offset, int length) -{ - return ((LongBuffer)buf.limit(offset + length).position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static FloatBuffer slice(FloatBuffer buf, int offset) -{ - return ((FloatBuffer)buf.clear().position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static FloatBuffer slice(FloatBuffer buf, int offset, int length) -{ - return ((FloatBuffer)buf.limit(offset + length).position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static DoubleBuffer slice(DoubleBuffer buf, int offset) -{ - return ((DoubleBuffer)buf.clear().position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static DoubleBuffer slice(DoubleBuffer buf, int offset, int length) -{ - return ((DoubleBuffer)buf.limit(offset + length).position(offset)).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static ByteBuffer slice(byte[] buf, int offset) -{ - return ByteBuffer.wrap(buf, offset, buf.length - offset) - .slice().order(nativeOrder); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static ByteBuffer slice(byte[] buf, int offset, int length) -{ - return ByteBuffer.wrap(buf, offset, length).slice().order(nativeOrder); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static ShortBuffer slice(short[] buf, int offset) -{ - return ShortBuffer.wrap(buf, offset, buf.length - offset).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static ShortBuffer slice(short[] buf, int offset, int length) -{ - return ShortBuffer.wrap(buf, offset, length).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static IntBuffer slice(int[] buf, int offset) -{ - return IntBuffer.wrap(buf, offset, buf.length - offset).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static IntBuffer slice(int[] buf, int offset, int length) -{ - return IntBuffer.wrap(buf, offset, length).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static LongBuffer slice(long[] buf, int offset) -{ - return LongBuffer.wrap(buf, offset, buf.length - offset).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static LongBuffer slice(long[] buf, int offset, int length) -{ - return LongBuffer.wrap(buf, offset, length).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static FloatBuffer slice(float[] buf, int offset) -{ - return FloatBuffer.wrap(buf, offset, buf.length - offset).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static FloatBuffer slice(float[] buf, int offset, int length) -{ - return FloatBuffer.wrap(buf, offset, length).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @return the new buffer. - */ -public static DoubleBuffer slice(double[] buf, int offset) -{ - return DoubleBuffer.wrap(buf, offset, buf.length - offset).slice(); -} - -/** - * Creates a new buffer whose content is a shared subsequence of a buffer. - *

The content of the new buffer will start at the specified offset. - * @param buf buffer - * @param offset offset - * @param length length - * @return the new buffer. - */ -public static DoubleBuffer slice(double[] buf, int offset, int length) -{ - return DoubleBuffer.wrap(buf, offset, length).slice(); -} - -} // ShMem diff --git a/oshmem/shmem/java/java/ShMemException.java b/oshmem/shmem/java/java/ShMemException.java deleted file mode 100644 index a7516ef473..0000000000 --- a/oshmem/shmem/java/java/ShMemException.java +++ /dev/null @@ -1,17 +0,0 @@ -package shmem; - -/** - * Signals that an SHMEM exception of some sort has occurred. - */ -public final class ShMemException extends Exception -{ -/** - * Creates an exception. - * @param message message associated to the exception - */ -public ShMemException(String message) -{ - super(message); -} - -} // ShMemException diff --git a/oshmem/tools/wrappers/Makefile.am b/oshmem/tools/wrappers/Makefile.am index 80868d22f2..9f1ddcef36 100644 --- a/oshmem/tools/wrappers/Makefile.am +++ b/oshmem/tools/wrappers/Makefile.am @@ -30,10 +30,6 @@ install-exec-hook: (cd $(DESTDIR)$(bindir); rm -f oshcc$(EXEEXT); $(LN_S) mpicc$(EXEEXT) oshcc$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f shmemfort$(EXEEXT); $(LN_S) mpifort$(EXEEXT) shmemfort$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f oshfort$(EXEEXT); $(LN_S) mpifort$(EXEEXT) oshfort$(EXEEXT)) -if OSHMEM_WANT_JAVA_BINDINGS - (cd $(DESTDIR)$(bindir); rm -f shmemjavac$(EXEEXT); $(LN_S) mpijavac$(EXEEXT) shmemjavac$(EXEEXT)) - (cd $(DESTDIR)$(bindir); rm -f oshjavac$(EXEEXT); $(LN_S) mpijavac$(EXEEXT) oshjavac$(EXEEXT)) -endif install-data-hook: (cd $(DESTDIR)$(pkgdatadir); rm -f oshcc-wrapper-data.txt; $(LN_S) shmemcc-wrapper-data.txt oshcc-wrapper-data.txt) @@ -46,14 +42,10 @@ uninstall-local: $(DESTDIR)$(bindir)/oshcc$(EXEEXT) \ $(DESTDIR)$(bindir)/shmemfort$(EXEEXT) \ $(DESTDIR)$(bindir)/oshfort$(EXEEXT) \ - $(DESTDIR)$(bindir)/shmemjavac$(EXEEXT) \ - $(DESTDIR)$(bindir)/oshjavac$(EXEEXT) \ $(DESTDIR)$(pkgdatadir)/shmemcc-wrapper-data.txt \ $(DESTDIR)$(pkgdatadir)/oshcc-wrapper-data.txt \ $(DESTDIR)$(pkgdatadir)/shmemfort-wrapper-data.txt \ - $(DESTDIR)$(pkgdatadir)/oshfort-wrapper-data.txt \ - $(DESTDIR)$(bindir)/oshjavac \ - $(DESTDIR)$(bindir)/shmemjavac + $(DESTDIR)$(pkgdatadir)/oshfort-wrapper-data.txt ########################################################