beehive-lab / TornadoVM

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

[fix] Exclude the nvml library in cmake if platform is jetson nano as… #422

Closed stratika closed 4 months ago

stratika commented 4 months ago

Description

This PR aims to fix the execution with PTX backend on NVIDIA Jetson Nano. Since the initial integration with the NVIDIA Management Library (NVML) in the native OpenCL and PTX backends for the monitoring of power usage, we have had the linking of the nvml library as default for when we build with the PTX backend. This was because, it requires the NVIDIA CUDA Toolkit to be installed.

However, we figured it out that for NVIDIA Jetson Nano the nvidia-smi and the nvml capabilities are not supported.

For instance an example is as follows:

tornado --devices
WARNING: Using incubator modules: jdk.incubator.vector

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING:

You should always run with libnvidia-ml.so that is installed with your
NVIDIA Display Driver. By default it's installed in /usr/lib and /usr/lib64.
libnvidia-ml.so in GDK package is a stub library that is attached only for
build purposes (e.g. machine that you build your application doesn't have
to have Display Driver installed).
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[TornadoVM-PTX-NVML-JNI] ERROR : nvmlInit -> Returned: 9

Number of Tornado drivers: 1
Driver: PTX
  Total number of PTX devices  : 1
  Tornado device=0:0  (DEFAULT)
    PTX -- PTX -- NVIDIA Tegra X1
        Global Memory Size: 3.9 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

Therefore this PR provides a patch that will ignore the nvml functions if the platform is Jetson Nano.

Backend/s tested

Mark the backends affected by this PR.

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 BACKEND=ptx
tornado --enableProfiler console -m tornado.examples/uk.ac.manchester.tornado.examples.VectorAddInt --params="100000"

jjfumero commented 4 months ago

I confirm it works on the Jetson nano.

stratika commented 4 months ago

I confirm it works on the Jetson nano.

Thanks, I have also tested it on my Dell laptop that it does not break that setup.