-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Examples using tf-lite with gpu (face_detection_gpu) does not compile on jetson nano #305
Comments
Based on:
I think you are still pulling in X11's Status. TFLite GPU's Status is a class, but that's not being recognized. Instead X11's Status (which is an int) is being handled. I don't know what Jetson Nano is, but Mesa is not officially supported from TFLite's point of view. Some plumbing will be required on your end. Can you make sure to block out X11 headers? |
I agree with impjdi, ensuring X11 headers are disabled sounds like the first thing todo. You can try compiling with EGL_NO_X11 |
Thank @mcclanahoochie Unfortunately adding EGL_NO_X11 did not help |
@mcclanahoochie here is a thought -
when executed on x86_64 Ubuntu 18.04 with nvidia 1080T at least compiles with out any issue Jetson is arm64v8 machine that has Ubuntu 18.04 with nvidia embedded gpu. I have checked it has the same mesa egl etc (version wise) installed as on x86_64 machine. Now I tried to trace the bazel build (I am a novice with bazel ... my first experience with bazel with this project itself) and it seems that usage of Now since it arm64v8, by any chance bazel is thinking that it is android and hence including or not including some headers ? Is there is a way to find out (any bazel command) which platform is detected ? |
That is very strange... I have an arm64 linux board (with non-nvidia gpu) running ubuntu 18.04 and can compile the gpu examples (after installing mesa libs) I'm not sure what else would also be trying to define 'Status' .. Also I don't think bazel is confusing ubuntu/android, but there are some extra bazel flags to make things verbose : maybe those verbose logs can point to something |
Thanks @mcclanahoochie Here is the log after adding the suggested options to cmd line
|
Thanks for the log.
We want to be in the EGL_NO_X11 case (hence the bazel defines). As an experiment, try opening that file on your machine and making sure the EGL_NO_X11 case is chosen (either by using '#if 1' or write 'blah' inside that case to see if there are errors compiling). Either way the goal is to not use the X11 headers. |
Thanks @mcclanahoochie Your suggestion worked !! Indeed there is a difference between the eglplatform.h on jetson vs the one that you provided the link to. I inserted the above block resulting in the exclusion of X11 headers and I got the face_detection_gpu compiled. I have yet to test it by running it. Many thanks. Here are some details that are bit strange - A dell laptop running ubuntu 18.04 with Nvidia Quadro# ml @ ml-dell in ~ [14:57:12]
$ sudo dpkg --status libegl1-mesa-dev
Package: libegl1-mesa-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 172
Maintainer: Ubuntu X-SWAT <[email protected]>
Architecture: amd64
Multi-Arch: same
Source: mesa
Version: 19.0.8-0ubuntu0~18.04.3
Depends: mesa-common-dev (= 19.0.8-0ubuntu0~18.04.3), libglvnd-dev, libdrm-dev (>= 2.4.95), libx11-dev, libxext-dev, libxxf86vm-dev, libxdamage-dev, libxfixes-dev, libxcb-glx0-dev, libxcb-dri2-0-dev, libxcb-dri3-dev, libxcb-present-dev, libxcb-sync-dev, libxshmfence-dev, libx11-xcb-dev, libwayland-dev (>= 1.15.0), x11proto-dev
Description: free implementation of the EGL API -- development files
This package contains the development environment required for compiling
programs against EGL native platform graphics interface library.
EGL provides a platform-agnostic mechanism for creating rendering surfaces
for use with other graphics libraries, such as OpenGL|ES.
.
This package provides the development environment for compiling programs
against the EGL library.
Homepage: https://mesa3d.org/
Original-Maintainer: Debian X Strike Force <[email protected]> Content of eglplatform.h#elif defined(__ANDROID__) || defined(ANDROID)
struct ANativeWindow;
struct egl_native_pixmap_t;
typedef struct ANativeWindow* EGLNativeWindowType;
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
typedef void* EGLNativeDisplayType;
#elif defined(USE_OZONE)
typedef intptr_t EGLNativeDisplayType;
typedef intptr_t EGLNativeWindowType;
typedef intptr_t EGLNativePixmapType;
#elif defined(__unix__) || defined(__APPLE__)
#if defined(MESA_EGL_NO_X11_HEADERS)
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType; Important thing to note is that Jetson Nano# ml @ ml-nano1 in ~/Desktop/Dev/third-party/mediapipe on git:master x [14:59:43]
$ sudo dpkg --status libegl1-mesa-dev
Package: libegl1-mesa-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 172
Maintainer: Ubuntu X-SWAT <[email protected]>
Architecture: arm64
Multi-Arch: same
Source: mesa
Version: 19.0.8-0ubuntu0~18.04.3
Depends: mesa-common-dev (= 19.0.8-0ubuntu0~18.04.3), libglvnd-dev, libdrm-dev (>= 2.4.95), libx11-dev, libxext-dev, libxxf86vm-dev, libxdamage-dev, libxfixes-dev, libxcb-glx0-dev, libxcb-dri2-0-dev, libxcb-dri3-dev, libxcb-present-dev, libxcb-sync-dev, libxshmfence-dev, libx11-xcb-dev, libwayland-dev (>= 1.15.0), x11proto-dev
Description: free implementation of the EGL API -- development files
This package contains the development environment required for compiling
programs against EGL native platform graphics interface library.
EGL provides a platform-agnostic mechanism for creating rendering surfaces
for use with other graphics libraries, such as OpenGL|ES.
.
This package provides the development environment for compiling programs
against the EGL library.
Homepage: https://mesa3d.org/
Original-Maintainer: Debian X Strike Force <[email protected]> Content of eglplatform.h#elif defined(USE_OZONE)
typedef intptr_t EGLNativeDisplayType;
typedef intptr_t EGLNativeWindowType;
typedef intptr_t EGLNativePixmapType;
#elif defined(WAYLAND)
#include <wayland-client.h>
typedef struct wl_display *EGLNativeDisplayType;
typedef void *EGLNativePixmapType;
typedef struct wl_egl_window *EGLNativeWindowType;
#elif defined(__unix__) || defined(__APPLE__)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#elif defined(__HAIKU__) and the necessary define is missing !! Now, the version of mesa on jetson and my dell laptop is identical but the eglplatform.h is different. May be this file is autogenerated. I am going to test if the gpu on jetson indeed gets used or not in next 1 hour or so and will inform the results. Regards |
So I ran the stuff and got an error - Command issued to run
The response was -
Now I do not anything about EGL etc as such. I looked at the line that is failing at https://devtalk.nvidia.com/default/topic/1030582/jetson-tx2/egl-without-x11/ Based on this thread I understood that EGL needs the notion of windowing. When I issued the above command, I was using ssh (from my osx). I connected a monitor to jetson nano and issued the command there and it worked !! However, this brings then another aspect as highlighted in the above thread at devtalk.nvidia.com. If one want to use non-X11 windowing system then the configuration would be different. At least this is what I understood. Based on above, would it make sense for mediapipe to let the user (i.e. me in this case) pass the eglConfig or eglContext ? This is necessary because these edge devices will run headless and there will be no X11 windowing etc. Please guide. Regards |
Nice progress! Passing in an eglConfig would require some framework plumbing (you can try modifying gl_context_egl locally for testing directly at least). For external GL contexts, please see this #313 (comment) Maybe some combination of those options works for you |
@ksachdeva I got this to work based on the link you shared. It's actually fairly easy, you simply have to only enable rendering to pixel buffers rather than also to windows. This comes down to removing Using these configuration attributes I got hand tracking to run on GPU on a headless Ubuntu 18.04 machine. For reference: const EGLint config_attr[] = {
// clang-format off
EGL_RENDERABLE_TYPE, gl_version == 3 ? EGL_OPENGL_ES3_BIT_KHR
: EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 16,
EGL_NONE
// clang-format on
};
|
The CPU example is working fine on jetson nano
However, when I try to compile the gpu version of above i.e
I get lot of compilation errors related to EGL from tf-lite. Here is one trace of it.
The text was updated successfully, but these errors were encountered: