beehive-lab / TornadoVM

TornadoVM: A practical and efficient heterogeneous programming framework for managed languages
https://www.tornadovm.org
Apache License 2.0
1.17k stars 110 forks source link

[API] Launch an exception when Driver/Devices indexes are not found #355

Closed jjfumero closed 5 months ago

jjfumero commented 5 months ago

Description

This PR improves the driver and device handling in TornadoVM from the user side. When a Driver or Device is requested using the corresponding indexes, the TornadoVM runtime will throw an exception if the driver/device is not present.

Problem description

The main issue was that the exception thrown was generic, and it did not contain information about the problem.

Backend/s tested

This PR has been tested on OSx with the OpenCL backend. However, it should work for any of the backends.

OS tested

Mark the OS where this PR is tested.

Did you check on FPGAs?

If it is applicable, check your changes on FPGAs.

How to test the new patch?

$ make
$ tornado-test -V uk.ac.manchester.tornado.unittests.api.TestDevices
$ make tests