diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/Fancier.iml b/.idea/Fancier.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Fancier.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ded5f22 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..d69df26 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1641803929596 + + + + \ No newline at end of file diff --git a/README.md b/README.md old mode 100755 new mode 100644 index faaf2c1..fefaa74 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ the _Fancier_ API. The `copy_libs.sh` script copies the already-compiled `.jar` their build directories into the paths where these test applications expect them to be placed in order to be able to link and run their code. +For using the Linux test application it is necessary to have “at” installed and enabled. Moreover, the program must be executed as sudo. + ## License See [COPYING](COPYING.txt) and [COPYING.LESSER](COPYING.LESSER.txt). diff --git a/gen/.gitignore b/gen/.gitignore old mode 100755 new mode 100644 diff --git a/gen/generate.sh b/gen/generate.sh index ed3502b..3177ddb 100755 --- a/gen/generate.sh +++ b/gen/generate.sh @@ -85,7 +85,11 @@ if word_in_list "$ACTION" all java math; then fi if word_in_list "$ACTION" all opencl math; then - python "$FILL" "$OCL_TEMPLATES/math_lib.mako" "$OCL_DIR/math_lib.cl" + python "$FILL" "$OCL_TEMPLATES/fc_math.mako" "$OCL_DIR/fc_math.cl" +fi + +if word_in_list "$ACTION" all opencl image; then + python "$FILL" "$OCL_TEMPLATES/fc_image.mako" "$OCL_DIR/fc_image.cl" fi for cls in Byte Double Float Int Long Short; do diff --git a/gen/template/include/array.mako b/gen/template/include/array.mako old mode 100755 new mode 100644 index e40a5d2..cb9f77c --- a/gen/template/include/array.mako +++ b/gen/template/include/array.mako @@ -87,8 +87,8 @@ FANCIER_API fcError fc${type|c}Array_setArray(fc${type|c}Array* self, fcInt len, FANCIER_API fcError fc${type|c}Array_setCopy(fc${type|c}Array* self, const fc${type|c}Array* array); FANCIER_API fcError fc${type|c}Array_setBuffer(fc${type|c}Array* self, fcLong len, const void* v); -FANCIER_API fcError fc${type|c}Array_syncToNative(fc${type|c}Array* self); -FANCIER_API fcError fc${type|c}Array_syncToOCL(fc${type|c}Array* self); +FANCIER_API fcError fc${type|c}Array_syncToHost(fc${type|c}Array* self); +FANCIER_API fcError fc${type|c}Array_syncToDevice(fc${type|c}Array* self); FANCIER_API fcBool fc${type|c}Array_valid(const fc${type|c}Array* self); % endfor diff --git a/gen/template/include/vector.mako b/gen/template/include/vector.mako old mode 100755 new mode 100644 index 891ff1b..0152db7 --- a/gen/template/include/vector.mako +++ b/gen/template/include/vector.mako @@ -93,7 +93,6 @@ FANCIER_API void fcVector_releaseJNI(JNIEnv* env); % for type in types: % for vlen in vlens: -FANCIER_API fc${type|c}${vlen}* fc${type|c}${vlen}_getJava(JNIEnv* env, jobject obj); FANCIER_API jobject fc${type|c}${vlen}_wrap(JNIEnv* env, fc${type|c}${vlen} vec); FANCIER_API fc${type|c}${vlen} fc${type|c}${vlen}_unwrap(JNIEnv* env, jobject vec, fcError* err); diff --git a/gen/template/include/vector_array.mako b/gen/template/include/vector_array.mako old mode 100755 new mode 100644 index 1862c9c..0816579 --- a/gen/template/include/vector_array.mako +++ b/gen/template/include/vector_array.mako @@ -86,8 +86,8 @@ FANCIER_API fcError fc${type|c}${vlen}Array_setArray(fc${type|c}${vlen}Array* se FANCIER_API fcError fc${type|c}${vlen}Array_setCopy(fc${type|c}${vlen}Array* self, const fc${type|c}${vlen}Array* array); FANCIER_API fcError fc${type|c}${vlen}Array_setBuffer(fc${type|c}${vlen}Array* self, fcLong len, const void* v); -FANCIER_API fcError fc${type|c}${vlen}Array_syncToNative(fc${type|c}${vlen}Array* self); -FANCIER_API fcError fc${type|c}${vlen}Array_syncToOCL(fc${type|c}${vlen}Array* self); +FANCIER_API fcError fc${type|c}${vlen}Array_syncToHost(fc${type|c}${vlen}Array* self); +FANCIER_API fcError fc${type|c}${vlen}Array_syncToDevice(fc${type|c}${vlen}Array* self); FANCIER_API fcBool fc${type|c}${vlen}Array_valid(const fc${type|c}${vlen}Array* self); % endfor diff --git a/gen/template/java/Array.mako b/gen/template/java/Array.mako old mode 100755 new mode 100644 index f3127cc..1ab575f --- a/gen/template/java/Array.mako +++ b/gen/template/java/Array.mako @@ -20,6 +20,8 @@ package es.ull.pcg.hpc.fancier.array; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import es.ull.pcg.hpc.fancier.Translatable; + public class ${type|c}Array implements AutoCloseable { private long nativeInstancePtr = 0L; @@ -87,8 +89,11 @@ public class ${type|c}Array implements AutoCloseable { private native void releaseNative(); private native void releaseNativeRef(); + @Translatable public native ${type|l} get(int i); + @Translatable public native void set(int i, ${type|l} x); + @Translatable public native long length(); public native ${type|l}[] getArray(); @@ -97,6 +102,6 @@ public class ${type|c}Array implements AutoCloseable { private native ByteBuffer getBufferImpl(); public native void setBuffer(ByteBuffer buffer); - public native void syncToNative(); - public native void syncToOCL(); + public native void syncToHost(); + public native void syncToDevice(); } diff --git a/gen/template/java/Math.mako b/gen/template/java/Math.mako old mode 100755 new mode 100644 index e01e2b9..02d471a --- a/gen/template/java/Math.mako +++ b/gen/template/java/Math.mako @@ -18,106 +18,177 @@ <%include file="/auto-gen.txt"/> package es.ull.pcg.hpc.fancier; + public class Math { + @Translatable public static final int CHAR_BIT = Byte.SIZE; + @Translatable public static final byte SCHAR_MAX = Byte.MAX_VALUE; + @Translatable public static final byte SCHAR_MIN = Byte.MIN_VALUE; + @Translatable public static final byte CHAR_MAX = SCHAR_MAX; + @Translatable public static final byte CHAR_MIN = SCHAR_MIN; + @Translatable public static final short SHRT_MAX = Short.MAX_VALUE; + @Translatable public static final short SHRT_MIN = Short.MIN_VALUE; + @Translatable public static final int INT_MAX = Integer.MAX_VALUE; + @Translatable public static final int INT_MIN = Integer.MIN_VALUE; + @Translatable public static final long LONG_MAX = Long.MAX_VALUE; + @Translatable public static final long LONG_MIN = Long.MIN_VALUE; + @Translatable public static final int FLT_DIG = 6; + @Translatable public static final int FLT_MANT_DIG = 24; + @Translatable public static final int FLT_MAX_10_EXP = +38; + @Translatable public static final int FLT_MAX_EXP = +128; + @Translatable public static final int FLT_MIN_10_EXP = -37; + @Translatable public static final int FLT_MIN_EXP = -125; + @Translatable public static final int FLT_RADIX = 2; + @Translatable public static final float FLT_MAX = Float.MAX_VALUE; + @Translatable public static final float FLT_MIN = Float.MIN_NORMAL; + @Translatable public static final float FLT_EPSILON = 0x1.0p-23f; + @Translatable public static final int DBL_DIG = 15; + @Translatable public static final int DBL_MANT_DIG = 53; + @Translatable public static final int DBL_MAX_10_EXP = +308; + @Translatable public static final int DBL_MAX_EXP = +1024; + @Translatable public static final int DBL_MIN_10_EXP = -307; + @Translatable public static final int DBL_MIN_EXP = -1021; + @Translatable public static final int DBL_RADIX = 2; + @Translatable public static final double DBL_MAX = Double.MAX_VALUE; + @Translatable public static final double DBL_MIN = Double.MIN_NORMAL; + @Translatable public static final double DBL_EPSILON = 0x1.0p-52; + @Translatable public static final float M_E_F = 2.71828174591064f; + @Translatable public static final float M_LOG2E_F = 1.44269502162933f; + @Translatable public static final float M_LOG10E_F = 0.43429449200630f; + @Translatable public static final float M_LN2_F = 0.69314718246460f; + @Translatable public static final float M_LN10_F = 2.30258512496948f; + @Translatable public static final float M_PI_F = 3.14159274101257f; + @Translatable public static final float M_PI_2_F = 1.57079637050629f; + @Translatable public static final float M_PI_4_F = 0.78539818525314f; + @Translatable public static final float M_1_PI_F = 0.31830987334251f; + @Translatable public static final float M_2_PI_F = 0.63661974668503f; + @Translatable public static final float M_2_SQRTPI_F = 1.12837922573090f; + @Translatable public static final float M_SQRT2_F = 1.41421353816986f; + @Translatable public static final float M_SQRT1_2_F = 0.70710676908493f; + @Translatable public static final double M_E = 2.718281828459045090796; + @Translatable public static final double M_LOG2E = 1.442695040888963387005; + @Translatable public static final double M_LOG10E = 0.434294481903251816668; + @Translatable public static final double M_LN2 = 0.693147180559945286227; + @Translatable public static final double M_LN10 = 2.302585092994045901094; + @Translatable public static final double M_PI = 3.141592653589793115998; + @Translatable public static final double M_PI_2 = 1.570796326794896557999; + @Translatable public static final double M_PI_4 = 0.785398163397448278999; + @Translatable public static final double M_1_PI = 0.318309886183790691216; + @Translatable public static final double M_2_PI = 0.636619772367581382433; + @Translatable public static final double M_2_SQRTPI = 1.128379167095512558561; + @Translatable public static final double M_SQRT2 = 1.414213562373095145475; + @Translatable public static final double M_SQRT1_2 = 0.707106781186547572737; + @Translatable public static final float MAXFLOAT = Float.MAX_VALUE; + @Translatable public static final float HUGE_VALF = Float.POSITIVE_INFINITY; + @Translatable public static final double HUGE_VAL = Double.POSITIVE_INFINITY; + @Translatable public static final float INFINITY = Float.POSITIVE_INFINITY; + @Translatable public static final float NAN = Float.NaN; // All types % for type in types: + @Translatable public static ${type|l} abs(${type|l} a) { return a < ${defaults[type.lower()]}? (${type|l}) -a : a; } + @Translatable public static ${type|l} max(${type|l} a, ${type|l} b) { return a > b? a : b; } + @Translatable public static ${type|l} min(${type|l} a, ${type|l} b) { return a < b? a : b; } + @Translatable public static ${type|l} clamp(${type|l} a, ${type|l} b, ${type|l} c) { return a < b? b : (a > c? c : a); } + @Translatable public static ${type|l} mix(${type|l} a, ${type|l} b, ${type|l} c) { return (${type|l}) (a + (b - a) * c); } + @Translatable public static ${type|l} maxMag(${type|l} a, ${type|l} b) { return abs(a) > abs(b)? a : b; } + @Translatable public static ${type|l} minMag(${type|l} a, ${type|l} b) { return abs(a) < abs(b)? a : b; } + @Translatable public static ${type|l} select(${type|l} a, ${type|l} b, int c) { return c == 0? a : b; } @@ -127,31 +198,38 @@ public class Math { % for fname, num_params in math_int_functions.items(): % for type in inttypes: + @Translatable public static native ${type|l} ${fname}(${', '.join([f'{type.lower()} {chr(i + ord("a"))}' for i in range(num_params)])}); % endfor % endfor + @Translatable public static native int mad24 (int a, int b, int c); + @Translatable public static native int mul24 (int a, int b); // Float types % for fname, num_params in math_float_functions.items(): % for type in floattypes: + @Translatable public static native ${type|l} ${fname}(${', '.join([f'{type.lower()} {chr(i + ord("a"))}' for i in range(num_params)])}); % endfor % endfor % for fname in ('scalb', 'ldexp', 'pown', 'rootn'): % for type in floattypes: + @Translatable public static native ${type|l} ${fname}(${type|l} a, int n); % endfor % endfor % for fname in ('isFinite', 'isInf', 'isNaN', 'isNormal'): % for type in floattypes: + @Translatable public static native int ${fname}(${type|l} x); % endfor % endfor % for fname in ('isOrdered', 'isUnordered'): % for type in floattypes: + @Translatable public static native int ${fname}(${type|l} x, ${type|l} y); % endfor % endfor diff --git a/gen/template/java/RGBAImage.mako b/gen/template/java/RGBAImage.mako index 3424f0b..33a56c7 100644 --- a/gen/template/java/RGBAImage.mako +++ b/gen/template/java/RGBAImage.mako @@ -19,13 +19,20 @@ package es.ull.pcg.hpc.fancier.image; import java.nio.ByteBuffer; +% if not android: +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; +% endif import es.ull.pcg.hpc.fancier.vector.Byte4; import es.ull.pcg.hpc.fancier.vector.Int2; import es.ull.pcg.hpc.fancier.vector.array.Byte4Array; +import es.ull.pcg.hpc.fancier.Translatable; + % if android: import android.graphics.Bitmap; + % endif public class RGBAImage implements AutoCloseable { @@ -44,13 +51,19 @@ public class RGBAImage implements AutoCloseable { } public RGBAImage(int[] pixels, int width) { - initNative(pixels, width); + initNative(pixels, width, false); } public RGBAImage(RGBAImage image) { initNative(image); } +% if not android: + public RGBAImage(BufferedImage image) { + initNative(((DataBufferInt) image.getRaster().getDataBuffer()).getData(), image.getWidth(), true); + } +% endif + % if android: public RGBAImage(Bitmap bmp) { initNative(bmp); @@ -77,18 +90,20 @@ public class RGBAImage implements AutoCloseable { private native void initNative(long nativePtr); private native void initNative(int width, int height); - private native void initNative(int[] pixels, int width); private native void initNative(RGBAImage image); + private native void initNative(int[] pixels, int width, boolean changeFromBGRA); % if android: private native void initNative(Bitmap bmp); % endif private native void releaseNative(); private native void releaseNativeRef(); + @Translatable public Byte4 get(Int2 coords) { return get(coords.x, coords.y); } + @Translatable public void set(Int2 coords, Byte4 rgba) { set(coords.x, coords.y, rgba); } @@ -109,21 +124,43 @@ public class RGBAImage implements AutoCloseable { Byte4Array.setBuffer(buffer, y * getWidth() + x, rgba); } + public void setPixels (int[] pixels, int width) { + setPixels(pixels, width, false); + } + +% if not android: + public void setPixels(BufferedImage image) { + setPixels(((DataBufferInt) image.getRaster().getDataBuffer()).getData(), image.getWidth(), true); + } + + public void updateImage(BufferedImage image) { + updateArray(((DataBufferInt) image.getRaster().getDataBuffer()).getData(), true); + } +% endif + + @Translatable public native Byte4 get(int x, int y); + @Translatable public native void set(int x, int y, Byte4 rgba); public native Byte4Array getPixels(); - public native void setPixels(int[] pixels, int width); + private native void setPixels(int[] pixels, int width, boolean changeFromBGRA); public native void setPixels(RGBAImage image); % if android: public native void setPixels(Bitmap bmp); public native void updateBitmap(Bitmap bmp); % endif +% if not android: + private native void updateArray(int[] array, boolean changeFromBGRA); +% endif + @Translatable public native Int2 getDims(); + @Translatable public native int getWidth(); + @Translatable public native int getHeight(); - public native void syncToNative(); - public native void syncToOCL(); + public native void syncToHost(); + public native void syncToDevice(); } diff --git a/gen/template/java/Vector.mako b/gen/template/java/Vector.mako old mode 100755 new mode 100644 index cca6fa2..0e690ad --- a/gen/template/java/Vector.mako +++ b/gen/template/java/Vector.mako @@ -43,6 +43,7 @@ native_calls = [f'Math.{fname}(' + (', '.join([f'{param_name(i)}.{field}' for i in range(fnum_params)])) + ')' for field in vfields[:vlen]] %>\ % if fnum_params > 0: + @Translatable public static ${type|c}${vlen} ${fname}(${', '.join(param_list)}) { return new ${type|c}${vlen}(${', '.join(native_calls)}); } @@ -58,32 +59,42 @@ package es.ull.pcg.hpc.fancier.vector; import es.ull.pcg.hpc.fancier.Math; +import es.ull.pcg.hpc.fancier.Translatable; + + public class ${type|c}${vlen} { ## List of fields % for field in vfields[:min(vlen, 4)]: + @Translatable public ${type|l} ${field}; % endfor % if vlen > 4: + @Translatable public ${type|l}[] s = new ${type|l}[${vlen - 4}]; % endif ## Constructors + @Translatable public ${type|c}${vlen}() {} + @Translatable public ${type|c}${vlen}(${', '.join([f'{type.lower()} {field_to_varname(field)}' for field in vfields[:vlen]])}) { set(${', '.join([f'{field_to_varname(field)}' for field in vfields[:vlen]])}); } + @Translatable public void set(${', '.join([f'{type.lower()} {field_to_varname(field)}' for field in vfields[:vlen]])}) { % for field in vfields[:vlen]: this.${field} = ${field_to_varname(field)}; % endfor } + @Translatable public ${type|c}${vlen}(${type|l} v) { this(${', '.join(['v'] * vlen)}); } + @Translatable public void set(${type|l} v) { set(${', '.join(['v'] * vlen)}); } @@ -91,10 +102,12 @@ public class ${type|c}${vlen} { % for param_set in sorted(set(fill_params(vlen))): % if len(param_set) != vlen: <% params, args = make_delegate_constructor(param_set, type, vfields) %>\ + @Translatable public ${type|c}${vlen}(${', '.join(params)}) { this(${', '.join(args)}); } + @Translatable public void set(${', '.join(params)}) { set(${', '.join(args)}); } @@ -102,12 +115,14 @@ public class ${type|c}${vlen} { % endif % endfor ## Passing as value parameter + @Translatable public ${type|c}${vlen} value() { return new ${type|c}${vlen}(this); } ## Indexing % if vlen > 2 and vlen % 2 == 0: + @Translatable public ${type|c}${vlen//2} lo() { return new ${type|c}${vlen//2}(${', '.join([field for field in vfields[:vlen//2]])}); } @@ -118,6 +133,7 @@ public class ${type|c}${vlen} { % endfor } + @Translatable public ${type|c}${vlen//2} hi() { return new ${type|c}${vlen//2}(${', '.join([field for field in vfields[vlen//2:vlen]])}); } @@ -128,6 +144,7 @@ public class ${type|c}${vlen} { % endfor } + @Translatable public ${type|c}${vlen//2} odd() { return new ${type|c}${vlen//2}(${', '.join([f'{vfields[i]}' for i in range(1, vlen, 2)])}); } @@ -138,6 +155,7 @@ public class ${type|c}${vlen} { % endfor } + @Translatable public ${type|c}${vlen//2} even() { return new ${type|c}${vlen//2}(${', '.join([f'{vfields[i]}' for i in range(0, vlen, 2)])}); } @@ -153,6 +171,7 @@ public class ${type|c}${vlen} { <% cast_mask = ' & 0xff' if type.lower() == 'byte' else '' %>\ % for newtype in types: % if newtype.lower() != type.lower(): + @Translatable public ${newtype|c}${vlen} convert${newtype|c}${vlen}() { return new ${newtype|c}${vlen}(${', '.join([f'({newtype.lower()})({field}{cast_mask})' for field in vfields[:vlen]])}); } @@ -166,6 +185,7 @@ public class ${type|c}${vlen} { % endif % endfor % for newlen in vlens[:vlens.index(vlen)]: + @Translatable public ${type|c}${newlen} as${type|c}${newlen}() { return new ${type|c}${newlen}(${', '.join([field for field in vfields[:newlen]])}); } @@ -179,6 +199,7 @@ public class ${type|c}${vlen} { % endfor ## Comparison operators % for fname, op in zip(['isEqual', 'isNotEqual', 'isGreater', 'isGreaterEqual', 'isLess', 'isLessEqual'], ['==', '!=', '>', '>=', '<', '<=']): + @Translatable public static Int${vlen} ${fname}(${type|c}${vlen} a, ${type|c}${vlen} b) { return new Int${vlen}(${', '.join([f'a.{field} {op} b.{field}? 1 : 0' for field in vfields[:vlen]])}); } @@ -190,6 +211,7 @@ public class ${type|c}${vlen} { } % endfor + @Translatable public static ${type|c}${vlen} select(${type|c}${vlen} a, ${type|c}${vlen} b, Int${vlen} c) { return new ${type|c}${vlen}(${', '.join(f'Math.select(a.{field}, b.{field}, c.{field})' for field in vfields[:vlen])}); } @@ -202,6 +224,7 @@ public class ${type|c}${vlen} { % if type.lower() in floattypes: % for fname in ('isFinite', 'isInf', 'isNaN', 'isNormal'): + @Translatable public static Int${vlen} ${fname}(${type|c}${vlen} a) { return new Int${vlen}(${', '.join(f'Math.{fname}(a.{field})' for field in vfields[:vlen])}); } @@ -214,6 +237,7 @@ public class ${type|c}${vlen} { % endfor % for fname in ('isOrdered', 'isUnordered'): + @Translatable public static Int${vlen} ${fname}(${type|c}${vlen} a, ${type|c}${vlen} b) { return new Int${vlen}(${', '.join(f'Math.{fname}(a.{field}, b.{field})' for field in vfields[:vlen])}); } @@ -227,15 +251,18 @@ public class ${type|c}${vlen} { % endfor % endif ## Any/All vector evaluation + @Translatable public static int any(${type|c}${vlen} a) { return (${' || '.join([f'a.{field} != {defaults[type.lower()]}' for field in vfields[:vlen]])})? 1 : 0; } + @Translatable public static int all(${type|c}${vlen} a) { return (${' || '.join([f'a.{field} == {defaults[type.lower()]}' for field in vfields[:vlen]])})? 0 : 1; } ## Basic element-wise arithmetic operations + @Translatable public static ${type|c}${vlen} neg(${type|c}${vlen} a) { return new ${type|c}${vlen}(${', '.join([f'({type.lower()})(-a.{field})' for field in vfields[:vlen]])}); } @@ -247,6 +274,7 @@ public class ${type|c}${vlen} { } % for fname, op in zip(['add', 'sub'], ['+', '-']): + @Translatable public static ${type|c}${vlen} ${fname}(${type|c}${vlen} a, ${type|c}${vlen} b) { return new ${type|c}${vlen}(${', '.join([f'({type.lower()})(a.{field} {op} b.{field})' for field in vfields[:vlen]])}); } @@ -261,6 +289,7 @@ public class ${type|c}${vlen} { ## Element-wise multiplication and division % for fname, op in zip(['mul', 'div'], ['*', '/']): % for param_type in sorted(set(floattypes + [type.lower()])): + @Translatable public static ${param_type|c}${vlen} ${fname}(${type|c}${vlen} a, ${param_type|c}${vlen} b) { return new ${param_type|c}${vlen}(${', '.join([f'({param_type.lower()})(a.{field} {op} b.{field})' for field in vfields[:vlen]])}); } @@ -271,6 +300,7 @@ public class ${type|c}${vlen} { % endfor } + @Translatable public static ${param_type|c}${vlen} ${fname}(${type|c}${vlen} a, ${param_type|l} k) { return new ${param_type|c}${vlen}(${', '.join([f'({param_type.lower()})(a.{field} {op} k)' for field in vfields[:vlen]])}); } @@ -286,6 +316,7 @@ public class ${type|c}${vlen} { % if type.lower() in floattypes: ## Vector cross product for vectors of length 3 and 4 % if vlen in (3, 4): + @Translatable public static ${type|c}${vlen} cross(${type|c}${vlen} a, ${type|c}${vlen} b) { ${type|c}${vlen} result = new ${type|c}${vlen}(); cross(a, b, result); @@ -302,23 +333,28 @@ public class ${type|c}${vlen} { } % endif + @Translatable public static ${type|l} dot(${type|c}${vlen} a, ${type|c}${vlen} b) { return (${type|l})(${' + '.join([f'a.{field} * b.{field}' for field in vfields[:vlen]])}); } + @Translatable public static double distance(${type|c}${vlen} a, ${type|c}${vlen} b) { return distance(a, b, new ${type|c}${vlen}()); } + @Translatable public static double distance(${type|c}${vlen} a, ${type|c}${vlen} b, ${type|c}${vlen} tmp) { sub(a, b, tmp); return length(tmp); } + @Translatable public static double length(${type|c}${vlen} a) { return Math.sqrt(${' + '.join([f'a.{field} * a.{field}' for field in vfields[:vlen]])}); } + @Translatable public static ${type|c}${vlen} normalize(${type|c}${vlen} a) { ${type|c}${vlen} result = new ${type|c}${vlen}(); normalize(a, result); @@ -333,6 +369,7 @@ public class ${type|c}${vlen} { } % elif type.lower() in inttypes: ## Module (%) operator + @Translatable public static ${type|c}${vlen} mod(${type|c}${vlen} a, ${type|c}${vlen} b) { return new ${type|c}${vlen}(${', '.join([f'({type.lower()})(a.{field} % b.{field})' for field in vfields[:vlen]])}); } @@ -343,6 +380,7 @@ public class ${type|c}${vlen} { % endfor } + @Translatable public static ${type|c}${vlen} mod(${type|c}${vlen} a, ${type|l} k) { return new ${type|c}${vlen}(${', '.join([f'({type.lower()})(a.{field} % k)' for field in vfields[:vlen]])}); } @@ -355,6 +393,7 @@ public class ${type|c}${vlen} { ## Bitwise operators % for fname, op in zip(['bitAnd', 'bitOr', 'bitXor'], ['&', '|', '^']): + @Translatable public static ${type|c}${vlen} ${fname}(${type|c}${vlen} a, ${type|c}${vlen} b) { return new ${type|c}${vlen}(${', '.join([f'({type.lower()})(a.{field} {op} b.{field})' for field in vfields[:vlen]])}); } @@ -366,6 +405,7 @@ public class ${type|c}${vlen} { } % endfor + @Translatable public static ${type|c}${vlen} bitNot(${type|c}${vlen} a) { return new ${type|c}${vlen}(${', '.join([f'({type.lower()})(~a.{field})' for field in vfields[:vlen]])}); } @@ -380,6 +420,7 @@ public class ${type|c}${vlen} { ${simple_elementwise(fname)}\ % endfor + @Translatable public static ${type|c}${vlen} clamp(${type|c}${vlen} v, ${type|l} min, ${type|l} max) { return new ${type|c}${vlen}(${', '.join([f'Math.clamp(v.{field}, min, max)' for field in vfields[:vlen]])}); } @@ -390,6 +431,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} max(${type|c}${vlen} x, ${type|l} y) { return new ${type|c}${vlen}(${', '.join([f'Math.max(x.{field}, y)' for field in vfields[:vlen]])}); } @@ -400,6 +442,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} min(${type|c}${vlen} x, ${type|l} y) { return new ${type|c}${vlen}(${', '.join([f'Math.min(x.{field}, y)' for field in vfields[:vlen]])}); } @@ -410,6 +453,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} mix(${type|c}${vlen} x, ${type|c}${vlen} y, ${type|l} a) { return new ${type|c}${vlen}(${', '.join([f'Math.mix(x.{field}, y.{field}, a)' for field in vfields[:vlen]])}); } @@ -424,6 +468,7 @@ ${simple_elementwise(fname)}\ ${simple_elementwise(fname)}\ % endfor + @Translatable public static ${type|c}${vlen} scalb(${type|c}${vlen} a, Int${vlen} n) { return new ${type|c}${vlen}(${', '.join([f'Math.scalb(a.{field}, n.{field})' for field in vfields[:vlen]])}); } @@ -434,6 +479,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} ldexp(${type|c}${vlen} a, Int${vlen} n) { return new ${type|c}${vlen}(${', '.join([f'Math.ldexp(a.{field}, n.{field})' for field in vfields[:vlen]])}); } @@ -444,6 +490,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} pown(${type|c}${vlen} a, Int${vlen} b) { return new ${type|c}${vlen}(${', '.join([f'Math.pown(a.{field}, b.{field})' for field in vfields[:vlen]])}); } @@ -454,6 +501,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} rootn(${type|c}${vlen} a, Int${vlen} b) { return new ${type|c}${vlen}(${', '.join([f'Math.pown(a.{field}, b.{field})' for field in vfields[:vlen]])}); } @@ -464,6 +512,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} smoothStep(${type|c}${vlen} a, ${type|c}${vlen} b, ${type|l} c) { return new ${type|c}${vlen}(${', '.join([f'Math.smoothStep(a.{field}, b.{field}, c)' for field in vfields[:vlen]])}); } @@ -479,6 +528,7 @@ ${simple_elementwise(fname)}\ % endfor % if type.lower() == 'int': + @Translatable public static ${type|c}${vlen} mad24(${type|c}${vlen} a, ${type|c}${vlen} b, ${type|c}${vlen} c) { return new ${type|c}${vlen}(${', '.join([f'Math.mad24(a.{field}, b.{field}, c.{field})' for field in vfields[:vlen]])}); } @@ -489,6 +539,7 @@ ${simple_elementwise(fname)}\ % endfor } + @Translatable public static ${type|c}${vlen} mul24(${type|c}${vlen} a, ${type|c}${vlen} b) { return new ${type|c}${vlen}(${', '.join([f'Math.mul24(a.{field}, b.{field})' for field in vfields[:vlen]])}); } diff --git a/gen/template/java/VectorArray.mako b/gen/template/java/VectorArray.mako old mode 100755 new mode 100644 index 28d0586..a359731 --- a/gen/template/java/VectorArray.mako +++ b/gen/template/java/VectorArray.mako @@ -23,6 +23,9 @@ import es.ull.pcg.hpc.fancier.vector.${type|c}${vlen}; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import es.ull.pcg.hpc.fancier.Translatable; + + public class ${type|c}${vlen}Array implements AutoCloseable { private long nativeInstancePtr = 0L; @@ -101,8 +104,11 @@ public class ${type|c}${vlen}Array implements AutoCloseable { private native void releaseNative(); private native void releaseNativeRef(); + @Translatable public native ${type|c}${vlen} get(int i); + @Translatable public native void set(int i, ${type|c}${vlen} x); + @Translatable public native long length(); public native ${type|l}[] getArray(); @@ -111,6 +117,6 @@ public class ${type|c}${vlen}Array implements AutoCloseable { private native ByteBuffer getBufferImpl(); public native void setBuffer(ByteBuffer v); - public native void syncToNative(); - public native void syncToOCL(); + public native void syncToHost(); + public native void syncToDevice(); } diff --git a/gen/template/opencl/fc_image.mako b/gen/template/opencl/fc_image.mako new file mode 100644 index 0000000..01388c6 --- /dev/null +++ b/gen/template/opencl/fc_image.mako @@ -0,0 +1,38 @@ +## Fancier: Unified Java, JNI and OpenCL Integration High-Performance GPGPU API. +## Copyright (C) 2021 Universidad de La Laguna. +## +## Fancier is free software: you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Fancier is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with Fancier. If not, see . +## + +<%include file="/license.txt"/> +<%include file="/auto-gen.txt"/> +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif // cl_khr_fp64 + +#if defined(__EMBEDDED_PROFILE__) && defined(cles_khr_int64) +#pragma OPENCL EXTENSION cles_khr_int64 : enable +#endif // __EMBEDDED_PROFILE__ && cles_khr_int64 + +uint index_img (uint2 dims, uint x, uint y) { + return y * dims.x + x; +} + +int toRgba (uchar4 color) { + return ((color.x & 0xff) << 24) | ((color.y & 0xff) << 16) | ((color.z & 0xff) << 8) | ((color.w & 0xff) << 0); +} + +uchar4 fromRgba (int rgba) { + return (uchar4)((uchar)((rgba >> 24) & 0xff), (uchar)((rgba >> 16) & 0xff), (uchar)((rgba >> 8) & 0xff), (uchar)((rgba >> 0) & 0xff)); +} diff --git a/gen/template/opencl/math_lib.mako b/gen/template/opencl/fc_math.mako old mode 100755 new mode 100644 similarity index 75% rename from gen/template/opencl/math_lib.mako rename to gen/template/opencl/fc_math.mako index d71393c..2d956c9 --- a/gen/template/opencl/math_lib.mako +++ b/gen/template/opencl/fc_math.mako @@ -47,8 +47,14 @@ ${type|l} ${typed_float_fname('scalb', type)}(${type|l} a, int scaleFactor) { ${type|l}${vlen} ${type|l}${vlen}_scalb(${type|l}${vlen} a, int${vlen} scaleFactor) { return (${type|l}${vlen})(${', '.join([f'{typed_float_fname("scalb", type)}(a.{field}, scaleFactor.{field})' for field in vfields[:vlen]])}); } +% endfor +% for vlen in vlens: +${type|l}${vlen} ${type|l}${vlen}_smoothstep(${type|l}${vlen} a, ${type|l}${vlen} b, ${type|l} c) { + return (${type|l}${vlen})(${', '.join([f'smoothstep(a.{field}, b.{field}, c)' for field in vfields[:vlen]])}); +} % endfor + % if type.lower() == 'double': #endif // cl_khr_fp64 % endif @@ -66,6 +72,14 @@ ${type|l} ${typed_int_builtin_fname('mix', type)}(${type|l} x, ${type|l} y, ${ty return x + (y - x) * a; } +${type|l} ${typed_int_builtin_fname('maxmag', type)}(${type|l} a, ${type|l} b) { + return abs(a) > abs(b) ? a : b; +} + +${type|l} ${typed_int_builtin_fname('minmag', type)}(${type|l} a, ${type|l} b) { + return abs(a) < abs(b) ? a : b; +} + % for vlen in vlens: ${type|l}${vlen} ${type|l}${vlen}_clamp(${type|l}${vlen} a, ${type|l}${vlen} min, ${type|l}${vlen} max) { return (${type|l}${vlen})(${', '.join([f'{typed_int_builtin_fname("clamp", type)}(a.{field}, min.{field}, max.{field})' for field in vfields[:vlen]])}); @@ -75,6 +89,14 @@ ${type|l}${vlen} ${type|l}${vlen}_mix(${type|l}${vlen} x, ${type|l}${vlen} y, ${ return (${type|l}${vlen})(${', '.join([f'{typed_int_builtin_fname("mix", type)}(x.{field}, y.{field}, a.{field})' for field in vfields[:vlen]])}); } +${type|l}${vlen} ${type|l}${vlen}_maxmag(${type|l}${vlen} a, ${type|l}${vlen} b) { + return (${type|l}${vlen})(${', '.join([f'{typed_int_builtin_fname("maxmag", type)}(a.{field}, b.{field})' for field in vfields[:vlen]])}); +} + +${type|l}${vlen} ${type|l}${vlen}_minmag(${type|l}${vlen} a, ${type|l}${vlen} b) { + return (${type|l}${vlen})(${', '.join([f'{typed_int_builtin_fname("minmag", type)}(a.{field}, b.{field})' for field in vfields[:vlen]])}); +} + % endfor % if type.lower() == 'long': #endif // !__EMBEDDED_PROFILE__ || cles_khr_int64 diff --git a/gen/template/src/array.mako b/gen/template/src/array.mako old mode 100755 new mode 100644 index 7805264..54f303a --- a/gen/template/src/array.mako +++ b/gen/template/src/array.mako @@ -192,8 +192,8 @@ Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_getArray(JNIEnv* env, jobject o FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}Array_getJava", NULL); // Ensure native array is synced - jint err = fc${type|c}Array_syncToNative(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToNative", NULL); + jint err = fc${type|c}Array_syncToHost(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToHost", NULL); // Create Java array and populate it j${type|l}Array __tmp_ret = FC_JNI_CALL(env, New${type|c}Array, self->len); @@ -245,8 +245,8 @@ Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_getBufferImpl(JNIEnv* env, jobj FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}Array_getJava", NULL); // Ensure native array is synced - jint err = fc${type|c}Array_syncToNative(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToNative", NULL); + jint err = fc${type|c}Array_syncToHost(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToHost", NULL); // Create and return direct byte buffer pointing to the native data return FC_JNI_CALL(env, NewDirectByteBuffer, self->c, self->len * sizeof(fc${type|c})); @@ -269,21 +269,21 @@ Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_setBuffer(JNIEnv* env, jobject } JNIEXPORT void JNICALL -Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_syncToNative(JNIEnv* env, jobject obj) { +Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_syncToHost(JNIEnv* env, jobject obj) { fc${type|c}Array* self = fc${type|c}Array_getJava(env, obj); FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}Array_getJava", FC_VOID_EXPR); - jint err = fc${type|c}Array_syncToNative(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToNative", FC_VOID_EXPR); + jint err = fc${type|c}Array_syncToHost(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToHost", FC_VOID_EXPR); } JNIEXPORT void JNICALL -Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_syncToOCL(JNIEnv* env, jobject obj) { +Java_es_ull_pcg_hpc_fancier_array_${type|c}Array_syncToDevice(JNIEnv* env, jobject obj) { fc${type|c}Array* self = fc${type|c}Array_getJava(env, obj); FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}Array_getJava", FC_VOID_EXPR); - jint err = fc${type|c}Array_syncToOCL(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToOCL", FC_VOID_EXPR); + jint err = fc${type|c}Array_syncToDevice(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}Array_syncToDevice", FC_VOID_EXPR); } // @@ -462,7 +462,7 @@ fc${type|c} fc${type|c}Array_get(fc${type|c}Array* self, fcInt i, fcError* err) } // Set location to native in order to access the array data - *err = fc${type|c}Array_syncToNative(self); + *err = fc${type|c}Array_syncToHost(self); if (*err) return __tmp_ret; return self->c[i]; @@ -473,7 +473,7 @@ fcError fc${type|c}Array_set(fc${type|c}Array* self, fcInt i, fc${type|c} x) { if (i < 0 || i >= self->len) return FC_EXCEPTION_BAD_PARAMETER; // Set location to native in order to access the array data - fcError err = fc${type|c}Array_syncToNative(self); + fcError err = fc${type|c}Array_syncToHost(self); if (err) return err; @@ -538,7 +538,7 @@ fcError fc${type|c}Array_setBuffer(fc${type|c}Array* self, fcLong len, const voi return FC_EXCEPTION_SUCCESS; } -fcError fc${type|c}Array_syncToNative(fc${type|c}Array* self) { +fcError fc${type|c}Array_syncToHost(fc${type|c}Array* self) { if (!fc${type|c}Array_valid(self)) return FC_EXCEPTION_INVALID_STATE; @@ -553,7 +553,7 @@ fcError fc${type|c}Array_syncToNative(fc${type|c}Array* self) { return err; } -fcError fc${type|c}Array_syncToOCL(fc${type|c}Array* self) { +fcError fc${type|c}Array_syncToDevice(fc${type|c}Array* self) { if (!fc${type|c}Array_valid(self)) return FC_EXCEPTION_INVALID_STATE; diff --git a/gen/template/src/math.mako b/gen/template/src/math.mako old mode 100755 new mode 100644 diff --git a/gen/template/src/vector.mako b/gen/template/src/vector.mako old mode 100755 new mode 100644 diff --git a/gen/template/src/vector_array.mako b/gen/template/src/vector_array.mako old mode 100755 new mode 100644 index 788da43..4ce6c7d --- a/gen/template/src/vector_array.mako +++ b/gen/template/src/vector_array.mako @@ -206,8 +206,8 @@ Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_getArray(JNIEnv* FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}${vlen}Array_getJava", NULL); // Ensure native array is synced - jint err = fc${type|c}${vlen}Array_syncToNative(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToNative", NULL); + jint err = fc${type|c}${vlen}Array_syncToHost(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToHost", NULL); // Create Java array and populate it j${type|l}Array __tmp_ret = FC_JNI_CALL(env, New${type|c}Array, self->len * ${vlen}); @@ -270,8 +270,8 @@ Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_getBufferImpl(JNI FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}${vlen}Array_getJava", NULL); // Ensure native array is synced - jint err = fc${type|c}${vlen}Array_syncToNative(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToNative", NULL); + jint err = fc${type|c}${vlen}Array_syncToHost(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToHost", NULL); // Create and return direct byte buffer pointing to the native data return FC_JNI_CALL(env, NewDirectByteBuffer, self->c, self->len * sizeof(fc${type|c}${vlen})); @@ -294,21 +294,21 @@ Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_setBuffer(JNIEnv* } JNIEXPORT void JNICALL -Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_syncToNative(JNIEnv* env, jobject obj) { +Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_syncToHost(JNIEnv* env, jobject obj) { fc${type|c}${vlen}Array* self = fc${type|c}${vlen}Array_getJava(env, obj); FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}${vlen}Array_getJava", FC_VOID_EXPR); - jint err = fc${type|c}${vlen}Array_syncToNative(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToNative", FC_VOID_EXPR); + jint err = fc${type|c}${vlen}Array_syncToHost(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToHost", FC_VOID_EXPR); } JNIEXPORT void JNICALL -Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_syncToOCL(JNIEnv* env, jobject obj) { +Java_es_ull_pcg_hpc_fancier_vector_array_${type|c}${vlen}Array_syncToDevice(JNIEnv* env, jobject obj) { fc${type|c}${vlen}Array* self = fc${type|c}${vlen}Array_getJava(env, obj); FC_EXCEPTION_HANDLE_NULL(env, self, FC_EXCEPTION_INVALID_THIS, "fc${type|c}${vlen}Array_getJava", FC_VOID_EXPR); - jint err = fc${type|c}${vlen}Array_syncToOCL(self); - FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToOCL", FC_VOID_EXPR); + jint err = fc${type|c}${vlen}Array_syncToDevice(self); + FC_EXCEPTION_HANDLE_ERROR(env, err, "fc${type|c}${vlen}Array_syncToDevice", FC_VOID_EXPR); } // @@ -487,7 +487,7 @@ fc${type|c}${vlen} fc${type|c}${vlen}Array_get(fc${type|c}${vlen}Array* self, fc } // Set location to native in order to access the array data - *err = fc${type|c}${vlen}Array_syncToNative(self); + *err = fc${type|c}${vlen}Array_syncToHost(self); if (*err) return __tmp_ret; return self->c[i]; @@ -498,7 +498,7 @@ fcError fc${type|c}${vlen}Array_set(fc${type|c}${vlen}Array* self, fcInt i, fc${ if (i < 0 || i >= self->len) return FC_EXCEPTION_BAD_PARAMETER; // Set location to native in order to access the array data - fcError err = fc${type|c}${vlen}Array_syncToNative(self); + fcError err = fc${type|c}${vlen}Array_syncToHost(self); if (err) return err; self->c[i] = x; @@ -518,7 +518,7 @@ fcError fc${type|c}${vlen}Array_setArray(fc${type|c}${vlen}Array* self, fcInt le // TODO If not unified memory, don't sync and just set native data and update location // Initialize array // Map to host, and write data considering alignment - err = fc${type|c}${vlen}Array_syncToNative(self); + err = fc${type|c}${vlen}Array_syncToHost(self); if (err) return err; for (fcLong i = 0; i < self->len; ++i) { @@ -567,13 +567,13 @@ fcError fc${type|c}${vlen}Array_setBuffer(fc${type|c}${vlen}Array* self, fcLong // TODO If not unified memory, don't sync and just set native data and update location // Initialize array // Map to host, and write data considering alignment - fcError err = fc${type|c}${vlen}Array_syncToNative(self); + fcError err = fc${type|c}${vlen}Array_syncToHost(self); if (err) return err; return memcpy(self->c, v, len)? FC_EXCEPTION_SUCCESS : FC_EXCEPTION_FAILED_COPY; } -fcError fc${type|c}${vlen}Array_syncToNative(fc${type|c}${vlen}Array* self) { +fcError fc${type|c}${vlen}Array_syncToHost(fc${type|c}${vlen}Array* self) { if (!fc${type|c}${vlen}Array_valid(self)) return FC_EXCEPTION_INVALID_STATE; @@ -588,7 +588,7 @@ fcError fc${type|c}${vlen}Array_syncToNative(fc${type|c}${vlen}Array* self) { return err; } -fcError fc${type|c}${vlen}Array_syncToOCL(fc${type|c}${vlen}Array* self) { +fcError fc${type|c}${vlen}Array_syncToDevice(fc${type|c}${vlen}Array* self) { if (!fc${type|c}${vlen}Array_valid(self)) return FC_EXCEPTION_INVALID_STATE; diff --git a/java/.gitignore b/java/.gitignore index 549ed76..217f027 100644 --- a/java/.gitignore +++ b/java/.gitignore @@ -1,2 +1,3 @@ .gradle **/build +local.properties diff --git a/java/.idea/.gitignore b/java/.idea/.gitignore old mode 100755 new mode 100644 diff --git a/java/.idea/.name b/java/.idea/.name old mode 100755 new mode 100644 diff --git a/java/.idea/compiler.xml b/java/.idea/compiler.xml old mode 100755 new mode 100644 diff --git a/java/.idea/encodings.xml b/java/.idea/encodings.xml old mode 100755 new mode 100644 diff --git a/java/.idea/gradle.xml b/java/.idea/gradle.xml old mode 100755 new mode 100644 diff --git a/java/.idea/jarRepositories.xml b/java/.idea/jarRepositories.xml old mode 100755 new mode 100644 index efa4625..b8b7f1c --- a/java/.idea/jarRepositories.xml +++ b/java/.idea/jarRepositories.xml @@ -16,5 +16,10 @@