Giter Club home page Giter Club logo

apollo_llvm's Introduction

Apollo+LLVM Notes

Download Apollo source code and docker container

  1. Download Apollo 3.0 source code

    wget https://github.com/ApolloAuto/apollo/archive/v3.0.0.tar.gz
    tar xf https://github.com/ApolloAuto/apollo/archive/v3.0.0.tar.gz
  2. Download and start Apollo docker container

    cd apollo-3.0.0/
    bash docker/scripts/dev_start.sh
    bash docker/scripts/dev_into.sh
  3. Enter the docker container to compile Apollo

    bash docker/scripts/dev_into.sh

Compile Apollo using LLVM

(All following commands are assumed to be executed in Apollo dev docker)

  1. Install LLVM

    LLVM 8 (Recommended)

    # LLVM 8
    sudo apt install llvm-8 llvm-8-dev clang-8 libclang-8-dev
    
    # Create soft links
    sudo ln -sf /usr/bin/llvm-config-8 /usr/bin/llvm-config
    sudo ln -sf /usr/bin/llvm-link-8 /usr/bin/llvm-link
  2. Install a customized whole-program-llvm from SRI-CSL

    git clone https://github.com/SRI-CSL/whole-program-llvm.git
    cd whole-program-llvm
    sudo make develop
  3. Copy wllvm directory to /apollo/tools

    cp -r wllvm /apollo/tools
  4. Compile Apollo

    cd /apollo
    mkdir wllvm_bc  # This directory will contain all seperate bitcode files
    bash apollo.sh build --copt=-mavx2 --cxxopt=-mavx2 --copt=-mno-sse3 --crosstool_top=tools/wllvm:toolchain

    Those copt and cxxopt can be removed, if your machine supports the corresponding instruction sets.

  5. Or compile single module (e.g., planning module)

    ## Apollo 3.0
    bazel build --define ARCH=x86_64 --define CAN_CARD=fake_can --cxxopt=-DUSE_ESD_CAN=false --copt=-mavx2 --copt=-mno-sse3 --cxxopt=-DCPU_ONLY --crosstool_top=tools/wllvm:toolchain //modules/planning:planning --compilation_mode=opt
  6. Extract bitcode file (e.g., planning module)

    cd /apollo/bazel-bin/modules/planning
    extract-bc planning
    
    # Check output
    file planning.bc
    llvm-dis planning.bc

Tips

  • !!! Do not use dev_start.sh to start dev docker after rebooting the machine

    For the first time of starting Apollo dev docker, you can use bash docker/scripts/dev_start.sh. However, after rebooting, if you still use dev_start.sh, you will lose all previous modifications within the docker, because the dev docker container will be deleted. Using the following commands can avoid such issue.

    Apollo 3.0

    docker run -it -d --rm --name apollo_localization_volume apolloauto/apollo:localization_volume-x86_64-latest
    docker run -it -d --rm --name apollo_yolo3d_volume apolloauto/apollo:yolo3d_volume-x86_64-latest
    docker run -it -d --rm --name apollo_map_volume-sunnyvale_big_loop apolloauto/apollo:map_volume-sunnyvale_big_loop-latest
    docker run -it -d --rm --name apollo_map_volume-sunnyvale_loop apolloauto/apollo:map_volume-sunnyvale_loop-latest
    
    # Make sure that you can see `apollo_dev` in `docker ps -a` as `EXITED`
    docker start apollo_dev
    
    bash docker/scripts/dev_into.sh
  • May need to delete inconsistent gtest header file

    sudo mv /usr/include/gtest /usr/include/gtest_bak

apollo_llvm's People

Contributors

hongkedavid avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.