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

Add documentation to run unit-test through Intellij #445

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 48 additions & 7 deletions docs/source/ide-integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
mikepapadim marked this conversation as resolved.
Show resolved Hide resolved

Two different configurations are needed for **Build** and **Debug**.

Expand All @@ -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).
mikepapadim marked this conversation as resolved.
Show resolved Hide resolved

- **In the Modules Tab:**

Expand Down Expand Up @@ -115,8 +115,8 @@ Output should be something similar to this:

.. code:: bash

/PATH_TO_JDK/jdk1.8.0_131/bin/java
Copy link
Collaborator

@stratika stratika Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 69-71 the right click > create tornadovm [package] does not seem to exist any more. Can we please update also those instructions?

-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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 76-90 please update the cmake version and the jdk-8 profile to match the current version/profiles.

/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.

Expand All @@ -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`.
mikepapadim marked this conversation as resolved.
Show resolved Hide resolved

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.
mikepapadim marked this conversation as resolved.
Show resolved Hide resolved

**Now, introduce a new Run Configuration**
mikepapadim marked this conversation as resolved.
Show resolved Hide resolved

Again, **Run > Edit Configurations > Application > Add new (e.g. plus
mikepapadim marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you main to the end?

- **Working Directory:** ``/home/tornadovm``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be <TORNADO_ROOT>

- **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,
Expand Down