Skip to content

Commit

Permalink
Add DART_USE_SYSTEM_TRACY option (#1911)
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 authored Jan 31, 2025
1 parent c27069a commit 4d74bf9
Show file tree
Hide file tree
Showing 14 changed files with 669 additions and 1,109 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/cache_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,39 +185,3 @@ jobs:
tags: ${{ env.DOCKER_REPO }}:${{ matrix.image }}-${{ matrix.dart_version }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

# Tracy Profiler
tracy:
name: tracy profiler
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dart_version: [v6.15]
build_min: [ON]
env:
OS_VERSION: tracy
DART_VERSION: ${{ matrix.dart_version }}
steps:
# https://github.com/marketplace/actions/docker-setup-qemu
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/marketplace/actions/docker-setup-buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# https://github.com/marketplace/actions/docker-login
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
file: ./docker/dev/${{ env.DART_VERSION }}/Dockerfile.${{ env.OS_VERSION }}
push: true
tags: ${{ env.DOCKER_REPO }}:${{ env.OS_VERSION }}-${{ env.DART_VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ set(DART_PKG_EXTERNAL_DEPS "assimp, ccd, eigen3, fcl, octomap")
#===============================================================================
# Build options
#===============================================================================
dart_option(DART_VERBOSE "Whether print detailed information in CMake process" OFF)
if(MSVC)
set(DART_RUNTIME_LIBRARY "/MD" CACHE STRING "BaseName chosen by the user at CMake configure time")
set_property(CACHE DART_RUNTIME_LIBRARY PROPERTY STRINGS /MD /MT)
dart_option(DART_MSVC_DEFAULT_OPTIONS "Build DART with default Visual Studio options" OFF)
else()
dart_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
dart_option(DART_BUILD_DARTPY "Build dartpy" OFF)
dart_option(DART_BUILD_GUI_OSG "Build osgDart library" ON)
dart_option(DART_BUILD_PROFILE "Build DART with profiling options" OFF)
dart_option(DART_CODECOV "Turn on codecov support" OFF)
# Warning: DART_ENABLE_SIMD should be ON only when you build DART and the DART
# dependent projects on the same machine. If this option is on, then compile
# option `-march=native` is added to the target `dart` that enables all
Expand All @@ -86,10 +89,6 @@ endif()
# errors.
dart_option(DART_ENABLE_SIMD
"Build DART with all SIMD instructions on the current local machine" OFF)
dart_option(DART_BUILD_GUI_OSG "Build osgDart library" ON)
dart_option(DART_BUILD_DARTPY "Build dartpy" OFF)
dart_option(DART_BUILD_PROFILE "Build DART with profiling options" OFF)
dart_option(DART_CODECOV "Turn on codecov support" OFF)
dart_option(DART_FAST_DEBUG "Add -O1 option for DEBUG mode build" OFF)
# GCC and Clang add ANSI-formatted colors when they detect the output medium is a
# terminal. However, this doesn't work in some cases such as when the makefile is
Expand All @@ -102,6 +101,8 @@ dart_option(DART_USE_SYSTEM_IMGUI "Use system ImGui" OFF)
dart_option(DART_USE_SYSTEM_GOOGLEBENCHMARK "Use system GoogleBenchmark" OFF)
dart_option(DART_USE_SYSTEM_GOOGLETEST "Use system GoogleTest" OFF)
dart_option(DART_USE_SYSTEM_PYBIND11 "Use system pybind11" OFF)
dart_option(DART_USE_SYSTEM_TRACY "Use system Tracy" OFF)
dart_option(DART_VERBOSE "Whether print detailed information in CMake process" OFF)

#===============================================================================
# Print intro
Expand Down
26 changes: 15 additions & 11 deletions cmake/DARTFindDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,22 @@ endif()
#=======================

if(DART_BUILD_PROFILE)
include(FetchContent)
FetchContent_Declare(tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG master # TODO: Change to a fixed version once > 0.10 is released
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(tracy)
if(MSVC)
target_compile_options(TracyClient PRIVATE /W0)
if(DART_USE_SYSTEM_TRACY)
find_package(Tracy CONFIG REQUIRED)
else()
target_compile_options(TracyClient PRIVATE -w)
include(FetchContent)
FetchContent_Declare(tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG v0.11.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(tracy)
if(MSVC)
target_compile_options(TracyClient PRIVATE /W0)
else()
target_compile_options(TracyClient PRIVATE -w)
endif()
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion dart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ if(DART_CODECOV)
endif()

if(DART_BUILD_PROFILE)
target_link_libraries(dart PUBLIC TracyClient)
target_link_libraries(dart PUBLIC Tracy::TracyClient)
endif()

install(FILES dart.hpp DESTINATION include/dart/ COMPONENT headers)
Expand Down
3 changes: 0 additions & 3 deletions dart/common/Profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@

#if DART_BUILD_PROFILE
#include <tracy/Tracy.hpp>
#endif

#if DART_BUILD_PROFILE

#define DART_PROFILE_FRAME FrameMark
#define DART_PROFILE_SCOPED ZoneScoped
Expand Down
3 changes: 2 additions & 1 deletion dart/simulation/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ void World::reset()
//==============================================================================
void World::step(bool _resetCommand)
{
DART_PROFILE_FRAME;

// Integrate velocity for unconstrained skeletons
{
DART_PROFILE_SCOPED_N("World::step - Integrate velocity");
Expand Down Expand Up @@ -202,7 +204,6 @@ void World::step(bool _resetCommand)

mTime += mTimeStep;
mFrame++;
DART_PROFILE_FRAME;
}

//==============================================================================
Expand Down
12 changes: 0 additions & 12 deletions dart/utils/mjcf/detail/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,11 @@ Errors Compiler::read(tinyxml2::XMLElement* element)
const std::string inertiafromgeom
= getAttributeString(element, "inertiafromgeom");
if (inertiafromgeom == "false") {
#if DART_OS_WINDOWS
mInertiaFromGeom = InertiaFromGeom::IFG_FALSE;
#else
mInertiaFromGeom = InertiaFromGeom::FALSE;
#endif
} else if (inertiafromgeom == "true") {
#if DART_OS_WINDOWS
mInertiaFromGeom = InertiaFromGeom::IFG_TRUE;
#else
mInertiaFromGeom = InertiaFromGeom::TRUE;
#endif
} else if (inertiafromgeom == "auto") {
#if DART_OS_WINDOWS
mInertiaFromGeom = InertiaFromGeom::IFG_AUTO;
#else
mInertiaFromGeom = InertiaFromGeom::AUTO;
#endif
} else {
errors.emplace_back(
ErrorCode::ATTRIBUTE_INVALID,
Expand Down
4 changes: 0 additions & 4 deletions dart/utils/mjcf/detail/Compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ class Compiler final
bool mConvexHull{true};
bool mUserThread{true};
bool mFuseStatic{false};
#if DART_OS_WINDOWS
InertiaFromGeom mInertiaFromGeom{InertiaFromGeom::IFG_AUTO};
#else
InertiaFromGeom mInertiaFromGeom{InertiaFromGeom::AUTO};
#endif
Eigen::Vector2i mInertiaGroupRange{Eigen::Vector2i(0, 5)};
};

Expand Down
6 changes: 0 additions & 6 deletions dart/utils/mjcf/detail/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,9 @@ enum class Integrator

enum class InertiaFromGeom
{
#if DART_OS_WINDOWS
IFG_FALSE,
IFG_TRUE,
IFG_AUTO,
#else
FALSE,
TRUE,
AUTO,
#endif
};

enum class CollisionType
Expand Down
32 changes: 0 additions & 32 deletions docker/dev/v6.15/Dockerfile.tracy

This file was deleted.

Loading

0 comments on commit 4d74bf9

Please sign in to comment.