Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError: 'long TornadoXPUDevice.allocateObjects(Object[], long, DeviceBufferState[])' #454

Open
RamiManaf opened this issue Jun 18, 2024 · 10 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@RamiManaf
Copy link

Describe the bug

I have installed TornadoVM using a Colab T4 instance, but when I run any hardware accelerated java code, even the tornado-tests, I keep getting

Exception in thread "main" java.lang.NoSuchMethodError: 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.executeAlloc(TornadoVMInterpreter.java:413)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:278)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:901)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.executeInterpreterSingleThreaded(TornadoVM.java:125)
	at [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.execute(TornadoVM.java:112)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.scheduleInner(TornadoTaskGraph.java:877)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1384)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1396)
	at [email protected]/uk.ac.manchester.tornado.api.TaskGraph.execute(TaskGraph.java:777)
	at [email protected]/uk.ac.manchester.tornado.api.ImmutableTaskGraph.execute(ImmutableTaskGraph.java:49)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.lambda$execute$0(TornadoExecutionPlan.java:406)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.execute(TornadoExecutionPlan.java:406)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan.execute(TornadoExecutionPlan.java:117)

How To Reproduce

This is the colab code

!sudo apt-get install gcc g++ cmake
!git clone https://github.com/beehive-lab/TornadoVM.git
%cd ./TornadoVM
!sudo ./bin/tornadovm-installer --jdk jdk21 --backend ptx
%cd ..
%env JAVA_HOME=/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/
%env PATH=/usr/bin:/content/TornadoVM/bin/bin:/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/cmake-3.25.2-linux-x86_64/bin:/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/apache-maven-3.9.3/bin:$PATH
%env TORNADO_SDK=/content/TornadoVM/bin/sdk
Click here to see the installation output warnings

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
g++ is already the newest version (4:11.2.0-1ubuntu1).
g++ set to manually installed.
gcc is already the newest version (4:11.2.0-1ubuntu1).
gcc set to manually installed.
cmake is already the newest version (3.22.1-1ubuntu1.22.04.2).
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.

/content/TornadoVM
Collecting wget
  Downloading wget-3.2.zip (10 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: wget
  Building wheel for wget (setup.py) ... done
  Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9656 sha256=0f02fbe00ed0d86471107b0a3ca179c44460b0b937fdec311dead6f4088f7bfb
  Stored in directory: /root/.cache/pip/wheels/8b/f1/7f/5c94f0a7a505ca1c81cd1d9208ae2064675d97582078e6c769
Successfully built wget
Installing collected packages: wget
Successfully installed wget-3.2
Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from -r bin/tornadoDepModules.txt (line 1)) (2.31.0)
Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from -r bin/tornadoDepModules.txt (line 2)) (4.66.4)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from -r bin/tornadoDepModules.txt (line 3)) (2.0.7)
Requirement already satisfied: wget in /usr/local/lib/python3.10/dist-packages (from -r bin/tornadoDepModules.txt (line 4)) (3.2)
Collecting black (from -r bin/tornadoDepModules.txt (line 5))
  Downloading black-24.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 24.0 MB/s eta 0:00:00
Collecting sphinx_rtd_theme (from -r bin/tornadoDepModules.txt (line 6))
  Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 75.9 MB/s eta 0:00:00
Collecting pyinstaller (from -r bin/tornadoDepModules.txt (line 7))
  Downloading pyinstaller-6.8.0-py3-none-manylinux2014_x86_64.whl (683 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 683.2/683.2 kB 54.6 MB/s eta 0:00:00
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->-r bin/tornadoDepModules.txt (line 1)) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->-r bin/tornadoDepModules.txt (line 1)) (3.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->-r bin/tornadoDepModules.txt (line 1)) (2024.6.2)
Requirement already satisfied: click>=8.0.0 in /usr/local/lib/python3.10/dist-packages (from black->-r bin/tornadoDepModules.txt (line 5)) (8.1.7)
Collecting mypy-extensions>=0.4.3 (from black->-r bin/tornadoDepModules.txt (line 5))
  Downloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
Requirement already satisfied: packaging>=22.0 in /usr/local/lib/python3.10/dist-packages (from black->-r bin/tornadoDepModules.txt (line 5)) (24.1)
Collecting pathspec>=0.9.0 (from black->-r bin/tornadoDepModules.txt (line 5))
  Downloading pathspec-0.12.1-py3-none-any.whl (31 kB)
