diff --git a/CHANGELOG.md b/CHANGELOG.md index 026e6081ebbe0bda18250544a150815ef2333f6d..e2d7620a79543f8a9954a935b4e448c705c69ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,9 @@ jni# Aparapi jni Changelog ## 1.3.2 * Fixed local arrays handling 1D and ND, to cope with arrays resizing across kernel executions +* Significant speed-up on discrete GPUs with dedicated memory - OpenCLDevice.setSharedMemory(false) * Fixed aparapi now supports efficient execution on discrete GPU and other devices with dedicated memory +* Support for OpenCLDevice configurator/configure API ## 1.3.1 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5e51ce3d782b9391de612ef8581af0d37d2df919..0997bd20ea7165f088861dc993dfecdb75a993ac 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -29,4 +29,5 @@ Below are some of the specific details of various contributions. & lgalluci for his fix for issue #121 (incorrect toString for 3D ranges) July 6th 2013 * Luis Mendes Issue #51 JVM crash when using multi-dimensional local arrays (refs #51) * Luis Mendes submitted local arrays handling 1D and ND, to cope with arrays resizing across kernel executions -* Luis Mendes submitted #107 aparapi now supports efficient execution on discrete GPU and other devices \ No newline at end of file +* Luis Mendes submitted #107 aparapi now supports efficient execution on discrete GPU and other devices +* Luis Mendes submitted - Support for OpenCLDevice configurator/configure API diff --git a/src/cpp/JNIHelper.cpp b/src/cpp/JNIHelper.cpp index 470282eaaa3b15dcb373d70dd24930efca695e04..b7cd47bed9c28ed75327134004427db38c93b833 100644 --- a/src/cpp/JNIHelper.cpp +++ b/src/cpp/JNIHelper.cpp @@ -55,6 +55,26 @@ #define JNI_SOURCE #include "JNIHelper.h" +void JNIHelper::callVoidWithException(JNIEnv *jenv, jobject instance, const char *methodName){ + try { + jclass theClass = jenv->GetObjectClass(instance); + if (theClass == NULL || jenv->ExceptionCheck()) + throw std::string("bummer! getting class from instance"); + + jmethodID methodId= jenv->GetMethodID(theClass,methodName,"()V"); + if (methodId == NULL || jenv->ExceptionCheck()) + throw std::string("bummer getting method '") + methodName + "', '()V' from instance"; + + jenv->CallVoidMethod(instance, methodId); + if (jenv->ExceptionCheck()) + throw std::string("bummer calling '") + methodName + "', '()V'"; + + } catch(std::string& s) { + jenv->ExceptionClear(); + throw s; + } +} + void JNIHelper::callVoid(JNIEnv *jenv, jobject instance, const char *methodName, const char *methodSignature, ...){ try { jclass theClass = jenv->GetObjectClass(instance); diff --git a/src/cpp/JNIHelper.h b/src/cpp/JNIHelper.h index 7166fb9f9e73c8e1bb850646db2b1c35eb5977ac..71c6b8e33aae471e6bf254cf816f37be1bd414f1 100644 --- a/src/cpp/JNIHelper.h +++ b/src/cpp/JNIHelper.h @@ -171,6 +171,7 @@ class JNIHelper { public: + static void callVoidWithException(JNIEnv *jenv, jobject instance, const char *methodName); static void callVoid(JNIEnv *jenv, jobject instance, const char *methodName, const char *methodSignature, ...); static jlong callLong(JNIEnv *jenv, jobject instance, const char *methodName, const char *methodSignature, ...); static jobject callObject(JNIEnv *jenv, jobject instance, const char *methodName, const char *methodSignature, ...); diff --git a/src/cpp/invoke/OpenCLJNI.cpp b/src/cpp/invoke/OpenCLJNI.cpp index 00127b215c0238fb59b9ec0dced3d8fbd1484551..f318d7b6608d767c1be6669544755c42f4741f7b 100644 --- a/src/cpp/invoke/OpenCLJNI.cpp +++ b/src/cpp/invoke/OpenCLJNI.cpp @@ -581,6 +581,12 @@ JNI_JAVA(jobject, OpenCLJNI, getPlatforms) value = (char*) malloc(valueSize); clGetDeviceInfo(deviceIds[deviceIdx], CL_DEVICE_NAME, valueSize, value, NULL); JNIHelper::callVoid(jenv, deviceInstance, "setName", ArgsVoidReturn(StringClassArg), jenv->NewStringUTF(value)); + + try { + JNIHelper::callVoidWithException(jenv, deviceInstance, "configure"); + } catch (std::string &s) { + fprintf(stderr, "Failed to call OpenClDevice.configure() - method not available in Aparapi<1.9.0\n"); + } } }