Skip to content

Commit

Permalink
Updated CUDA
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrhm committed Sep 15, 2024
2 parents e438c2a + 5728d67 commit 14745ae
Show file tree
Hide file tree
Showing 49 changed files with 489 additions and 295 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI
on:
pull_request:
branches:
- main
- integration
push:
branches:
- main
jobs:
ci:
name: CI
runs-on: ubuntu-latest
container:
image: umrover1/ros2:latest
# GitHub is silly and requires us to be running as root for their checkout action
# Our docker container exports the user mrover, so we have to specific this explicitly
options: --user root
steps:
- uses: actions/checkout@v4
with:
# lfs: "true"
# This makes sure that $GITHUB_WORKSPACE is the catkin workspace path
path: "src/mrover"
- name: Style Check
run: . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./style.sh
- name: Build
if: github.event.pull_request.draft == false
run: . /opt/ros/humble/setup.sh && . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./build.sh
# - name: Build Without Static Analysis
# if: github.event.pull_request.draft == false && github.event.pull_request.base.ref != 'refs/heads/main'
# run: . /opt/ros/humble/setup.sh && . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./build.sh
# - name: Build With Static Analysis
# if: github.event_name == 'push' && github.event.pull_request.base.ref == 'refs/heads/main'
# run: . /opt/ros/humble/setup.sh && . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./build_ci.sh
# - name: Test
# if: github.event.pull_request.draft == false
# run: . /opt/ros/noetic/setup.sh && . /home/mrover/ros2_ws/src/mrover/venv/bin/activate && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test && rostest mrover integration.test --text
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# ROS2 build directories
/build/
/install/
/log/

__pycache__/
# Common IDE's, ideally this should be in global gitignore per user
.vscode/
.idea/

# clangd cache
.cache/

# IMGUI window layout
imgui.ini

# Python Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.mypy_cache/
*.egg-info/
venv/
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"deps/dawn": true,
"deps": true,
"venv": true,
},
}
47 changes: 29 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.25)
project(mrover VERSION 2025.0.0 LANGUAGES C CXX)
project(mrover VERSION 2025.0.0 LANGUAGES C CXX CUDA)

# Supress ROS CMake warning about Python.
cmake_policy(SET CMP0148 OLD)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand All @@ -9,13 +12,36 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Can be used by VSCode, CLion, VIM, etc.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

option(MROVER_CI "Enable CI options" OFF)
option(MROVER_CLANG_TIDY "Enable static analysis with Clang tidy" ${MROVER_CI})
option(MROVER_WARNINGS_AS_ERRORS "Treat warnings as errors" ${MROVER_CI})

if (APPLE)
# Ensures that homebrew packages are never used over miniforge packages.
set(CMAKE_IGNORE_PATH /opt/homebrew)
# Find mamba python
find_package(PythonLibs REQUIRED)
link_libraries(${PYTHON_LIBRARIES})
# link_libraries()
endif ()

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wno-missing-field-initializers -Wno-deprecated-declarations)

if (MROVER_WARNINGS_AS_ERRORS)
message(STATUS "Treating warnings as errors")
add_compile_options(-Werror)
endif ()

if (NOT APPLE)
# Try to use LLD instead of the system linker (which is usually GNU ld).
# LLD is faster and uses less memory.
# Could look into using mold which should be even faster.
find_program(LLD_PROGRAM lld)
if (LLD_PROGRAM)
message(STATUS "Using lld linker")
add_link_options(-fuse-ld=lld-18)
endif()
endif ()
endif ()

# Ccache is a compiler cache.
Expand All @@ -29,20 +55,6 @@ if (CCACHE_FOUND)
set(CMAKE_CUDA_COMPILER_LAUNCHER ccache)
endif ()

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wno-missing-field-initializers -Wno-deprecated-declarations)

# Try to use LLD instead of the system linker (which is usually GNU ld).
# LLD is faster and uses less memory.
# Could look into using mold which should be even faster.
find_program(LLD_18_FOUND lld-18)
if (LLD_18_FOUND)
message(STATUS "Using lld-18 linker")
add_link_options(-fuse-ld=lld-18)
endif()
endif ()



## Dependencies

Expand Down Expand Up @@ -98,7 +110,7 @@ if (NOT manif_FOUND)
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/manif/include/manif)
set(BUILD_TESTING_OLD ${BUILD_TESTING})
set(BUILD_TESTING OFF)
add_subdirectory(deps/manif SYSTEM)
add_subdirectory(deps/manif EXCLUDE_FROM_ALL SYSTEM)
set(BUILD_TESTING ${BUILD_TESTING_OLD})
add_library(MANIF::manif ALIAS manif)

