From 5635f69d3c1b5f88cfbcc952730dec57ff72c126 Mon Sep 17 00:00:00 2001 From: mikepapadim Date: Fri, 7 Jun 2024 10:58:24 +0300 Subject: [PATCH 1/6] Add entry to run unit-test as debug in intellij --- docs/source/ide-integration.rst | 55 ++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/docs/source/ide-integration.rst b/docs/source/ide-integration.rst index 8b7c342a71..8621421362 100644 --- a/docs/source/ide-integration.rst +++ b/docs/source/ide-integration.rst @@ -47,7 +47,7 @@ Run and Debug TornadoVM with Intellij ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Normal maven lifecycle goals like *package* and *install* will not -result a succefull build for TornadoVM. +result a successful build for TornadoVM. Two different configurations are needed for **Build** and **Debug**. @@ -58,8 +58,8 @@ Build/Run Configuration - **In the Project Tab:** - - The Project SDK uses the same java version as the project (e.g. Java 17). - - The Project language level is using the same java version (e.g. Java 17 with Lambdas, type annotations etc.). + - The Project SDK uses the same java version as the project (e.g. Java 21). + - The Project Language Level is using the same java version (e.g. Java 21 (Preview). - **In the Modules Tab:** @@ -115,8 +115,8 @@ Output should be something similar to this: .. code:: bash - /PATH_TO_JDK/jdk1.8.0_131/bin/java - -server -XX:-UseJVMCIClassLoader -XX:-UseCompressedOops -Djava.ext.dirs=/home/michalis/Tornado/tornado/bin/sdk/share/java/tornado -Djava.library.path=/home/michalis/Tornado/tornado/bin/sdk/lib -Dtornado.load.api.implementation=uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph -Dtornado.load.runtime.implementation=uk.ac.manchester.tornado.runtime.TornadoCoreRuntime -Dtornado.load.tornado.implementation=uk.ac.manchester.tornado.runtime.common.Tornado -Dtornado.load.device.implementation.opencl=uk.ac.manchester.tornado.drivers.opencl.runtime.OCLDeviceFactory -Dtornado.load.device.implementation.ptx=uk.ac.manchester.tornado.drivers.ptx.runtime.PTXDeviceFactory + /PATH_TO_JDK/java/current/bin/java + -server -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseCompressedClassPointers --enable-preview -Djava.library.path=... You need to copy from ``-server`` to end. @@ -131,14 +131,55 @@ Then, add your own parameters similar to the following: uk.ac.manchester.tornado.examples.compute.MatrixMultiplication1D - **VM Options:** What you copied from ``-server`` and on - **Working Directory:** ``/home/tornadovm`` -- **JRE:** Default (Should point to the 1.8.0_131) -- **Use classpath of module** Select from drop-down menu e.g +- **Module:** Default (Should point to any supported JDK 21) +- **Use classpath of module (-cp):** Select from drop-down menu e.g ``tornado-examples`` Finally, you can select the new custom configuration by selecting the configuration from the right top drop-down menu. Now, you can run it by pressing the **play button** on the top right corner or **Shift+F10**. +Debug/Run Configuration with a Unit-test +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In case you need to rerun a unit test previously executed via the terminal using the `tornado-test` utility, you will need the following configuration. + +To run and debug Java code through TornadoVM, a custom configuration is required. +This configuration must include the TornadoVM `JAVA_FLAGS` and `CLASSPATHS`. + +Firstly, obtain the JAVA_FLAGS used by TornadoVM by executing the following commands: + +.. code:: bash + + $ make BACKENDS={opencl,ptx,spirv} + $ tornado --printJavaFlags + +Output should be something similar to this: + +.. code:: bash + + /PATH_TO_JDK/java/current/bin/java + -server -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseCompressedClassPointers --enable-preview -Djava.library.path=... + +You need to copy from ``-server`` to end. + +**Now, introduce a new Run Configuration** + +Again, **Run > Edit Configurations > Application > Add new (e.g. plus +sign)** + +Then, add your own parameters similar to the following: + +- **Main Class:** + uk.ac.manchester.tornado.unittests.tools.TornadoTestRunner +- **Parameters** + uk.ac.manchester.tornado.unittests.foundation.TestFloats#testVectorFloatAdd +- **VM Options:** What you copied from ``-server`` and on +- **Working Directory:** ``/home/tornadovm`` +- **Module:** Default (Should point to any JDK21) +- **Use classpath of module (-cp):** Select from drop-down menu e.g + ``tornado-unittests`` + CheckStyle-IDEA Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ First, add the custom checkstyle file to enable its rules go to **IntelliJ > Settings > Tools > CheckStyle** then, From b61380c7df1ab08f25c0bde5b1935f04523b6e33 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 25 Jul 2024 18:24:57 +0300 Subject: [PATCH 2/6] Update docs/source/ide-integration.rst Co-authored-by: Juan Fumero --- docs/source/ide-integration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/ide-integration.rst b/docs/source/ide-integration.rst index 8621421362..64cb8efb66 100644 --- a/docs/source/ide-integration.rst +++ b/docs/source/ide-integration.rst @@ -163,7 +163,7 @@ Output should be something similar to this: You need to copy from ``-server`` to end. -**Now, introduce a new Run Configuration** +**Now, introduce a new Run Configuration within IntelliJ** Again, **Run > Edit Configurations > Application > Add new (e.g. plus sign)** From 97e24c582024d4372d836bb52451d3273d3c2d6a Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 25 Jul 2024 18:25:04 +0300 Subject: [PATCH 3/6] Update docs/source/ide-integration.rst Co-authored-by: Juan Fumero --- docs/source/ide-integration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/ide-integration.rst b/docs/source/ide-integration.rst index 64cb8efb66..23a7e2f81e 100644 --- a/docs/source/ide-integration.rst +++ b/docs/source/ide-integration.rst @@ -165,7 +165,7 @@ You need to copy from ``-server`` to end. **Now, introduce a new Run Configuration within IntelliJ** -Again, **Run > Edit Configurations > Application > Add new (e.g. plus +Select **Run > Edit Configurations > Application > Add new (e.g. plus sign)** Then, add your own parameters similar to the following: From 562e78d7dbc1962931ea4cf530942168a4f8a416 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 25 Jul 2024 18:25:17 +0300 Subject: [PATCH 4/6] Update docs/source/ide-integration.rst Co-authored-by: Juan Fumero --- docs/source/ide-integration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/ide-integration.rst b/docs/source/ide-integration.rst index 23a7e2f81e..63fee5ddc5 100644 --- a/docs/source/ide-integration.rst +++ b/docs/source/ide-integration.rst @@ -145,7 +145,7 @@ Debug/Run Configuration with a Unit-test In case you need to rerun a unit test previously executed via the terminal using the `tornado-test` utility, you will need the following configuration. To run and debug Java code through TornadoVM, a custom configuration is required. -This configuration must include the TornadoVM `JAVA_FLAGS` and `CLASSPATHS`. +This configuration must include the TornadoVM `JAVA_FLAGS` and `CLASSPATH`. Firstly, obtain the JAVA_FLAGS used by TornadoVM by executing the following commands: From e7771787eb58e3c07d5a44962a3a8301393df067 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 25 Jul 2024 18:25:54 +0300 Subject: [PATCH 5/6] Update docs/source/ide-integration.rst Co-authored-by: Juan Fumero --- docs/source/ide-integration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/ide-integration.rst b/docs/source/ide-integration.rst index 63fee5ddc5..d2c7555414 100644 --- a/docs/source/ide-integration.rst +++ b/docs/source/ide-integration.rst @@ -161,7 +161,7 @@ Output should be something similar to this: /PATH_TO_JDK/java/current/bin/java -server -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseCompressedClassPointers --enable-preview -Djava.library.path=... -You need to copy from ``-server`` to end. +Copy from ``-server`` option to end. **Now, introduce a new Run Configuration within IntelliJ** From 0a0253201babdacd777b997d8e511682613f065d Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 25 Jul 2024 18:26:00 +0300 Subject: [PATCH 6/6] Update docs/source/ide-integration.rst Co-authored-by: Thanos Stratikopoulos <34061419+stratika@users.noreply.github.com> --- docs/source/ide-integration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/ide-integration.rst b/docs/source/ide-integration.rst index d2c7555414..0ef9db2e67 100644 --- a/docs/source/ide-integration.rst +++ b/docs/source/ide-integration.rst @@ -47,7 +47,7 @@ Run and Debug TornadoVM with Intellij ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Normal maven lifecycle goals like *package* and *install* will not -result a successful build for TornadoVM. +result in a successful build for TornadoVM. Two different configurations are needed for **Build** and **Debug**.