Aparapi issueshttps://git.qoto.org/aparapi/aparapi/-/issues2023-10-26T09:45:52Zhttps://git.qoto.org/aparapi/aparapi/-/issues/13An internal crash occurs when trying to execute a part of codes2023-10-26T09:45:52ZBen CheungAn internal crash occurs when trying to execute a part of codes[hs_err_pid16380.log](/uploads/53cd9519c99b5e57883ffeb4a2edd105/hs_err_pid16380.log)
Running with a jar
```
terminate called after throwing an instance of 'char const*'
```
Running using IDE
```
#
# A fatal error has been detected by t...[hs_err_pid16380.log](/uploads/53cd9519c99b5e57883ffeb4a2edd105/hs_err_pid16380.log)
Running with a jar
```
terminate called after throwing an instance of 'char const*'
```
Running using IDE
```
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (0x20474343), pid=16380, tid=0x0000000000003568
#
# JRE version: OpenJDK Runtime Environment (8.0_382-b05) (build 1.8.0_382-b05)
# Java VM: OpenJDK 64-Bit Server VM (25.382-b05 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [KERNELBASE.dll+0x2cf19]
#
# Core dump written. Default location: ...\hs_err_pid16380.mdmp
#
# An error report file with more information is saved as:
# ...\hs_err_pid16380.log
#
# If you would like to submit a bug report, please visit:
# https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
```
I am not sure whether the problem is related to my device, but there is no clear indication for it.
It occurs when running `Kernel#execute(int)`.https://git.qoto.org/aparapi/aparapi/-/issues/12com.aparapi.SimpleScalaTest.testKernel() seems to always fallback to Java device2023-10-25T19:01:39ZLuis Mendescom.aparapi.SimpleScalaTest.testKernel() seems to always fallback to Java deviceFor some reason the generated OpenCL code is failing on OpenCL devices and always falls back to Java to finally pass.
It maybe a workgroup size issue, but need to be further verified.
```
[INFO] ------------------------------------------...For some reason the generated OpenCL code is failing on OpenCL devices and always falls back to Java to finally pass.
It maybe a workgroup size issue, but need to be further verified.
```
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.aparapi.SimpleScalaTest
out 25, 2023 7:59:32 DA TARDE com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = MethodParameters)
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = ScalaInlineInfo)
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = Scala)
lhs:22< {
lhs:25< }
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = MethodParameters)
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = ScalaInlineInfo)
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = Scala)
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.kernel.KernelRunner fallBackToNextDevice
WARNING: Device failed for SimpleScalaTest$$anon$1, devices={NVIDIA<GPU>|Portable<CPU>|Java Alternative Algorithm|Java Thread Pool}: OpenCL execution seems to have failed (runKernelJNI returned -1)
com.aparapi.internal.exception.AparapiException: OpenCL execution seems to have failed (runKernelJNI returned -1)
at com.aparapi.internal.kernel.KernelRunner.executeOpenCL(KernelRunner.java:1333)
at com.aparapi.internal.kernel.KernelRunner.executeInternalInner(KernelRunner.java:1880)
at com.aparapi.internal.kernel.KernelRunner.executeInternalOuter(KernelRunner.java:1471)
at com.aparapi.internal.kernel.KernelRunner.execute(KernelRunner.java:1454)
at com.aparapi.Kernel.execute(Kernel.java:2916)
at com.aparapi.Kernel.execute(Kernel.java:2873)
at com.aparapi.Kernel.execute(Kernel.java:2848)
at com.aparapi.SimpleScalaTest.runKernel(SimpleScalaTest.scala:25)
at com.aparapi.SimpleScalaTest.testKernel(SimpleScalaTest.scala:50)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
out 25, 2023 7:59:33 DA TARDE com.aparapi.internal.kernel.KernelRunner fallBackToNextDevice
```https://git.qoto.org/aparapi/aparapi/-/issues/9disposing compiled unexecuted kernel causes segmentation fault in jvm2021-10-04T07:50:06ZMorgwai Kotarbinskidisposing compiled unexecuted kernel causes segmentation fault in jvm[hs_err_pid15690.log](/uploads/82e3ef914e070d44af82aa1e8148bfd9/hs_err_pid15690.log)
```java
public class AparapiCrashKernel extends Kernel {
double[] input;
@Override
public void run() {
input[getGlobalId()] = getGlobalId();
}
...[hs_err_pid15690.log](/uploads/82e3ef914e070d44af82aa1e8148bfd9/hs_err_pid15690.log)
```java
public class AparapiCrashKernel extends Kernel {
double[] input;
@Override
public void run() {
input[getGlobalId()] = getGlobalId();
}
public static void main(String[] args) throws CompileFailedException {
var kernel = new AparapiCrashKernel();
kernel.compile(kernel.getTargetDevice());
kernel.dispose();
}
}
```
openjdk-11 on ubuntu 18.04, aparapi 3.0.0, intel-opencl-icd-21.36.20889-1~ppa1~bionic1, Iris Plus Graphics 640https://git.qoto.org/aparapi/aparapi/-/issues/8barrier causes random deadlocks in JTP mode for non-tiny ranges2021-10-03T02:42:01ZMorgwai Kotarbinskibarrier causes random deadlocks in JTP mode for non-tiny rangesthe following code:
```java
public static class SumKernel extends Kernel {
double[] a;
double[] b;
double[] c;
public void execute(double[] a, double[] b, double[] c) {
this.a = a;
this.b = b;
this.c = c;
execute(Range.crea...the following code:
```java
public static class SumKernel extends Kernel {
double[] a;
double[] b;
double[] c;
public void execute(double[] a, double[] b, double[] c) {
this.a = a;
this.b = b;
this.c = c;
execute(Range.create(a.length));
}
@Override
public void run() {
int i = getGlobalId();
c[i] = a[i] + b[i];
globalBarrier();
}
};
public static void main(String[] args) throws InterruptedException {
var random = new Random();
int len = 1000_000;
double[] a = new double[len];
double[] b = new double[len];
for (int i = 0; i < len; i++) {
a[i] = random.nextDouble();
b[i] = random.nextDouble();
}
for (int i = 0; i < 20; i++) {
double[] c = new double[len];
var thread = new Thread(() -> {
var kernel = new SumKernel();
kernel.setExecutionMode(EXECUTION_MODE.JTP);
kernel.execute(a, b, c);
kernel.dispose();
});
System.out.println();
System.out.println("starting...");
var start = System.currentTimeMillis();
thread.start();
thread.join(20_000l);
if ( ! thread.isAlive()) {
System.out.println("finished in " + (System.currentTimeMillis() - start));
continue;
}
System.out.println("still running after 20s, interrupting...");
thread.interrupt();
thread.join(2_000l);
if ( ! thread.isAlive()) {
System.out.println("interrupted successful.");
continue;
}
System.out.println("still running after interrupt, stopping...");
thread.stop();
thread.join(1_000l);
if (thread.isAlive()) {
System.out.println("still running after stop.");
} else {
System.out.println("stop successful.");
}
}
}
```
gives me an output similar to the below:
>
> starting...
> WARNING: Aparapi is running on an untested OpenCL platform version: OpenCL 3.0
> finished in 5096
>
> starting...
> finished in 5069
>
> starting...
> finished in 4945
>
> starting...
> still running after 20s, interrupting...
> still running after interrupt, stopping...
> stop successful.
>
> starting...
> finished in 5278
>
> starting...
> still running after 20s, interrupting...
> still running after interrupt, stopping...
> stop successful.
>
> starting...
> finished in 5286
>
> starting...
> finished in 5318
>
> starting...
> finished in 5637
>
> starting...
> finished in 6113
>
> starting...
> finished in 6939
>
> starting...
> finished in 7115
>
> starting...
> finished in 7830
>
> starting...
> finished in 6700
>
> starting...
> finished in 6603
>
> starting...
> finished in 6662
>
> starting...
> still running after 20s, interrupting...
> still running after interrupt, stopping...
> stop successful.
>
> starting...
> finished in 6820
>
> starting...
> finished in 6923
>
> starting...
> finished in 7167
It works perfectly fine on GPU (without `kernel.setExecutionMode(EXECUTION_MODE.JTP);` line) or without the `globalBarrier();` line.
My environment:
aparapi 3.0.0
openJDK 11 (11.0.11+9-0ubuntu2~18.04)
ubuntu 18.04
Intel(R) Core(TM) i7-7560U CPU (2 physical + 2 virtual cores)
during successful runs, all 4 cores are uniformly utilized at about 50%. During deadlock runs, it starts the same: all 4 cores utilized at about 50% for about 5-7 seconds and then CPU usage goes virtually to 0.https://git.qoto.org/aparapi/aparapi/-/issues/7Warnings about unexpected attribute(s)2021-08-15T13:11:14Zme meWarnings about unexpected attribute(s)I am on Win7 Ultimate x64 SP2, with JAVA 64bit jdk1.8.0_181 + jre1.8.0_301, with NVIDIA GeForce GTX 750 and 16GB system DDR, 6-core AMD CPU 3.2 GHz.
When I run Aparapi 3.0.1 from NetBeans 12.4 x64 testing the examples All.java, choosing...I am on Win7 Ultimate x64 SP2, with JAVA 64bit jdk1.8.0_181 + jre1.8.0_301, with NVIDIA GeForce GTX 750 and 16GB system DDR, 6-core AMD CPU 3.2 GHz.
When I run Aparapi 3.0.1 from NetBeans 12.4 x64 testing the examples All.java, choosing option 1 of 39, although all is processed correctly and OK, still I got this warning in NetBeans output window:
```
Select which example to run:
1) Game of Life
2) Mandelbrot
3) Mandlebrot 2D
4) Convolution
5) Convolution (OpenCL)
6) Convolution (pure Java)
7) Blacksholes
8) Squares
9) Multipass swing worker
10) Progress and cancel demo
11) Info
12) Medians
13) MDArray
14) Add
15) Extension - FFT
16) Extension - Histogram
17) Extension - Histogram Ideal
18) Extension - Mandel
19) Extension - Square
20) Configuration - Auto cleanup arrays
21) Configuration - Cleanup arrays
22) Configuration - Configuration
23) Configuration - Custom Configuration
24) Configuration - Legacy Configuration
25) Configuration - Profiling
26) Configuration - Profiling (no binary)
27) Effects
28) Javaone - Game of Life
29) Javaone - Mandlebrot
30) Javaone - NBody
31) NBody
32) NBody - Local
33) NBody - Sequential
34) OOPN Body
35) Map-reduce
36) Correlation Matrix
37) AparapiFractals - Mandelbrot explorer
38) AparapiFractals - soft benchmark
39) AparapiFractals - hard benchmark
Enter your selection, or q/Q to quit: 1
range = global:1966080 local:(derived)256
aug 15, 2021 3:00:13 PM com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = MethodParameters)
aug 15, 2021 3:00:13 PM com.aparapi.internal.model.ClassModel$AttributePool <init>
WARNING: Found unexpected Attribute (name = MethodParameters)
WARNING: Aparapi is running on an untested OpenCL platform version: OpenCL 3.0 CUDA 11.4.56
BUILD SUCCESSFUL (total time: 29 seconds)
```https://git.qoto.org/aparapi/aparapi/-/issues/6Potential mem-leak issue2021-07-22T02:49:12ZFirok DescfintPotential mem-leak issueFor a kerne enabled explicit buffer mamangement, if a field is not referenced in `kernel.run` and detected by Aparapi as a `KernelArg`, re-assigning a new array onto it and calling `kernel.put` would cause mem-leak.
It seems all the arr...For a kerne enabled explicit buffer mamangement, if a field is not referenced in `kernel.run` and detected by Aparapi as a `KernelArg`, re-assigning a new array onto it and calling `kernel.put` would cause mem-leak.
It seems all the array references were stored in `KernelRunner.puts` and cannot be release when calling `kernel.cleanUpArrays`, because they were not regarded as `KernelArg`.
There could be a lot of buffer-field in a kernel, when debugging or tesing things the `kernel.run` method could be changed frequently. If a field was temporarily unused (because related codes were commented out or in some other cases), running the kernel would cause mem-leak then.
I do see the notice in documentation,
> Note that marking a kernel as explicit and failing to request the appropriate transfer is a programmer error.
for the case above, is there a API to manually mark a field as `KernelArg` and make it be releasable? Or we should be more careful to the code changes?https://git.qoto.org/aparapi/aparapi/-/issues/5Java Alternative Algorithm does not work for arbitrary NDRanges #1422021-02-18T15:47:53ZUlrich SchmidtJava Alternative Algorithm does not work for arbitrary NDRanges #142Aparapi "falls back" to a "Java Alternative Algorithm" (JAA) in cases where the Java byte code cannot be translated to OpenCL code. The JAA, however, only works if the local size of the NDRange is explicitly specified, even in those case...Aparapi "falls back" to a "Java Alternative Algorithm" (JAA) in cases where the Java byte code cannot be translated to OpenCL code. The JAA, however, only works if the local size of the NDRange is explicitly specified, even in those cases, where the derived value for the local size is the same as the explicitly specified value. The following example illustrates the problem:
```
public class JAATest {
public static void main(String[] args) {
int[] a = {1, 2, 3, 4, 5, 6, 7};
Range r = Range.create(7);
System.out.println(r); // prints "global:7 local:(derived)7"
new Kernel() {
@Override public void run() {
int i = getGlobalId();
System.out.println(); // induces fallback
a[i] = a[i] * 2;
}
}.execute(r);
System.out.println(java.util.Arrays.toString(a));
}
}
Execution yields the following incorrect output:
[1, 2, 3, 4, 5, 6, 7]
The version with an explicitly specified local size
public class JAATest {
public static void main(String[] args) {
int[] a = {1, 2, 3, 4, 5, 6, 7};
Range r = Range.create(7, 7);
System.out.println(r); // prints "global:7 local:7"
new Kernel() {
@Override public void run() {
int i = getGlobalId();
System.out.println(); // induces fallback
a[i] = a[i] * 2;
}
}.execute(r);
System.out.println(java.util.Arrays.toString(a));
}
}
delivers the correct result:
[2, 4, 6, 8, 10, 12, 14]https://git.qoto.org/aparapi/aparapi/-/issues/4turn off sync of data, keep it in memory2021-07-22T02:57:42ZSergii Belodonturn off sync of data, keep it in memoryHello, i want to implement in-memory storage search.
How to switch off array syncing and keep in memory array a between kernel.execute?
Array should be copied 1 time to gpu
As I understand array a is always syncing when calling execute m...Hello, i want to implement in-memory storage search.
How to switch off array syncing and keep in memory array a between kernel.execute?
Array should be copied 1 time to gpu
As I understand array a is always syncing when calling execute method. it takes additional time.
```
int []a = {5,4,3,2,1};
int l= a.length;
int f = 4;
int []ind={0};
Kernel kernel = new Kernel() {
@Override
public void run() {
for(int i=0;i<l;i++){
if(a[i]==f){
ind[0] = i;
}
}
}
};
Range range = Range.create(1);
kernel.execute(range);
System.out.println("ind is "+ind[0]);
```https://git.qoto.org/aparapi/aparapi/-/issues/2Barriers give inconsistent results on NVIDIA backend.2021-01-05T15:08:45ZJeffrey Phillips Freemanthe@jeffreyfreeman.meBarriers give inconsistent results on NVIDIA backend.Job [#1666](http://git.qoto.org/aparapi/aparapi/-/jobs/1666) failed for 23274e4d7036d0949eb515efdfb6beedf237eb7f:
While the pipelines on AMDGPU, and POCL are both successful for both GPU acceleration and CPU based operation it would see...Job [#1666](http://git.qoto.org/aparapi/aparapi/-/jobs/1666) failed for 23274e4d7036d0949eb515efdfb6beedf237eb7f:
While the pipelines on AMDGPU, and POCL are both successful for both GPU acceleration and CPU based operation it would seem NVIDIA GPU accelerated implementations fail due to inconsistencies in the results for the Varrier Tests. See the link above for an example of the failing job. Interesting enough when run on NVIDIA in CPU mode it does seem to pass the tests, or at the very least the pipeline isnt failing (it is possible the tests dont run on CPU as many of our tests dont).
Below are the specific tests that fail along with the results:
BarrierSupportTest.testBarrier1:83->validate:210 targetArray: arrays first differed at element [0]; expected:<1048575> but was:<1023>
BarrierSupportTest.testBarrier1Explicit:100->validate:210 targetArray: arrays first differed at element [0]; expected:<1048575> but was:<1023>
BarrierSupportTest.testBarrier2:135->validate:210 targetArray: arrays first differed at element [0]; expected:<1048575> but was:<1023>
BarrierSupportTest.testBarrier2Explicit:152->validate:210 targetArray: arrays first differed at element [0]; expected:<1048575> but was:<1023>https://git.qoto.org/aparapi/aparapi/-/issues/1hello cpu run Range length Err2020-10-02T00:08:05Zmaoguoxuhello cpu run Range length Errdemo ok:
```
final float inA[] = new float[1024000]
Range range1 = Range.create(Device.firstCPU(),result.length);
demo err:
final float inA[] = new float[9999999]
```
ps:
1024000 OK. 99999 NO OK
```
after clEnqueueNDRangeKernel, globa...demo ok:
```
final float inA[] = new float[1024000]
Range range1 = Range.create(Device.firstCPU(),result.length);
demo err:
final float inA[] = new float[9999999]
```
ps:
1024000 OK. 99999 NO OK
```
after clEnqueueNDRangeKernel, globalSize[0] = 99999, localSize[0] = 128
!!!!!!! clEnqueueNDRangeKernel() failed invalid work group size
May 16, 2020 11:52:13 AM com.aparapi.internal.kernel.KernelRunner fallBackToNextDevice
警告: Device failed for D1$2, devices={Apple<GPU>|Apple<CPU>|Java Alternative Algorithm|Java Thread Pool}: OpenCL execution seems to have failed (runKernelJNI returned -54)
com.aparapi.internal.exception.AparapiException: OpenCL execution seems to have failed (runKernelJNI returned -54)
at com.aparapi.internal.kernel.KernelRunner.executeOpenCL(KernelRunner.java:1263)
at com.aparapi.internal.kernel.KernelRunner.executeInternalInner(KernelRunner.java:1712)
at com.aparapi.internal.kernel.KernelRunner.executeInternalOuter(KernelRunner.java:1383)
at com.aparapi.internal.kernel.KernelRunner.execute(KernelRunner.java:1374)
at com.aparapi.Kernel.execute(Kernel.java:2897)
at com.aparapi.Kernel.execute(Kernel.java:2854)
at com.aparapi.Kernel.execute(Kernel.java:2794)
at aparapi.D1.main(D1.java:56)
May 16, 2020 11:52:13 AM com.aparapi.internal.kernel.KernelRunner fallBackToNextDevice
```