TornadoVM icon indicating copy to clipboard operation
TornadoVM copied to clipboard

TornadoVM stuck when excuting the unsupported example

Open TaisZ opened this issue 1 year ago • 1 comments

Describe the bug

Recursion is not supported in TornadoVM. It is expected that TornadoVM should throw some exceptions. However, the problem seems that the execution hangs and it gets stuck. The bug reason may be the same as #240

How To Reproduce

I created the following example: tornado-examples/src/main/java/uk/ac/manchester/tornado/examples/Broken/Recursion.java

package uk.ac.manchester.tornado.examples.Broken;

import uk.ac.manchester.tornado.api.ImmutableTaskGraph;
import uk.ac.manchester.tornado.api.TaskGraph;
import uk.ac.manchester.tornado.api.TornadoExecutionPlan;
import uk.ac.manchester.tornado.api.annotations.Parallel;
import uk.ac.manchester.tornado.api.enums.DataTransferMode;

import java.util.Arrays;

public class Recursion {

    public static void recursion(int a, int b){
        if(a == 0) b += 1;

        for (@Parallel int i = 0; i<a; i++){
            recursion(a-1, b);
        }
    }

    public static void main(String[] args) {
        int a = 3;
        int b = 0;

        TaskGraph taskGraph = new TaskGraph("s0") //
                .transferToDevice(DataTransferMode.FIRST_EXECUTION, a) //
                .task("t0", Recursion::recursion, a, b) //
                .transferToHost(DataTransferMode.EVERY_EXECUTION, b);

        ImmutableTaskGraph immutableTaskGraph = taskGraph.snapshot();
        TornadoExecutionPlan executor = new TornadoExecutionPlan(immutableTaskGraph);
        executor.execute();

    }
}

Output

Run the example by the following command: tornado --fullDebug -m tornado.examples/uk.ac.manchester.tornado.examples.Broken.Recursion

Console output:

WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
Loading DRIVER: uk.ac.manchester.tornado.drivers.opencl.OCLTornadoDriverProvider@2df32bf7
Loading DRIVER: uk.ac.manchester.tornado.drivers.ptx.PTXTornadoDriverProvider@7ac296f6

Computing system setup (please complete the following information):

  • OS: Ubuntu 22.4
  • Driver versions: Nvidia 530.30.02
  • OpenCL versions: 3.0
  • CUDA Driver versions: 12.1.68
  • GPU: RTX 3080
  • TornadoVM commit id: 8fe1d4e9b49f207ebfa05f363cbcd95fc6c90ccf

TaisZ avatar Apr 24 '23 12:04 TaisZ

Thanks for the report. We will investigate this case and let you know.

jjfumero avatar Apr 26 '23 08:04 jjfumero