AutoDRIVE-Ecosystem / AutoDRIVE-F1TENTH-Sim-Racing

F1TENTH Autonomous Sim-Racing using AutoDRIVE Ecosystem
https://autodrive-ecosystem.github.io
BSD 2-Clause "Simplified" License
3 stars 4 forks source link

[Feature Request] Dockerfile Support for CPU Only Machine #2

Closed chenyenru closed 2 months ago

chenyenru commented 2 months ago

Hi @Tinker-Twins, thanks for your contribution to the F1Tenth community, I'm really excited to run the simulation.

It would be great to have docker image variant for container that is runnable on machines with integrated graphics card. I've been trying to do so with the following variant of autodrive_simulator.Dockerfile:

####################################################
#
#   AutoDRIVE Simulator Dockerfile
#
####################################################

# Set base image and environment variables

FROM openvino/ubuntu18_runtime

# Add CUDA repository key
RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt-key del 7fa2af80
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub

# Install Debian packages
RUN apt update \
    && apt install -y --no-install-recommends \
        sudo \
        wget \
        gedit \
        nano \
        vim \
        curl \
        unzip \
        net-tools \
        # libvulkan1 \
        # libc++1 \
        # libc++abi1 \
        # vulkan-utils \
    && rm -rf /var/lib/apt/lists/*

# Install tools for display
RUN apt update --fix-missing \
    && apt install -y xvfb ffmpeg libgdal-dev libsm6 libxext6

# Copy AutoDRIVE Simulator executable
COPY autodrive_simulator /home/autodrive_simulator

# Set work directory and register executable
WORKDIR /home/autodrive_simulator
RUN chmod +x /home/autodrive_simulator/AutoDRIVE\ Simulator.x86_64

# Set entrypoint
COPY autodrive_simulator.sh /home/autodrive_simulator
ENTRYPOINT ["/home/autodrive_simulator/autodrive_simulator.sh"]

However, after building the image with the commands in the guide (see below), there was an error about driver not being supported. I tried adding --device=/dev/dri:/dev/dri flag, which should've been enabled through privileged too but the same error was still returned.

Build Command used:

docker build --tag autodriveecosystem/autodrive_f1tenth_sim:v2024.1 -f autodrive_simulator.Dockerfile .

Run command used:

xhost local:root
docker run --name autodrive_f1tenth_sim --rm -it --network=host --ipc=host -v /tmp/.X11-unix:/tmp.X11-umix:rw --env DISPLAY --privileged --gpus all autodriveecosystem/autodrive_f1tenth_sim:v2024.1

Error message:

[UnityMemory] Configuration Parameters - Can be set up in boot.config
    "memorysetup-bucket-allocator-granularity=16"
    "memorysetup-bucket-allocator-bucket-count=8"
    "memorysetup-bucket-allocator-block-size=4194304"
    "memorysetup-bucket-allocator-block-count=1"
    "memorysetup-main-allocator-block-size=16777216"
    "memorysetup-thread-allocator-block-size=16777216"
    "memorysetup-gfx-main-allocator-block-size=16777216"
    "memorysetup-gfx-thread-allocator-block-size=16777216"
    "memorysetup-cache-allocator-block-size=4194304"
    "memorysetup-typetree-allocator-block-size=2097152"
    "memorysetup-profiler-bucket-allocator-granularity=16"
    "memorysetup-profiler-bucket-allocator-bucket-count=8"
    "memorysetup-profiler-bucket-allocator-block-size=4194304"
    "memorysetup-profiler-bucket-allocator-block-count=1"
    "memorysetup-profiler-allocator-block-size=16777216"
    "memorysetup-profiler-editor-allocator-block-size=1048576"
    "memorysetup-temp-allocator-size-main=4194304"
    "memorysetup-job-temp-allocator-block-size=2097152"
    "memorysetup-job-temp-allocator-block-size-background=1048576"
    "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
    "memorysetup-temp-allocator-size-background-worker=32768"
    "memorysetup-temp-allocator-size-job-worker=262144"
    "memorysetup-temp-allocator-size-preload-manager=262144"
    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
    "memorysetup-temp-allocator-size-audio-worker=65536"
    "memorysetup-temp-allocator-size-cloud-worker=32768"
    "memorysetup-temp-allocator-size-gfx=262144"
Driver does not support the 0x46a6 PCI ID.
libGL error: failed to create dri screen
libGL error: failed to load driver: iris
Tinker-Twins commented 2 months ago

Hey @chenyenru,

AutoDRIVE Simulator requires Vulkan graphics API, which is generally supported on dedicated GPUs (tested on NVIDIA GPUs). Do you happen to know any integrated graphics cards that support Vulkan? Also, integrated graphics cards generally have significantly lower V-RAM than a dedicated GPU. So chances are that AutoDRIVE Simulator may not run on an integrated graphics card unless built from source with lower graphics settings and using a generic graphics API such as OpenGL.

If you're facing GPU-related issues within the Docker container, there are three things that you can try:

1. [Initial Testing] Try pulling and running the official AutoDRIVE Simulator Docker Container without building it yourself. If it launches and runs well, you probably have something to look for in your build process.

docker pull autodriveecosystem/autodrive_f1tenth_sim

2. [Preferred Option] You can download the standalone executable of AutoDRIVE Simulator and run it locally (it should be easier to access the GPU this way). You can then run only AutoDRIVE Devkit as a container. Everything else will work just fine, only that the simulator will not be running inside a Docker container. Even if you are planning on participating in the Sim Racing League, this shouldn’t matter, since you will have to submit only the container for your algorithm (i.e. Devkit) and not the Simulator. We will run the containerized simulator on our side for the competition.

3. [Worst-Case Option] You can try to run the simulator in headless mode (this does not require any GPU) by passing the following command-line argument while launching it:

cd /home/autodrive_simulator && ./AutoDRIVE\ Simulator.x86_64 -batchmode -nographics 

This line should replace line 5 in autodrive_simulator.sh.

[!NOTE] Be warned that running the simulator in headless mode will disable all graphics rendering jobs including the camera sensors. You will be able to access camera frames via the API, but they’ll be blank!

Hope this helps.

Thanks and cheers, Tinker Twins

chenyenru commented 2 months ago

Hi @Tinker-Twins ,

First of all, thanks for the really prompt response!

I ran the standalone simulator without placing it in docker container, and it works now.

Could I safely assume that my laptop's integrated GPU supports vulcan?

Tinker-Twins commented 2 months ago

Yes, if everything is running smoothly, your laptop's integrated GPU supports Vulkan.

chenyenru commented 1 month ago

Thanks, I've decided to run it on a laptop with dedicated GPU now

On Tue, Aug 6, 2024 at 7:55 PM Tinker Twins @.***> wrote:

Yes, if everything is running smoothly, your laptop's integrated GPU supports Vulkan.

— Reply to this email directly, view it on GitHub https://github.com/AutoDRIVE-Ecosystem/AutoDRIVE-F1TENTH-Sim-Racing/issues/2#issuecomment-2272519322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKHZ726LQ5EI47FBOENRVF3ZQGEANAVCNFSM6AAAAABLGVRNHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSGUYTSMZSGI . You are receiving this because you were mentioned.Message ID: <AutoDRIVE-Ecosystem/AutoDRIVE-F1TENTH-Sim-Racing/issues/2/2272519322@ github.com>