Expand Down Expand Up @@ -222,7 +234,6 @@ find_package(CUDA QUIET)
find_package(OpenCV REQUIRED)
if(ZED_FOUND AND CUDA_FOUND)
enable_language(CUDA)

# CUDA Compile Options
add_library(cuda_compiler_flags INTERFACE)
target_compile_options(cuda_compiler_flags INTERFACE
Expand Down
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:jammy

# DEBIAN_FRONTEND=noninteractive prevents apt from asking for user input
# software-properties-common is needed for apt-add-repository
# sudo is needed for ansible since it escalates from a normal user to root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install software-properties-common sudo -y
RUN apt-add-repository ppa:ansible/ansible -y && apt-get install -y git git-lfs ansible

RUN useradd --create-home --groups sudo --shell /bin/zsh mrover
# Give mrover user sudo access with no password
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER mrover
RUN mkdir -p /home/mrover/ros2_ws/src/mrover
WORKDIR /home/mrover/ros2_ws/src/mrover
# Defines the APT packages that need to be installed
# rosdep is called from Ansible to install them
ADD --chown=mrover:mrover ./package.xml .
# Defines the Python packages that need to be installed
# pip is called from Ansible to install them
ADD --chown=mrover:mrover ./pyproject.toml ./README.md .
ADD --chown=mrover:mrover ./mrover ./mrover
# Copy over all Ansible files
ADD --chown=mrover:mrover ./ansible ./ansible
ADD --chown=mrover:mrover ./ansible.sh .
ADD --chown=mrover:mrover ./pkg ./pkg
RUN ./ansible.sh ci.yml

USER root
RUN apt-get purge ansible -y && apt-get autoremove -y
# Remove apt cache to free up space in the image
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

USER mrover
ENTRYPOINT [ "/bin/bash" ]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# MRover ROS 2
# MRover ROS 2

Fresh new upgrade of our code from [ROS 1](https://github.com/umrover/mrover-ros) noetic.

![Screenshot from 2024-09-14 12-46-54](https://github.com/user-attachments/assets/eed2667c-7a42-406c-857f-e4a006982525)
22 changes: 7 additions & 15 deletions ansible/roles/build/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Allows us to install Python versions newer than 3.8
# Allows us to install Python versions newer than 3.10
- name: Add Python PPA
become: True
apt_repository:
Expand Down Expand Up @@ -28,7 +28,7 @@
url: https://apt.kitware.com/keys/kitware-archive-latest.asc
keyring: /usr/share/keyrings/kitware-archive-keyring.gpg

# Allows us to install CMake versions newer than 3.16
# Allows us to install CMake versions newer than 3.22
- name: Add CMake APT List
become: True
apt_repository:
Expand Down Expand Up @@ -72,8 +72,9 @@
- unzip
- rsync
- python3-pip
- python3-dev
- python3-venv
- python3-rosdep
- python3-virtualenvwrapper
- clang-18
- clangd-18
- clang-tidy-18
Expand All @@ -82,16 +83,14 @@
- lldb-18
- gcc-13
- g++-13
- python3.10
- python3.10-dev
- python3.10-venv
- lld
- libbullet-dev
- libglfw3-dev
- libx11-xcb-dev
- libnl-3-dev
- libnl-route-3-dev
- libtbb-dev
- libassimp-dev
- libeigen3-dev
- libopencv-dev
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev
Expand All @@ -100,8 +99,7 @@
- ros-humble-ros-base
- ros-humble-rviz2
- ros-humble-xacro
# TODO (ali): why do these need to be installed manually
- libassimp-dev
# TODO (ali): why does this need to be installed manually
- libboost-dev

- name: Install Local APT Packages
Expand Down Expand Up @@ -143,12 +141,6 @@
# - name: Install Bun Packages
# command: ~/.bun/bin/bun install --cwd {{ catkin_workspace }}/src/mrover/src/teleoperation/frontend

# - name: Install Catkin Profiles
# synchronize:
# src: files/profiles
# dest: "{{ catkin_workspace }}/.catkin_tools"
# recursive: true

- name: Set G++ 13 as Default
become: True
alternatives:
Expand Down
Loading

0 comments on commit 14745ae

Please sign in to comment.