Requirement already satisfied: platformdirs>=2 in /usr/local/lib/python3.10/dist-packages (from black->-r bin/tornadoDepModules.txt (line 5)) (4.2.2)
Requirement already satisfied: tomli>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from black->-r bin/tornadoDepModules.txt (line 5)) (2.0.1)
Requirement already satisfied: typing-extensions>=4.0.1 in /usr/local/lib/python3.10/dist-packages (from black->-r bin/tornadoDepModules.txt (line 5)) (4.12.2)
Requirement already satisfied: sphinx<8,>=5 in /usr/local/lib/python3.10/dist-packages (from sphinx_rtd_theme->-r bin/tornadoDepModules.txt (line 6)) (5.0.2)
Requirement already satisfied: docutils<0.21 in /usr/local/lib/python3.10/dist-packages (from sphinx_rtd_theme->-r bin/tornadoDepModules.txt (line 6)) (0.18.1)
Collecting sphinxcontrib-jquery<5,>=4 (from sphinx_rtd_theme->-r bin/tornadoDepModules.txt (line 6))
  Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.1/121.1 kB 19.2 MB/s eta 0:00:00

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] tornado                                                            [pom]
[INFO] tornado-api                                                        [jar]
[INFO] tornado-runtime                                                    [jar]
[INFO] tornado-matrices                                                   [jar]
[INFO] tornado-drivers                                                    [pom]
[INFO] tornado-drivers-common                                             [jar]
[INFO] tornado-drivers-ptx                                                [jar]
[INFO] tornado-drivers-ptx-jni                                            [jar]
[INFO] tornado-examples                                                   [jar]
[INFO] tornado-benchmarks                                                 [jar]
[INFO] tornado-unittests                                                  [jar]
[INFO] tornado-annotation                                                 [jar]
[INFO] tornado-assembly                                                   [pom]
[INFO] 
[INFO] Using the MultiThreadedBuilder implementation with a thread count of 3
[INFO] 
[INFO] --------------------------< tornado:tornado >---------------------------
[INFO] Building tornado 1.0.6-dev                                        [1/13]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- buildnumber:1.4:create (default) @ tornado ---
[INFO] ShortRevision tag detected. The value is '7'.
[INFO] Executing: /bin/sh -c cd '/content/TornadoVM' && 'git' 'rev-parse' '--verify' '--short=7' 'HEAD'
[INFO] Working directory: /content/TornadoVM
[INFO] Storing buildNumber: 27d5a82 at timestamp: 1718721132221
[INFO] Storing buildScmBranch: master
[INFO] 
[INFO] --- shade:3.2.1:shade (default) @ tornado ---
[INFO] Including org.openjdk.jmh:jmh-core:jar:1.29 in the shaded jar.
[INFO] Including net.sf.jopt-simple:jopt-simple:jar:4.6 in the shaded jar.
[INFO] Including org.apache.commons:commons-math3:jar:3.2 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-api:jar:2.17.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-core:jar:2.17.1 in the shaded jar.
[INFO] Including org.graalvm.polyglot:polyglot:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:nativeimage:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:word:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:collections:jar:23.1.0 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/target/jmhbenchmarks.pom with /content/TornadoVM/target/tornado-1.0.6-dev-shaded.pom
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado ---
[INFO] Installing /content/TornadoVM/pom.xml to /root/.m2/repository/tornado/tornado/1.0.6-dev/tornado-1.0.6-dev.pom
[INFO] 
[INFO] ------------------------< tornado:tornado-api >-------------------------
[INFO] Building tornado-api 1.0.6-dev                                    [2/13]
[INFO]   from tornado-api/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- buildnumber:1.4:create (default) @ tornado-api ---
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ tornado-api ---
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-api/src/main/resources
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ tornado-api ---
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 181 source files with javac [debug deprecation target 21] to target/classes
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.runtime
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] /content/TornadoVM/tornado-api/src/main/java/uk/ac/manchester/tornado/api/profiler/ChromeEventJSonWriter.java:[39,60] [deprecation] getId() in Thread has been deprecated
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ tornado-api ---
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-api/src/test/resources
[INFO] 
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ tornado-api ---
[INFO] No sources to compile
[INFO] 
[INFO] --- surefire:3.1.2:test (default-test) @ tornado-api ---
[INFO] No tests to run.
[INFO] 
[INFO] --- jar:3.1.2:jar (default-jar) @ tornado-api ---
[INFO] Building jar: /content/TornadoVM/tornado-api/target/tornado-api-1.0.6-dev-27d5a82.jar
[INFO] 
[INFO] --- shade:3.2.1:shade (default) @ tornado-api ---
[INFO] Including org.openjdk.jmh:jmh-core:jar:1.29 in the shaded jar.
[INFO] Including net.sf.jopt-simple:jopt-simple:jar:4.6 in the shaded jar.
[INFO] Including org.apache.commons:commons-math3:jar:3.2 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-api:jar:2.17.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-core:jar:2.17.1 in the shaded jar.
[INFO] Including org.graalvm.polyglot:polyglot:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:nativeimage:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:word:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:collections:jar:23.1.0 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-api/target/jmhbenchmarks.jar with /content/TornadoVM/tornado-api/target/tornado-api-1.0.6-dev-shaded.jar
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado-api ---
[INFO] Installing /content/TornadoVM/tornado-api/pom.xml to /root/.m2/repository/tornado/tornado-api/1.0.6-dev/tornado-api-1.0.6-dev.pom
[INFO] Installing /content/TornadoVM/tornado-api/target/tornado-api-1.0.6-dev-27d5a82.jar to /root/.m2/repository/tornado/tornado-api/1.0.6-dev/tornado-api-1.0.6-dev.jar
[INFO] 
[INFO] ----------------------< tornado:tornado-matrices >----------------------
[INFO] 
[INFO] Building tornado-matrices 1.0.6-dev                               [3/13]
[INFO] 
[INFO]   from tornado-matrices/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ---------------------< tornado:tornado-unittests >----------------------
[INFO] Building tornado-unittests 1.0.6-dev                              [4/13]
[INFO]   from tornado-unittests/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ----------------------< tornado:tornado-runtime >-----------------------
[INFO] Building tornado-runtime 1.0.6-dev                                [5/13]
[INFO]   from tornado-runtime/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- buildnumber:1.4:create (default) @ tornado-runtime ---
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ tornado-runtime ---
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-runtime/src/main/resources
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ tornado-runtime ---
[INFO] 
[INFO] --- buildnumber:1.4:create (default) @ tornado-unittests ---
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ tornado-unittests ---
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-unittests/src/main/resources
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ tornado-unittests ---
[WARNING] *********************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [commons-math3-3.2.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 170 source files with javac [debug deprecation target 21 module-path] to target/classes
[INFO] 
[INFO] --- buildnumber:1.4:create (default) @ tornado-matrices ---
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ tornado-matrices ---
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-matrices/src/main/resources
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ tornado-matrices ---
[WARNING] *********************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [lucene-core-8.2.0.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 114 source files with javac [debug deprecation target 21 module-path] to target/classes
[WARNING] ****************************************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [ejml-simple-0.38.jar, ejml-core-0.38.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] ****************************************************************************************************************************************************************
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 5 source files with javac [debug deprecation target 21 module-path] to target/classes
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.runtime
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] /content/TornadoVM/tornado-matrices/src/main/java/module-info.java:[21,28] requires transitive directive for an automatic module
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-matrices/target/jmhbenchmarks.jar with /content/TornadoVM/tornado-matrices/target/tornado-matrices-1.0.6-dev-shaded.jar
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] /content/TornadoVM/tornado-runtime/src/main/java/uk/ac/manchester/tornado/runtime/tasks/TornadoTaskGraph.java:[1666,52] [deprecation] getId() in Thread has been deprecated
[WARNING] /content/TornadoVM/tornado-runtime/src/main/java/uk/ac/manchester/tornado/runtime/tasks/TornadoTaskGraph.java:[1701,117] [deprecation] getId() in Thread has been deprecated
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.runtime
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] ***********************************************************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [ejml-simple-0.38.jar, ejml-core-0.38.jar, jmh-core-1.29.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] ***********************************************************************************************************************************************************************************
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] *********************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [commons-math3-3.2.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.runtime
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/module-info.java:[2,24] requires transitive directive for an automatic module
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/vectortypes/TestFloats.java:[467,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/vectortypes/TestFloats.java:[494,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/tensors/TestTensorAPIWithOnnx.java:[114,18] [deprecation] URL(String) in URL has been deprecated
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/matrices/TestMatrices.java:[531,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/matrices/TestMatrices.java:[712,68] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/matrices/TestMatrices.java:[714,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/matrices/TestMatrices.java:[756,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/loops/TestLoops.java:[677,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] /content/TornadoVM/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/loops/TestLoops.java:[722,66] non-varargs call of varargs method with inexact argument type for last parameter;
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] *********************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [commons-math3-3.2.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.runtime
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] *****************************************************************
[WARNING] * Your build is requesting parallel execution, but this         *
[WARNING] * project contains the following plugin(s) that have goals not  *
[WARNING] * marked as thread-safe to support parallel execution.          *
[WARNING] * While this /may/ work fine, please look for plugin updates    *
[WARNING] * and/or request plugins be made thread-safe.                   *
[WARNING] * If reporting an issue, report it against the plugin in        *
[WARNING] * question, not against Apache Maven.                           *
[WARNING] *****************************************************************
[WARNING] The following plugins are not marked as thread-safe in tornado-drivers-ptx-jni:
[WARNING]   com.googlecode.cmake-maven-project:cmake-maven-plugin:3.26.3-b1
[WARNING] 
[WARNING] Enable debug to see precisely which goals are not marked as thread-safe.
[WARNING] *****************************************************************
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found JNI: /content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include  found components: AWT JVM 
-- Found CUDAToolkit: /usr/local/cuda/include (found version "12.2.140") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
grep: /proc/device-tree/model: No such file or directory
-- Not building on Jetson Nano
-- Configuring done
-- Generating done
-- Build files have been written to: /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake
[INFO] 
[INFO] --- cmake:3.26.3-b1:compile (cmake-compile) @ tornado-drivers-ptx-jni ---
[INFO] Executing cmake on PATH
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-benchmarks/target/jmhbenchmarks.jar with /content/TornadoVM/tornado-benchmarks/target/tornado-benchmarks-1.0.6-dev-shaded.jar
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado-benchmarks ---
[INFO] Installing /content/TornadoVM/tornado-benchmarks/pom.xml to /root/.m2/repository/tornado/tornado-benchmarks/1.0.6-dev/tornado-benchmarks-1.0.6-dev.pom
[INFO] Installing /content/TornadoVM/tornado-benchmarks/target/tornado-benchmarks-1.0.6-dev-27d5a82.jar to /root/.m2/repository/tornado/tornado-benchmarks/1.0.6-dev/tornado-benchmarks-1.0.6-dev.jar
[INFO] 
[INFO] --------------------< tornado:tornado-drivers-ptx >---------------------
[INFO] Building tornado-drivers-ptx 1.0.6-dev                           [12/13]
[INFO]   from tornado-drivers/ptx/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- buildnumber:1.4:create (default) @ tornado-drivers-ptx ---
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ tornado-drivers-ptx ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ tornado-drivers-ptx ---
[WARNING] *********************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [commons-math3-3.2.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] /content/TornadoVM/tornado-drivers/ptx/src/main/java/uk/ac/manchester/tornado/drivers/ptx/graal/phases/TornadoTaskSpecialisation.java:[105,18] [deprecation] isAccessible() in AccessibleObject has been deprecated
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ tornado-drivers-ptx ---
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-drivers/ptx/src/test/resources
[INFO] 
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ tornado-drivers-ptx ---
[INFO] No sources to compile
[INFO] 
[INFO] --- surefire:3.1.2:test (default-test) @ tornado-drivers-ptx ---
[INFO] No tests to run.
[INFO] 
[INFO] --- jar:3.1.2:jar (default-jar) @ tornado-drivers-ptx ---
[INFO] Building jar: /content/TornadoVM/tornado-drivers/ptx/target/tornado-drivers-ptx-1.0.6-dev-27d5a82.jar
[INFO] 
[INFO] --- shade:3.2.1:shade (default) @ tornado-drivers-ptx ---
[INFO] Including tornado:tornado-api:jar:1.0.6-dev in the shaded jar.
[INFO] Including tornado:tornado-drivers-common:jar:1.0.6-dev in the shaded jar.
[INFO] Including tornado:tornado-runtime:jar:1.0.6-dev in the shaded jar.
[INFO] Including org.openjdk.jmh:jmh-core:jar:1.29 in the shaded jar.
[INFO] Including net.sf.jopt-simple:jopt-simple:jar:4.6 in the shaded jar.
[INFO] Including org.apache.commons:commons-math3:jar:3.2 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-api:jar:2.17.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-core:jar:2.17.1 in the shaded jar.
[INFO] Including org.graalvm.polyglot:polyglot:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:nativeimage:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:word:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:collections:jar:23.1.0 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[ 70%] Building CXX object CMakeFiles/tornado-ptx.dir/source/PTX.cpp.o
/usr/bin/c++ -DNVML_IS_SUPPORTED -Dtornado_ptx_EXPORTS -I/content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/sources/source -I/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include -I/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include/linux -I/usr/local/cuda/include -O2 -fpermissive -fPIC -export-dynamic -O3 -DNDEBUG -fPIC    -O2 -fpermissive -fPIC -export-dynamic -MD -MT CMakeFiles/tornado-ptx.dir/source/PTX.cpp.o -MF CMakeFiles/tornado-ptx.dir/source/PTX.cpp.o.d -o CMakeFiles/tornado-ptx.dir/source/PTX.cpp.o -c /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/sources/source/PTX.cpp
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[ 80%] Building CXX object CMakeFiles/tornado-ptx.dir/source/PTXNvidiaPowerMetric.cpp.o
/usr/bin/c++ -DNVML_IS_SUPPORTED -Dtornado_ptx_EXPORTS -I/content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/sources/source -I/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include -I/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include/linux -I/usr/local/cuda/include -O2 -fpermissive -fPIC -export-dynamic -O3 -DNDEBUG -fPIC    -O2 -fpermissive -fPIC -export-dynamic -MD -MT CMakeFiles/tornado-ptx.dir/source/PTXNvidiaPowerMetric.cpp.o -MF CMakeFiles/tornado-ptx.dir/source/PTXNvidiaPowerMetric.cpp.o.d -o CMakeFiles/tornado-ptx.dir/source/PTXNvidiaPowerMetric.cpp.o -c /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/sources/source/PTXNvidiaPowerMetric.cpp
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-drivers/ptx/target/jmhbenchmarks.jar with /content/TornadoVM/tornado-drivers/ptx/target/tornado-drivers-ptx-1.0.6-dev-shaded.jar
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado-drivers-ptx ---
[INFO] Installing /content/TornadoVM/tornado-drivers/ptx/pom.xml to /root/.m2/repository/tornado/tornado-drivers-ptx/1.0.6-dev/tornado-drivers-ptx-1.0.6-dev.pom
[INFO] Installing /content/TornadoVM/tornado-drivers/ptx/target/tornado-drivers-ptx-1.0.6-dev-27d5a82.jar to /root/.m2/repository/tornado/tornado-drivers-ptx/1.0.6-dev/tornado-drivers-ptx-1.0.6-dev.jar
[ 90%] Building CXX object CMakeFiles/tornado-ptx.dir/source/ptx_utils.cpp.o
/usr/bin/c++ -DNVML_IS_SUPPORTED -Dtornado_ptx_EXPORTS -I/content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/sources/source -I/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include -I/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/jdk-21.0.3/include/linux -I/usr/local/cuda/include -O2 -fpermissive -fPIC -export-dynamic -O3 -DNDEBUG -fPIC    -O2 -fpermissive -fPIC -export-dynamic -MD -MT CMakeFiles/tornado-ptx.dir/source/ptx_utils.cpp.o -MF CMakeFiles/tornado-ptx.dir/source/ptx_utils.cpp.o.d -o CMakeFiles/tornado-ptx.dir/source/ptx_utils.cpp.o -c /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/sources/source/ptx_utils.cpp
[100%] Linking CXX shared library libtornado-ptx.so
/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/cmake-3.25.2-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/tornado-ptx.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC  -O2 -fpermissive -fPIC -export-dynamic -O3 -DNDEBUG -shared -Wl,-soname,libtornado-ptx.so -o libtornado-ptx.so "CMakeFiles/tornado-ptx.dir/source/PTXPlatform.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTXContext.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTXModule.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTXStream.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTXDevice.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTXEvent.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTX.cpp.o" "CMakeFiles/tornado-ptx.dir/source/PTXNvidiaPowerMetric.cpp.o" "CMakeFiles/tornado-ptx.dir/source/ptx_utils.cpp.o"  -L/usr/local/cuda/lib64/stubs -lcuda -lnvidia-ml 
gmake[3]: Leaving directory '/content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake'
[100%] Built target tornado-ptx
gmake[2]: Leaving directory '/content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake'
/content/TornadoVM/etc/dependencies/TornadoVM-jdk21/cmake-3.25.2-linux-x86_64/bin/cmake -E cmake_progress_start /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake/CMakeFiles 0
gmake[1]: Leaving directory '/content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake'
[INFO] 
[INFO] --- resources:3.0.2:copy-resources (copy-binaries) @ tornado-drivers-ptx-jni ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake/build
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/cmake/Release
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ tornado-drivers-ptx-jni ---
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 1 source file with javac [debug deprecation target 21] to target/linux-amd64-release/classes
[WARNING] [options] --add-opens has no effect at compile time
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] [options] module name in --add-exports option not found: tornado.runtime
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.common
[WARNING] [options] module name in --add-exports option not found: tornado.annotation
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.opencl
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.ptx
[WARNING] [options] module name in --add-exports option not found: tornado.drivers.spirv
[WARNING] using incubating module(s): jdk.incubator.vector
[WARNING] using incubating module(s): jdk.incubator.vector
[INFO] 
[INFO] --- resources:3.0.2:testResources (default-testResources) @ tornado-drivers-ptx-jni ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /content/TornadoVM/tornado-drivers/ptx-jni/src/test/resources
[INFO] 
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ tornado-drivers-ptx-jni ---
[INFO] No sources to compile
[INFO] 
[INFO] --- surefire:3.1.2:test (default-test) @ tornado-drivers-ptx-jni ---
[INFO] No tests to run.
[INFO] 
[INFO] --- jar:3.0.2:jar (default-jar) @ tornado-drivers-ptx-jni ---
[INFO] 
[INFO] --- jar:3.0.2:jar (default) @ tornado-drivers-ptx-jni ---
[INFO] Building jar: /content/TornadoVM/tornado-drivers/ptx-jni/target/tornado-drivers-ptx-jni-1.0.6-dev-27d5a82-libs.jar
[INFO] 
[INFO] --- shade:3.2.1:shade (default) @ tornado-drivers-ptx-jni ---
[INFO] Including tornado:tornado-runtime:jar:1.0.6-dev in the shaded jar.
[INFO] Including tornado:tornado-api:jar:1.0.6-dev in the shaded jar.
[INFO] Including org.openjdk.jmh:jmh-core:jar:1.29 in the shaded jar.
[INFO] Including net.sf.jopt-simple:jopt-simple:jar:4.6 in the shaded jar.
[INFO] Including org.apache.commons:commons-math3:jar:3.2 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-api:jar:2.17.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-core:jar:2.17.1 in the shaded jar.
[INFO] Including org.graalvm.polyglot:polyglot:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:nativeimage:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:word:jar:23.1.0 in the shaded jar.
[INFO] Including org.graalvm.sdk:collections:jar:23.1.0 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/jmhbenchmarks.jar with /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/tornado-drivers-ptx-jni-1.0.6-dev-shaded.jar
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado-drivers-ptx-jni ---
[INFO] Installing /content/TornadoVM/tornado-drivers/ptx-jni/pom.xml to /root/.m2/repository/tornado/tornado-drivers-ptx-jni/1.0.6-dev/tornado-drivers-ptx-jni-1.0.6-dev.pom
[INFO] Installing /content/TornadoVM/tornado-drivers/ptx-jni/target/linux-amd64-release/tornado-drivers-ptx-jni-1.0.6-dev-27d5a82.jar to /root/.m2/repository/tornado/tornado-drivers-ptx-jni/1.0.6-dev/tornado-drivers-ptx-jni-1.0.6-dev.jar
[INFO] Installing /content/TornadoVM/tornado-drivers/ptx-jni/target/tornado-drivers-ptx-jni-1.0.6-dev-27d5a82-libs.jar to /root/.m2/repository/tornado/tornado-drivers-ptx-jni/1.0.6-dev/tornado-drivers-ptx-jni-1.0.6-dev-libs.jar
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-unittests/target/jmhbenchmarks.jar with /content/TornadoVM/tornado-unittests/target/tornado-unittests-1.0.6-dev-shaded.jar
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado-unittests ---
[INFO] Installing /content/TornadoVM/tornado-unittests/pom.xml to /root/.m2/repository/tornado/tornado-unittests/1.0.6-dev/tornado-unittests-1.0.6-dev.pom
[INFO] Installing /content/TornadoVM/tornado-unittests/target/tornado-unittests-1.0.6-dev-27d5a82.jar to /root/.m2/repository/tornado/tornado-unittests/1.0.6-dev/tornado-unittests-1.0.6-dev.jar
[INFO] 
[INFO] ----------------------< tornado:tornado-assembly >----------------------
[INFO] Building tornado-assembly 1.0.6-dev                              [13/13]
[INFO]   from tornado-assembly/pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[WARNING]  Parameter 'finalName' is read-only, must not be used in configuration
[INFO] Reading assembly descriptor: assembly.xml
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'tornado:beehive-spirv-toolkit'
o  'tornado:beehive-levelzero-jni'
o  'tornado:tornado-drivers-opencl'
o  'tornado:tornado-drivers-spirv'

[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'tornado:beehive-spirv-toolkit'
o  'tornado:beehive-levelzero-jni'
o  'tornado:tornado-drivers-opencl'
o  'tornado:tornado-drivers-spirv'

[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'tornado:tornado-drivers-opencl-jni:jar:libs'

[INFO] Copying files to /content/TornadoVM/tornado-assembly/../dist/tornado-sdk
[WARNING] Assembly file: /content/TornadoVM/tornado-assembly/../dist/tornado-sdk is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'tornado:beehive-spirv-toolkit'
o  'tornado:beehive-levelzero-jni'
o  'tornado:tornado-drivers-opencl'
o  'tornado:tornado-drivers-spirv'

[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'tornado:beehive-spirv-toolkit'
o  'tornado:beehive-levelzero-jni'
o  'tornado:tornado-drivers-opencl'
o  'tornado:tornado-drivers-spirv'

[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'tornado:tornado-drivers-opencl-jni:jar:libs'

[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing /content/TornadoVM/tornado-assembly/target/jmhbenchmarks.pom with /content/TornadoVM/tornado-assembly/target/tornado-assembly-1.0.6-dev-shaded.pom
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ tornado-assembly ---
[INFO] Installing /content/TornadoVM/tornado-assembly/pom.xml to /root/.m2/repository/tornado/tornado-assembly/1.0.6-dev/tornado-assembly-1.0.6-dev.pom
[INFO] Installing /content/TornadoVM/tornado-assembly/../dist/tornado-sdk.tar.gz to /root/.m2/repository/tornado/tornado-assembly/1.0.6-dev/tornado-assembly-1.0.6-dev.tar.gz
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for tornado 1.0.6-dev:
[INFO] 
[INFO] tornado ............................................ SUCCESS [  6.073 s]
[INFO] tornado-api ........................................ SUCCESS [  9.870 s]
[INFO] tornado-runtime .................................... SUCCESS [ 11.940 s]
[INFO] tornado-matrices ................................... SUCCESS [  8.570 s]
[INFO] tornado-drivers .................................... SUCCESS [  2.010 s]
[INFO] tornado-drivers-common ............................. SUCCESS [  3.250 s]
[INFO] tornado-drivers-ptx ................................ SUCCESS [  9.232 s]
[INFO] tornado-drivers-ptx-jni ............................ SUCCESS [ 18.812 s]
[INFO] tornado-examples ................................... SUCCESS [  6.126 s]
[INFO] tornado-benchmarks ................................. SUCCESS [ 18.652 s]
[INFO] tornado-unittests .................................. SUCCESS [ 49.387 s]
[INFO] tornado-annotation ................................. SUCCESS [  4.030 s]
[INFO] tornado-assembly ................................... SUCCESS [ 53.417 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:59 min (Wall Clock)
[INFO] Finished at: 2024-06-18T14:34:06Z
[INFO] ------------------------------------------------------------------------
Maven build succeeded
###########################################################################
Tornado build success
Updating PATH and TORNADO_SDK to tornado-sdk-1.0.6-dev-27d5a82
Commit  : 27d5a8249
###########################################################################
 ------------------------------------------
        TornadoVM installation done        
 ------------------------------------------
Creating source file ......................
........................................[ok]
 
 
To run TornadoVM, first run `source setvars.sh`
/content

This is the code that I use to run my code

!tornado --debug -jar TestJME-1.0.0-SNAPSHOT-jar-with-dependencies.jar

and this is the result

WARNING: Using incubator modules: jdk.incubator.vector
Jun 18, 2024 3:08:58 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: CUDA: Has 1 devices...
Jun 18, 2024 3:08:58 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: Creating backend for Tesla T4
Jun 18, 2024 3:08:58 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: Building sketch of parallelFriendlyEnergyCalculation
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: auto parallelisation disabled
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 0 -> READ_ONLY

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 1 -> NONE

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 2 -> NONE

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 3 -> READ_ONLY

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 4 -> READ_ONLY

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 5 -> READ_ONLY

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 6 -> READ_ONLY

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 7 -> WRITE_ONLY

Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: assigning Parallel Energy Calculation.Energy Calculation to cuda-0
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: Compiling bytecodes...
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: [TornadoVMBytecodeBuilder]: Skipping deprecated node AllocateNode
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: init an instance of a TornadoVM interpreter...
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: created 256 kernelStackFrame
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: created 12 event lists
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: loading context PTX -- Tesla T4
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: loaded in 0.000029278 s
Jun 18, 2024 3:08:59 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: interpreter for device PTX -- Tesla T4 is ready to go
Exception in thread "main" java.lang.NoSuchMethodError: 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.executeAlloc(TornadoVMInterpreter.java:413)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:278)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:901)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.executeInterpreterSingleThreaded(TornadoVM.java:125)
	at [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.execute(TornadoVM.java:112)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.scheduleInner(TornadoTaskGraph.java:877)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1384)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1396)
	at [email protected]/uk.ac.manchester.tornado.api.TaskGraph.execute(TaskGraph.java:777)
	at [email protected]/uk.ac.manchester.tornado.api.ImmutableTaskGraph.execute(ImmutableTaskGraph.java:49)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.lambda$execute$0(TornadoExecutionPlan.java:406)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.execute(TornadoExecutionPlan.java:406)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan.execute(TornadoExecutionPlan.java:117)

TornadoVM test to validate that it's not from my code

!tornado-test -V

Example of the results

tornado  --jvm "-Xmx6g -Dtornado.recover.bailout=False -Dtornado.unittests.verbose=True "  -m  tornado.unittests/uk.ac.manchester.tornado.unittests.tools.TornadoTestRunner  --params "uk.ac.manchester.tornado.unittests.foundation.TestIntegers"
WARNING: Using incubator modules: jdk.incubator.vector

Test: class uk.ac.manchester.tornado.unittests.foundation.TestIntegers
	Running test: test01                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	Running test: test02                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	Running test: test03                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	Running test: test04                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	Running test: test05                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	Running test: test06                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
	Running test: test07                     ................  [FAILED] 
		\_[REASON] 'long uk.ac.manchester.tornado.runtime.common.TornadoXPUDevice.allocateObjects(java.lang.Object[], long, uk.ac.manchester.tornado.api.memory.DeviceBufferState[])'
Test ran: 7, Failed: 7, Unsupported: 0

Expected behavior

A clear and concise description of what you expected to happen.

Computing system setup (please complete the following information):

The TornadoVM used version was 1.0.5 (last commit 27d5a82)

!tornado --devices

WARNING: Using incubator modules: jdk.incubator.vector

Number of Tornado drivers: 1
Driver: PTX
  Total number of PTX devices  : 1
  Tornado device=0:0  (DEFAULT)
	PTX -- PTX -- Tesla T4
		Global Memory Size: 14.7 GB
		Local Memory Size: 48.0 KB
		Workgroup Dimensions: 3
		Total Number of Block Threads: [2147483647, 65535, 65535]
		Max WorkGroup Configuration: [1024, 1024, 64]
		Device OpenCL C version: N/A
!nvidia-smi

Tue Jun 18 15:59:11 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Tesla T4                       Off | 00000000:00:04.0 Off |                    0 |
| N/A   38C    P8               9W /  70W |      0MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
@jjfumero
Copy link
Member

The error might be related to permissions. You do not need to install TornadoVM as root user.

./bin/tornadovm-installer --jdk jdk21 --backend ptx

Then, you can check you have read permissions for the file libtornado-ptx.so:

ll tornado-drivers/ptx-jni/target/linux-amd64-release/cmake/

-rw-r--r--. 1 juan juan 29536 Jun 19 08:59 CMakeCache.txt
drwxr-xr-x. 1 juan juan   360 Jun 19 08:59 CMakeFiles
-rw-r--r--. 1 juan juan  1753 Jun 19 08:59 cmake_install.cmake
-rwxr-xr-x. 1 juan juan 66456 Jun 19 08:59 libtornado-ptx.so    <<< 
-rw-r--r--. 1 juan juan 13731 Jun 19 08:59 Makefile

@RamiManaf
Copy link
Author

RamiManaf commented Jun 19, 2024

Thanks @jjfumero the tornado tests now run perfectly fine. However, the problem remains with my code.
This is the files permission after removing sudo from the installation command:

total 128
-rw-r--r-- 1 root root 29405 Jun 19 16:36 CMakeCache.txt
drwxr-xr-x 6 root root  4096 Jun 19 16:36 CMakeFiles
-rw-r--r-- 1 root root  1729 Jun 19 16:36 cmake_install.cmake
-rwxr-xr-x 1 root root 71088 Jun 19 16:36 libtornado-ptx.so
-rw-r--r-- 1 root root 13623 Jun 19 16:36 Makefile

and this is my code:

TaskGraph task = new TaskGraph("Parallel Calculation")
                .transferToDevice(DataTransferMode.EVERY_EXECUTION, objects)
                .task("Energy Calculation", SomeClass::parallelFriendlyCalculation, objects, results)
                .transferToHost(DataTransferMode.EVERY_EXECUTION, results);
TornadoExecutionPlan executionPlan = new TornadoExecutionPlan(task.snapshot());
executionPlan.execute();

@RamiManaf RamiManaf closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
@RamiManaf RamiManaf reopened this Jun 19, 2024
@jjfumero
Copy link
Member

Can you describe how you are running your applications?

In general, you have two options:

  1. Use the tornado command line utility.
  2. Run Java with the required parameters for TornadoVM. You can get all flags by using tornado --printJavaFlags.

@RamiManaf
Copy link
Author

RamiManaf commented Jun 20, 2024

@jjfumero I am using tornado command. Now another new exception starts popping up even if I didn't change anything. There must be something wrong with using TornadoVM in Colab. I have created a Colab notebook with the same code to reproduce the issue. Just remember to change the type of the runtime to T4 GPU so the CUDA drivers are available. You can try any jar file with parallel code or you can use an example jar I am using. This is the code for the previous jar

public class TestJME {

    public static void main(String[] args) throws Exception {
        var arr = new int[]{0,1, 2, 3, 4, 5, 6, 7, 8, 9};
        var results = new int[100];
        TaskGraph task = new TaskGraph("Parallel Calculation")
                .transferToDevice(DataTransferMode.EVERY_EXECUTION,arr)
                .task("Energy Calculation", TestJME::parallel,arr, results)
                .transferToHost(DataTransferMode.EVERY_EXECUTION, results);
        TornadoExecutionPlan executionPlan = new TornadoExecutionPlan(task.snapshot());
        long moleculeStartTime = System.nanoTime();
        executionPlan.execute();
        System.out.println("GPU: " + (System.nanoTime() - moleculeStartTime));
        moleculeStartTime = System.nanoTime();
        parallel(arr, results);
        System.out.println("CPU: " + (System.nanoTime() - moleculeStartTime));
    }

    private static void parallel(int[] arr, int[] results) {
        for (@Parallel int i = 0; i < 100; i++) {
            results[i] *= arr[0];
            results[i] *= arr[1];
            results[i] *= arr[2];
            results[i] *= arr[3];
            results[i] *= arr[4];
            results[i] *= arr[5];
            results[i] *= arr[6];
            results[i] *= arr[7];
            results[i] *= arr[8];
            results[i] *= arr[9];
        }
    }
}

@jjfumero
Copy link
Member

What is the exception or error you get? We haven't tried on Google Colab before.

@RamiManaf
Copy link
Author

now it's
Exception in thread "main" java.lang.NoClassDefFoundError: uk/ac/manchester/tornado/api/TornadoSetting
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1105)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:182)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:741)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:665)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at [email protected]/uk.ac.manchester.tornado.runtime.common.TornadoOptions.(TornadoOptions.java:43)
at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.(TornadoTaskGraph.java:140)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:421)
at java.base/java.lang.Class.forName(Class.java:412)
at [email protected]/uk.ac.manchester.tornado.api.runtime.TornadoAPIProvider.loadScheduleRuntime(TornadoAPIProvider.java:36)
at [email protected]/uk.ac.manchester.tornado.api.TaskGraph.(TaskGraph.java:69)
at org.rami.testjme.TestJME.main(TestJME.java:60)
Caused by: java.lang.ClassNotFoundException: uk.ac.manchester.tornado.api.TornadoSetting
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
... 18 more

@jjfumero
Copy link
Member

It looks to me you are trying to use a different version of TornadoVM compared to the one you have installed. That class is recent.

In you pom file, double check you are using 1.0.6-dev

    <dependencies>
        <dependency>
            <groupId>tornado</groupId>
            <artifactId>tornado-api</artifactId>
            <version>1.0.6-dev</version>
        </dependency>
    </dependencies>

@jjfumero jjfumero added the bug Something isn't working label Jun 24, 2024
@jjfumero jjfumero self-assigned this Jun 24, 2024
@jjfumero jjfumero added the question Further information is requested label Jun 24, 2024
@RamiManaf
Copy link
Author

RamiManaf commented Jun 28, 2024

Thanks @jjfumero for the fast response. I really appreciate your help and think that the first two issues are resolved now. I am not sure if I should post this here, but my code now is showing the following exception Unable to compile task Parallel Energy Calculation.Energy Calculation - parallelFriendlyEnergyCalculation The internal error is: [Error During the Task Compilation]

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: CUDA: Has 1 devices...
Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: Creating backend for Tesla T4
Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: Building sketch of parallelFriendlyEnergyCalculation
Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: auto parallelisation disabled
Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 0 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 1 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 2 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 3 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 4 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 5 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 6 -> NONE

Jun 28, 2024 2:37:02 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: access: parameter 7 -> NONE

Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: assigning Parallel Energy Calculation.Energy Calculation to cuda-0
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: Compiling bytecodes...
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: init an instance of a TornadoVM interpreter...
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: created 256 kernelStackFrame
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: created 10 event lists
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: loading context PTX -- Tesla T4
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: loaded in 0.000028542 s
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: interpreter for device PTX -- Tesla T4 is ready to go
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: field: name=numElements, kind=int, offset=16
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: field: name=storage, kind=uk.ac.manchester.tornado.api.types.arrays.DoubleArray, offset=24
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: object: object=0x4d0b276e, class=uk.ac.manchester.tornado.api.types.collections.VectorDouble3
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: object: object=0x4d0b276e @ address 0x7df16325d000
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: field: name=numElements, kind=int, offset=16
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: field: name=storage, kind=uk.ac.manchester.tornado.api.types.arrays.IntArray, offset=24
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: object: object=0x19d76106, class=uk.ac.manchester.tornado.api.types.collections.VectorInt2
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: object: object=0x19d76106 @ address 0x7df163371a00
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: field: name=numElements, kind=int, offset=16
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: field: name=storage, kind=uk.ac.manchester.tornado.api.types.arrays.FloatArray, offset=24
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: object: object=0x3f87780b, class=uk.ac.manchester.tornado.api.types.collections.VectorFloat8
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: object: object=0x3f87780b @ address 0x7df1633d1400
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: writing field: name=numElements, offset=16
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: writing field: name=storage, offset=24
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: fieldBuffer: enqueueWrite* - field=private final uk.ac.manchester.tornado.api.types.arrays.DoubleArray uk.ac.manchester.tornado.api.types.collections.VectorDouble3.storage, parent=0x4d0b276e, child=0x3be369fc
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: writing field: name=numElements, offset=16
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: writing field: name=storage, offset=24
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: fieldBuffer: enqueueWrite* - field=private final uk.ac.manchester.tornado.api.types.arrays.IntArray uk.ac.manchester.tornado.api.types.collections.VectorInt2.storage, parent=0x19d76106, child=0x35744f8
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: writing field: name=numElements, offset=16
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: writing field: name=storage, offset=24
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: fieldBuffer: enqueueWrite* - field=private final uk.ac.manchester.tornado.api.types.arrays.FloatArray uk.ac.manchester.tornado.api.types.collections.VectorFloat8.storage, parent=0x3f87780b, child=0x6fbcc078
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger info
INFO: Compiling sketch parallelFriendlyEnergyCalculation on Tesla T4
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: TaskSpecialisation ran 3 iterations
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: valid graph? true
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: loop nest depth = 1

Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: discovered parallel domain: num domains=1 :{ IntDomain: {offset=0, step=1, length=993}, }

Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: FrameContext.enter()
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: Traversing CFG: 
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: HIRBlock: 0
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: [] = LABEL alignment: 0 numbPhis: 0 label: ?
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: LOAD (dest: v0|U64, address: null) loadOp: ld
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v2|U32 = ASSIGN v0|U32 lhsKind: u32 rhsKind: u32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v3|U32 = ASSIGN v0|U32 lhsKind: u32 rhsKind: u32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v1|U64 = ASSIGN mul.wide v2|U32 v3|U32 lhsKind: u64 rhsKind: u32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v4|S32 = ASSIGN v1|U64 lhsKind: s32 rhsKind: u64
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v5|U32 = ASSIGN v0|U32 lhsKind: u32 rhsKind: u32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v6|U32 = ASSIGN v0|U32 lhsKind: u32 rhsKind: u32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v7|S32 = ASSIGN mad.lo v6|U32 v3|U32 v5|U32 lhsKind: s32 rhsKind: s32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: HIRBlock: 1
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: [] = LABEL alignment: 0 numbPhis: 0 label: ?
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v8|S32 = ASSIGN v7|S32 lhsKind: s32 rhsKind: s32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: LOOPLABEL blockId: 1
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v9|PRED = ASSIGN setp.lt v8|S32 int[993|0x3e1] lhsKind: pred rhsKind: s32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: GUARDED_STMT v9|PRED isNegated: true instruction: BRANCH isConditional: true isLoopEdgeBack: false destination: B1 -> B3
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: HIRBlock: 2
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: [] = LABEL alignment: 0 numbPhis: 0 label: ?
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v10|S32 = ASSIGN add v4|S32 v8|S32 lhsKind: s32 rhsKind: s32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: v8|S32 = ASSIGN v10|S32 lhsKind: s32 rhsKind: s32
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: BRANCH isConditional: false isLoopEdgeBack: true destination: B2 -> B1
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: HIRBlock: 3
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: [] = LABEL alignment: 0 numbPhis: 0 label: ?
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: op: EXPR ret
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger trace
INFO: Finished traversing CFG
	[TornadoVM-PTX-JNI] ERROR : cuModuleLoadData -> Returned: 218
PTX to cubin JIT compilation failed! (218)
PTX JIT compilation failed!
Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger fatal
SEVERE: unable to compile Parallel Energy Calculation.Energy Calculation for device cuda-0

Jun 28, 2024 2:37:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger fatal
SEVERE: exception occurred when compiling parallelFriendlyEnergyCalculation

Unable to compile task Parallel Energy Calculation.Energy Calculation - parallelFriendlyEnergyCalculation
The internal error is: [Error During the Task Compilation] 
Stacktrace: [[email protected]/uk.ac.manchester.tornado.drivers.ptx.runtime.PTXTornadoDevice.compileTask(PTXTornadoDevice.java:201), [email protected]/uk.ac.manchester.tornado.drivers.ptx.runtime.PTXTornadoDevice.installCode(PTXTornadoDevice.java:158), [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.compileTaskFromBytecodeToBinary(TornadoVMInterpreter.java:631), [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:332), [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:872), java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024), java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762), [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.executeInterpreterSingleThreaded(TornadoVM.java:125), [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.execute(TornadoVM.java:112), [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.scheduleInner(TornadoTaskGraph.java:859), [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1366), [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1378), [email protected]/uk.ac.manchester.tornado.api.TaskGraph.execute(TaskGraph.java:777), [email protected]/uk.ac.manchester.tornado.api.ImmutableTaskGraph.execute(ImmutableTaskGraph.java:49), [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.lambda$execute$0(TornadoExecutionPlan.java:406), java.base/java.util.ArrayList.forEach(ArrayList.java:1596), [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.execute(TornadoExecutionPlan.java:406), [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan.execute(TornadoExecutionPlan.java:117), org.jme.forcefield.mmff.MMFF94.calculateEnergy(MMFF94.java:460), org.rami.testjme.TestJME.main(TestJME.java:36)]
	[email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.compileTaskFromBytecodeToBinary(TornadoVMInterpreter.java:639)
	[email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:332)
	[email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:872)
	java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
	java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	[email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.executeInterpreterSingleThreaded(TornadoVM.java:125)
	[email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.execute(TornadoVM.java:112)
	[email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.scheduleInner(TornadoTaskGraph.java:859)
	[email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1366)
	[email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1378)
	[email protected]/uk.ac.manchester.tornado.api.TaskGraph.execute(TaskGraph.java:777)
	[email protected]/uk.ac.manchester.tornado.api.ImmutableTaskGraph.execute(ImmutableTaskGraph.java:49)
	[email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.lambda$execute$0(TornadoExecutionPlan.java:406)
	java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	[email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.execute(TornadoExecutionPlan.java:406)
	[email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan.execute(TornadoExecutionPlan.java:117)
	org.jme.forcefield.mmff.MMFF94.calculateEnergy(MMFF94.java:460)
	org.rami.testjme.TestJME.main(TestJME.java:36)

I have hard time debugging the device code compilation process as the and can't figure what is wrong in my code as the exception is very vague. It would be more convenient if TornadoVM would validate the java code before compiling :

public double[] calculateEnergy(List<IAtomContainer> atomContainers) {
        int atomsNumber = 0;
        int bondsNumber = 0;
        for (IAtomContainer atomContainer : atomContainers) {
            if (!atomContainer.isEmpty()) {
                checkParametersAssigned(atomContainer.getAtom(0));
                atomsNumber += atomContainer.getAtomCount();
                bondsNumber += atomContainer.getBondCount();
            }
        }
        IntArray atoms = new IntArray(atomsNumber);
        IntArray atomTypes = new IntArray(atomsNumber);
        IntArray atomIndex = new IntArray(atomContainers.size());
        IntArray bondIndex = new IntArray(atomContainers.size());
        int[][] adjacentMatrix = new int[atomsNumber][6];
        VectorInt2 bonds = new VectorInt2(bondsNumber);
        VectorDouble3 atomPositions = new VectorDouble3(atomsNumber);
        VectorFloat8 stretchParameters = new VectorFloat8(bondsNumber);
        int currentAtomIndex = 0;
        int currentBondIndex = 0;
        for (int i = 0; i < atomContainers.size(); i++) {
            IAtomContainer atomContainer = atomContainers.get(i);
            int[][] adjacentList = GraphUtil.toAdjList(atomContainer);
            for (int j = 0; j < atomContainer.getAtomCount(); j++) {
                adjacentMatrix[currentAtomIndex + j] = adjacentList[j];
            }
            for (int j = 0; j < atomContainer.getAtomCount(); j++) {
                int atomId = currentAtomIndex + j;
                IAtom atom = atomContainer.getAtom(j);
                atoms.set(atomId, atom.getAtomicNumber());
                atomTypes.set(atomId, atom.getProperty(MMFF94_TYPE));
                atomPositions.set(atomId, new Double3(atom.getPoint3d().x, atom.getPoint3d().y, atom.getPoint3d().z));
            }
            for (int j = 0; j < atomContainer.getBondCount(); j++) {
                IBond bond = atomContainer.getBond(j);
                bonds.set(currentBondIndex + j, new Int2(currentAtomIndex + atomContainer.indexOf(bond.getBegin()), currentAtomIndex + atomContainer.indexOf(bond.getEnd())));
                float[] stretchParameter = bond.getProperty(MMFF94_PARAMETER_STRETCH);
                stretchParameters.set(currentBondIndex + j, new Float8(stretchParameter[0], stretchParameter[1], stretchParameter[2], stretchParameter[3], stretchParameter[4], 0, 0, 0));
            }
            atomIndex.set(i, currentAtomIndex);
            currentAtomIndex += atomContainer.getAtomCount();
            bondIndex.set(i, currentBondIndex);
            currentBondIndex += atomContainer.getBondCount();
        }
        DoubleArray results = new DoubleArray(atomContainers.size());
        TaskGraph task = new TaskGraph("Parallel Energy Calculation")
                .transferToDevice(DataTransferMode.FIRST_EXECUTION, atomIndex, atoms, atomTypes, atomPositions, bondIndex, bonds, stretchParameters)
                .task("Energy Calculation", MMFF94::parallelFriendlyEnergyCalculation, atomIndex, atoms, atomTypes, atomPositions, bondIndex, bonds, stretchParameters, results)
                .transferToHost(DataTransferMode.EVERY_EXECUTION, results);
        TornadoExecutionPlan executionPlan = new TornadoExecutionPlan(task.snapshot());
        long moleculeStartTime = System.nanoTime();
        executionPlan.execute();
        return results.toHeapArray();
}

public static void parallelFriendlyEnergyCalculation(IntArray atomIndex, IntArray atoms, IntArray atomTypes, VectorDouble3 atomPositions, IntArray bondIndex, VectorInt2 bonds, VectorFloat8 stretchParameters, DoubleArray results) {
        double energy = 0;
        double totalStretch = 0;
        double totalVdw = 0;
        double totalElectrostatic = 0;
        double totalAngleBend = 0;
        double totalStretchBend = 0;
        double totalOOP = 0;
        double totalTorsion = 0;
        for (@Parallel int i = 0; i < atomIndex.getSize(); i++) {
            int firstAtom = atomIndex.get(i);
            int lastAtom;
            if (atomIndex.getSize() == (i + 1)) {
                lastAtom = atomIndex.getSize();
            } else {
                lastAtom = atomIndex.get(i + 1);
            }
            //bond stretching
            int firstBond = bondIndex.get(i);
            int lastBond;
            if (bondIndex.getSize() == (i + 1)) {
                lastBond = bondIndex.getSize();
            } else {
                lastBond = bondIndex.get(i + 1);
            }
            for (int j = firstBond; j < lastBond; j++) {
                int iAtom = bonds.get(j).get(0);
                int jAtom = bonds.get(j).get(1);
                double bondStretching = calculateBondStretchingEnergyTornadoVM(atomPositions.get(iAtom), atomPositions.get(jAtom), stretchParameters.get(j));
                results.set(i, bondStretching);
            }
            for (int j = firstAtom; j < lastAtom; j++) {

            }
        }
    }

    private static double calculateBondStretchingEnergyTornadoVM(Double3 p1, Double3 p2, Float8 stretchParameters) {
        double deltaR = distanceTornadoVM(p1, p2) - stretchParameters.get(4);
        return (.5 * 143.9325 * stretchParameters.get(3) * deltaR * deltaR * (1 - 2 * deltaR + (7d / 12d) * 4 * deltaR * deltaR));
    }

    private static double distanceTornadoVM(Double3 p1, Double3 p2) {
        double dx, dy, dz;
        dx = p1.getX() - p2.getX();
        dy = p1.getY() - p2.getY();
        dz = p1.getZ() - p2.getZ();
        return TornadoMath.sqrt(dx * dx + dy * dy + dz * dz);
    }

@jjfumero
Copy link
Member

jjfumero commented Jul 1, 2024

Thanks @RamiManaf for the report. Having a quick look and it seems the code is legal for TornadoVM. The way we debug it is by printing the generated code (in your case is PTX) and validate it with external tools (e.g., compile and print the error trace). We have these tools integrated already in TornadoVM in the --debug mode for OpenCL and Level Zero. It seems that we missed this for the PTX.

@jjfumero
Copy link
Member

jjfumero commented Jul 1, 2024

@mairooni will take a look to improve error messages and validation in this part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants