From aefdbc17d6cf76bdbcebc18be48f79ff5d29222a Mon Sep 17 00:00:00 2001 From: raver119 Date: Sat, 3 Aug 2019 13:23:12 +0300 Subject: [PATCH] exclude two methods for JNI Signed-off-by: raver119 --- libnd4j/blas/NDArray.h | 3 +++ libnd4j/blas/cpu/NDArray.cpp | 5 +++++ libnd4j/blas/cuda/NDArray.cu | 4 ++++ .../main/java/org/nd4j/nativeblas/Nd4jCuda.java | 16 +++++++++++----- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/libnd4j/blas/NDArray.h b/libnd4j/blas/NDArray.h index 1f2c2c346..2549c5517 100644 --- a/libnd4j/blas/NDArray.h +++ b/libnd4j/blas/NDArray.h @@ -261,6 +261,7 @@ namespace nd4j { void syncToDevice() const; void syncShape() const; +#ifndef __JAVACPP_HACK__ && !defined(_JNI_IMPLEMENTATION_) /** * This method can be used on architectures that use special buffers * @param writeList @@ -272,6 +273,8 @@ namespace nd4j { static void registerPrimaryUse(const std::vector& writeList, const std::vector& readList); static void preparePrimaryUse(const std::vector& writeList, const std::vector& readList, bool synchronizeWritables = false); +#endif + /** * This method returns buffer pointer offset by given number of elements, wrt own data type * @param offset diff --git a/libnd4j/blas/cpu/NDArray.cpp b/libnd4j/blas/cpu/NDArray.cpp index 72975929e..2bd2cbd5d 100644 --- a/libnd4j/blas/cpu/NDArray.cpp +++ b/libnd4j/blas/cpu/NDArray.cpp @@ -181,6 +181,8 @@ void NDArray::swapUnsafe(NDArray& other) { void NDArray::synchronize(const char* msg) const { // no-op } + +#ifndef __JAVACPP_HACK__ && !defined(_JNI_IMPLEMENTATION_) void NDArray::prepareSpecialUse(const std::vector& writeList, const std::vector& readList, bool synchronizeWritables) { // no-op } @@ -193,6 +195,9 @@ void NDArray::preparePrimaryUse(const std::vector& writeList, co void NDArray::registerPrimaryUse(const std::vector& writeList, const std::vector& readList) { // no-op } + +#endif + void NDArray::syncShape() const { // no-op } diff --git a/libnd4j/blas/cuda/NDArray.cu b/libnd4j/blas/cuda/NDArray.cu index f0ead9bf2..68b235308 100644 --- a/libnd4j/blas/cuda/NDArray.cu +++ b/libnd4j/blas/cuda/NDArray.cu @@ -230,6 +230,8 @@ void NDArray::synchronize(const char* msg) const { if (res != 0) throw std::runtime_error(msg + std::string(": synchronization failed !")); } +#ifndef __JAVACPP_HACK__ && !defined(_JNI_IMPLEMENTATION_) + //////////////////////////////////////////////////////////////////////// void NDArray::prepareSpecialUse(const std::vector& writeList, const std::vector& readList, bool synchronizeWritables) { @@ -286,6 +288,8 @@ void NDArray::registerPrimaryUse(const std::vector& writeList, c p->tickWriteHost(); } +#endif + ////////////////////////////////////////////////////////////////////////// void NDArray::syncShape() const { cudaMemcpy(getSpecialShapeInfo(), getShapeInfo(), shape::shapeInfoByteLength(getShapeInfo()), cudaMemcpyHostToDevice); diff --git a/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/nativeblas/Nd4jCuda.java b/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/nativeblas/Nd4jCuda.java index 064537990..b9fd2a4c6 100644 --- a/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/nativeblas/Nd4jCuda.java +++ b/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/nativeblas/Nd4jCuda.java @@ -3814,11 +3814,9 @@ public native @Cast("char*") String runFullBenchmarkSuit(@Cast("bool") boolean p public native void syncToDevice(); public native void syncShape(); - /** - * This method can be used on architectures that use special buffers - * @param writeList - * @param readList - */ +// #ifndef __JAVACPP_HACK__ + +// #endif /** * This method returns buffer pointer offset by given number of elements, wrt own data type @@ -4056,6 +4054,7 @@ public native @Cast("char*") String runFullBenchmarkSuit(@Cast("bool") boolean p /** * this method assigns values of given array to this one */ + public native void assign(@Const NDArray other, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(@Const NDArray other); /** @@ -4065,12 +4064,19 @@ public native @Cast("char*") String runFullBenchmarkSuit(@Cast("bool") boolean p /** * this method assigns given value to all elements in array */ + public native void assign(double value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(double value); + public native void assign(float value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(float value); + public native void assign(@Cast("const float16") short value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(@Cast("const float16") short value); + public native void assign(@Cast("const Nd4jLong") long value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(@Cast("const Nd4jLong") long value); + public native void assign(int value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(int value); + public native void assign(@Cast("const uint8_t") byte value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(@Cast("const uint8_t") byte value); + public native void assign(@Cast("const bool") boolean value, @Cast("bool") boolean allowParallelism/*=true*/); public native void assign(@Cast("const bool") boolean value); /**