mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Build AutoFlip with GPU and CUDA

Open peternaf opened this issue 3 years ago • 11 comments

Hi Team,

I am trying to figure out how to correctly compile AutoFlip to run using the GPU.

System information

  • Dell Vostro 14, 11th Gen Intel® Core™ i7-1165G7 @ 2.80GHz × 8 , NVIDIA MX330, 32GB RAM, Ubuntu 20.04LTS, Nvidia Driver 470.103.01, CUDA 11.2

  • Compiler version: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

  • Programming Language and version: Python 3.8.10, TensorFlow as extracted by the mediapipe package. The package checks out the latest TF version which is 2.9 - still in development - This is specified in the mediapipe/WORKSPACE file

  • MediaPipe version: v0.8.9

  • Bazel version: 4.2.1

  • OpenCV version (if running on desktop): 3.4 (installed opencv using the mediapipe/setup_opencv.sh script)

Describe the problem: I am trying to build AutoFlip to work with the GPU, was able to build the package but when running it - it doesn't seem to be using the GPU (GPU utilization is 0)

Build command: bazel-4.2.1 build -c opt --config=cuda --spawn_strategy=local --define no_aws_support=true --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 --verbose_failures mediapipe/examples/desktop/autoflip:run_autoflip

Run command: LOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/autoflip/run_autoflip --calculator_graph_config_file=mediapipe/examples/desktop/autoflip/autoflip_graph.pbtxt --input_side_packets=input_video_path=/home/user/dev/mediapipe/life_at_google.mp4,output_video_path=/home/user/dev/mediapipe/life_at_google_out.mp4,aspect_ratio=1:1

^ This is basically the same question as in #2915

peternaf avatar Apr 17 '22 12:04 peternaf

Hi @peternaf, MediaPipe Python package only contains CPU graphs. If you need to run any GPU graphs, see https://github.com/google/mediapipe/issues/1651 (comment).

sureshdagooglecom avatar Apr 18 '22 06:04 sureshdagooglecom

Hi @sureshdagooglecom ,

Thanks for getting back to me.

I am not trying to run the python package (I just added the python installs because the issue template asks for it)

I am trying to run the Autoflip example and have it use the GPU. Any guidance on how to achieve this?

peternaf avatar Apr 18 '22 06:04 peternaf

Hi @peternaf , MEDIAPIPE_DISABLE_GPU = 1 will disable the GPU support. Did you see any error while building Autoflip with GPU ?

sureshdagooglecom avatar Apr 18 '22 07:04 sureshdagooglecom

Hi @sureshdagooglecom

As you can see in the mentioned build command I did not use the MEDIAPIPE_DISABLE_GPU = 1 flag.

The build command mentioned above worked without errors, but when running AutoFlip - I did not see it utilize the GPU

peternaf avatar Apr 18 '22 07:04 peternaf

Hi @peternaf , Could you please share any logs w.r.t above issue.

sureshdagooglecom avatar Apr 19 '22 10:04 sureshdagooglecom

Hi @sureshdagooglecom As mentioned - the code is running and the logs are the regular run logs (exactly the same log I see if I run AutoFlip with GPU mode disabled) and nvidia-smi is showing 0 GPU utilization even though I am compiling and running in GPU mode.

If you run AutoFlip just like it shows in the example website page - you will see the same log messages I see.

So, it is hard for me to understand what exact log you are looking for that could give a clue as to how to solve this.

If logs are required - please point me to exactly what is needed.

peternaf avatar Apr 19 '22 11:04 peternaf

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Apr 26 '22 12:04 google-ml-butler[bot]

Still looking for solution

peternaf avatar Apr 26 '22 13:04 peternaf

Hi @peternaf , 1)When you are trying on CPU graphs ,is it working? 2) GPU for inference or for rendering or both?

sureshdagooglecom avatar May 13 '22 04:05 sureshdagooglecom

Hi @sureshdagooglecom

  1. Yes
  2. For rendering

peternaf avatar May 18 '22 07:05 peternaf

@peternaf Were you able to successfully build AutoFlip with GPU support?

sg1705 avatar Aug 07 '22 00:08 sg1705

@peternaf Were you able to successfully build AutoFlip with GPU support?

Nope :/

peternaf avatar Aug 14 '22 18:08 peternaf

@peternaf did you come up with any solution to fix your problem? I'm issuing the same problem at the moment.

MayerMax avatar Oct 23 '22 21:10 MayerMax

@MayerMax no unfortunately

peternaf avatar Oct 29 '22 17:10 peternaf

Hello @peternaf, We are ending support for these MediaPipe Legacy Solutions, but upgrading the others. However, the libraries, documentation, and source code for all the MediapPipe Legacy Solutions will continue to be available in our GitHub repository and through library distribution services, such as Maven and NPM.

You can continue to use those legacy solutions in your applications if you choose. Though, we would request you to check new MediaPipe solutions which can help you more easily build and customize ML solutions for your applications. These new solutions will provide a superset of capabilities available in the legacy solutions.

kuaashish avatar Mar 24 '23 12:03 kuaashish

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Mar 31 '23 13:03 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Apr 07 '23 14:04 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Apr 07 '23 14:04 google-ml-butler[bot]