Syncleus / aparapi-native

A framework for executing native Java code on the GPU.
http://aparapi.com
Apache License 2.0
5 stars 6 forks source link

The usage of javah is not longer support for JDK > 8 #12

Open 0x6e3078 opened 6 years ago

0x6e3078 commented 6 years ago

It's not possible to run the prepare.sh successfully with a JDK greater then 8. The javah command was removed and its forced to use the javac -h option.

The current workaround: use a JDK8

freemo commented 6 years ago

Thanks I will fix this in the next release, a PR would be welcome as well.

On Fri, Sep 7, 2018 at 1:42 PM 0x6e3078 notifications@github.com wrote:

It's not possible to run the prepare.sh successfully with a JDK greater then 8. The javah command was removed and its forced to use the javac -h option.

The current workaround: use a JDK8

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi-native/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5JAsdFV7wKjGA3e-O-l_jCprO8vt5xks5uYlujgaJpZM4WermZ .

0x6e3078 commented 6 years ago

Hi freemo, I currently trying to get it working with javac but unfortunately it is not working like I expected it. I have added the -h option to the pom.xml

@@ -101,6 +101,15 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                    <compilerArgs>
+                        <arg>-h</arg>
+                        <arg>../include/</arg>
+                     </compilerArgs>
+                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

But this will only create this two header com_aparapi_internal_jni_KernelRunnerJNI.h com_aparapi_internal_jni_OpenCLJNI.h

Best regards Sven

freemo commented 6 years ago

hmm thats odd, does it give you an error when you try it that way?

On Fri, Sep 7, 2018 at 2:59 PM 0x6e3078 notifications@github.com wrote:

Hi freemo, I currently trying to get it working with javac but unfortunately it is not working like I expected it. I have added the -h option to the pom.xml

@@ -101,6 +101,15 @@

org.apache.maven.plugins maven-compiler-plugin + + 1.8 + 1.8 + UTF-8 + + -h + ../include/ + +
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>

But this will only create this two header com_aparapi_internal_jni_KernelRunnerJNI.h com_aparapi_internal_jni_OpenCLJNI.h

Best regards Sven

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi-native/issues/12#issuecomment-419431358, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5JAjQ4pGJVxQQjieWLZ5FAGG_9uqMYks5uYm2UgaJpZM4WermZ .

0x6e3078 commented 6 years ago

No there is no error, but I guess that the java files may missing the Native Annotation. https://docs.oracle.com/javase/10/docs/api/java/lang/annotation/Native.html

I tried it with the follow file: (patch)

diff --git i/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java w/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java
index 1972422..39f7c1f 100644
--- i/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java
+++ w/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java
@@ -15,13 +15,16 @@
  */
 package com.aparapi.internal.opencl;

+import java.lang.annotation.Native;
+
+
 public class OpenCLMem{

-   public final static int MEM_DIRTY_BIT = 1 << 0x00F;
+@Native  public final static int MEM_DIRTY_BIT = 1 << 0x00F;

-   public final static int MEM_COPY_BIT = 1 << 0x010;
+@Native  public final static int MEM_COPY_BIT = 1 << 0x010;

-   public final static int MEM_ENQUEUED_BIT = 1 << 0x011;
+@Native  public final static int MEM_ENQUEUED_BIT = 1 << 0x011;

    public long bits; // dirty, copy, enqueued

Then the header file will be created. I will change that an try to provide a proper patch. But this will take until next week.

freemo commented 6 years ago

Thanks so much for helping out. I look forward to it. Dont forget to add your name to the contributors list when you submit the PR (Also update the changelog).

On Fri, Sep 7, 2018 at 3:54 PM 0x6e3078 notifications@github.com wrote:

No there is no error, but I guess that the java files may missing the Native Annotation. https://docs.oracle.com/javase/10/docs/api/java/lang/annotation/Native.html

I tried it with the follow file: (patch)

diff --git i/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java w/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java index 1972422..39f7c1f 100644 --- i/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java +++ w/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java @@ -15,13 +15,16 @@ */ package com.aparapi.internal.opencl;

+import java.lang.annotation.Native; + + public class OpenCLMem{

  • public final static int MEM_DIRTY_BIT = 1 << 0x00F; +@Native public final static int MEM_DIRTY_BIT = 1 << 0x00F;

  • public final static int MEM_COPY_BIT = 1 << 0x010; +@Native public final static int MEM_COPY_BIT = 1 << 0x010;

  • public final static int MEM_ENQUEUED_BIT = 1 << 0x011; +@Native public final static int MEM_ENQUEUED_BIT = 1 << 0x011;

    public long bits; // dirty, copy, enqueued

Then the header file will be created. I will change that an try to provide a proper patch. But this will take until next week.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi-native/issues/12#issuecomment-419446653, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5JAoAEjyVtLiB8Hi-qJS77VDQPqP6wks5uYnqAgaJpZM4WermZ .

0x6e3078 commented 6 years ago

Hi I created two pull requests, one for aparapi and one for aparapi-native.