Skip to content

Commit 96b44fd

Browse files
committed
Adding af::info to the java wrapper
1 parent 23250e6 commit 96b44fd

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

com/arrayfire/Array.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public class Array implements AutoCloseable {
66
System.loadLibrary("af_java");
77
}
88

9+
public native static void info();
10+
911
private native static long createArray(int[] dims);
1012
private native static long createArrayElems(int[] dims, float[] elems);
1113
private native static void destroyArray(long ref);

examples/HelloWorld.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public static void main(String[] args) {
3030
}
3131

3232
try {
33+
// Get info about arrayfire information
34+
Array.info();
35+
3336
// Send data to ArrayFire
3437
Array A = new Array(dims, left);
3538
Array B = new Array(dims, right);

src/java_wrapper.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515

1616
const int MaxDimSupported = 3;
1717

18+
JNIEXPORT void JNICALL Java_com_arrayfire_Array_info(JNIEnv *env, jclass clazz)
19+
{
20+
try{
21+
#ifndef ANDROID
22+
af::info();
23+
#endif
24+
} catch(af::exception& e) {
25+
} catch(std::exception& e) {
26+
}
27+
}
28+
1829
JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createArray(JNIEnv *env, jclass clazz, jintArray dims)
1930
{
2031
jlong ret;

src/java_wrapper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
// Simply display info
11+
JNIEXPORT void JNICALL Java_com_arrayfire_Array_info(JNIEnv *env, jclass clazz);
1012

1113
// Loader methods
1214
JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createArray(JNIEnv *env, jclass clazz, jintArray dims);

0 commit comments

Comments
 (0)