Skip to content

Commit

Permalink
Merge branch 'main' into CURA-10831
Browse files Browse the repository at this point in the history
# Conflicts:
#	conanfile.py
  • Loading branch information
jellespijker committed Dec 1, 2023
2 parents 37bcc9a + 7be00de commit f022528
Show file tree
Hide file tree
Showing 308 changed files with 37,045 additions and 11,855 deletions.
170 changes: 170 additions & 0 deletions .github/workflows/stress_benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Stress Benchmark
on:
push:
paths:
- 'include/**'
- 'src/**'
- 'stress_benchmark/**'
- '.github/workflows/stress_benchmark.yml'
- '.github/workflows/requirements-conan-package.txt'
branches:
- main
tags:
- '[0-9].[0-9].[0-9]*'
pull_request:
types: [ opened, reopened, synchronize ]
paths:
- 'include/**'
- 'src/**'
- 'stress_benchmark/**'
- '.github/workflows/stress_benchmark.yml'
- '.github/workflows/requirements-conan-package.txt'
branches:
- main
- 'CURA-*'
- '[0-9]+.[0-9]+'
tags:
- '[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: write
deployments: write

env:
CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
CONAN_LOG_RUN_TO_OUTPUT: 1
CONAN_LOGGING_LEVEL: info
CONAN_NON_INTERACTIVE: 1

jobs:
check_actor:
runs-on: ubuntu-latest
outputs:
proceed: ${{ steps.skip_check.outputs.proceed }}
steps:
- id: skip_check
run: |
if [[ "${{ github.actor }}" == *"[bot]"* ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.pull_request }}" == "" ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
else
echo "proceed=false" >> $GITHUB_OUTPUT
fi
shell: bash

conan-recipe-version:
needs: [ check_actor ]
if: ${{ needs.check_actor.outputs.proceed == 'true' }}
uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main
with:
project_name: curaengine

benchmark:
needs: [ conan-recipe-version ]
name: Run C++ benchmark
runs-on: ubuntu-22.04
steps:
- name: Checkout CuraEngine
uses: actions/checkout@v3

- name: Setup Python and pip
uses: actions/setup-python@v4
with:
python-version: '3.11.x'
architecture: 'x64'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements-conan-package.txt

- name: Cache Benchmark library
uses: actions/cache@v1
with:
path: ./cache
key: ${{ runner.os }}-stressbenchmark

- name: Install Python requirements and Create default Conan profile
run: |
pip install -r .github/workflows/requirements-conan-package.txt
# NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest.
# This is maybe because grub caches the disk it uses last time, which is recreated each time.
- name: Install Linux system requirements
if: ${{ runner.os == 'Linux' }}
run: |
sudo rm /var/cache/debconf/config.dat
sudo dpkg --configure -a
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt upgrade
sudo apt install build-essential checkinstall libegl-dev zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev pkg-config -y
- name: Install GCC-132 on ubuntu
run: |
sudo apt install g++-13 gcc-13 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
- name: Create the default Conan profile
run: conan profile new default --detect

- name: Get Conan configuration
run: |
conan config install https://github.com/Ultimaker/conan-config.git
conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}"
- name: Use Conan download cache (Bash)
if: ${{ runner.os != 'Windows' }}
run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"

- name: Cache Conan local repository packages (Bash)
uses: actions/cache@v3
if: ${{ runner.os != 'Windows' }}
with:
path: |
$HOME/.conan/data
$HOME/.conan/conan_download_cache
key: conan-${{ runner.os }}-${{ runner.arch }}

- name: Install dependencies
run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_benchmarks=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv

- name: Upload the Dependency package(s)
run: conan upload "*" -r cura --all -c

- name: Set Environment variables from Conan install (bash)
if: ${{ runner.os != 'Windows' }}
run: |
. ./activate_github_actions_runenv.sh
. ./activate_github_actions_buildenv.sh
working-directory: build/Release/generators

- name: Build CuraEngine and tests
run: |
cmake --preset release
cmake --build --preset release
- name: Run Stress Benchmark CuraEngine
id: run-test
run: ./stress_benchmark -o benchmark_result.json
working-directory: build/Release/stress_benchmark

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Stress Benchmark
output-file-path: build/Release/stress_benchmark/benchmark_result.json
gh-repository: github.com/Ultimaker/CuraEngineBenchmarks
gh-pages-branch: main
benchmark-data-dir-path: dev/stress_bench
tool: customSmallerIsBetter
github-token: ${{ secrets.CURA_BENCHMARK_PAT }}
auto-push: true
# alert-threshold: '175%'
# summary-always: true
# comment-on-alert: true
max-items-in-chart: 250
9 changes: 9 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,14 @@ jobs:
files: |
**/*.xml
- name: Upload the detailed tests report
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: LastTest.log
path: |
build/Release/Testing/Temporary/LastTest.log
retention-days: 5

- name: Conclusion
run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}"
22 changes: 12 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AssureOutOfSourceBuilds()

option(ENABLE_ARCUS "Enable support for ARCUS" ON)
option(ENABLE_TESTING "Build with unit tests" OFF)
option(ENABLE_BENCHMARKS "Build with Benchmarks" OFF)
option(EXTENSIVE_WARNINGS "Build with all warnings" ON)
option(ENABLE_PLUGINS "Build with plugins" ON)
option(ENABLE_REMOTE_PLUGINS "Build with all warnings" OFF)
Expand Down Expand Up @@ -130,22 +131,20 @@ set(engine_SRCS # Except main.cpp.
src/utils/ExtrusionJunction.cpp
src/utils/ExtrusionLine.cpp
src/utils/ExtrusionSegment.cpp
src/utils/FMatrix4x3.cpp
src/utils/gettime.cpp
src/utils/LinearAlg2D.cpp
src/utils/ListPolyIt.cpp
src/utils/Matrix4x3D.cpp
src/utils/MinimumSpanningTree.cpp
src/utils/Point3.cpp
src/utils/Point3LL.cpp
src/utils/PolygonConnector.cpp
src/utils/PolygonsPointIndex.cpp
src/utils/PolygonsSegmentIndex.cpp
src/utils/polygonUtils.cpp
src/utils/polygon.cpp
src/utils/PolylineStitcher.cpp
src/utils/ProximityPointLink.cpp
src/utils/Simplify.cpp
src/utils/SVG.cpp
src/utils/socket.cpp
src/utils/SquareGrid.cpp
src/utils/ThreadPool.cpp
src/utils/ToolpathVisualizer.cpp
Expand Down Expand Up @@ -200,7 +199,7 @@ find_package(spdlog REQUIRED)
find_package(fmt REQUIRED)
find_package(range-v3 REQUIRED)
find_package(scripta REQUIRED)
find_package(neargye-semver REQUIRED)
find_package(semver REQUIRED)

if (ENABLE_TESTING)
find_package(GTest REQUIRED)
Expand All @@ -216,7 +215,7 @@ target_link_libraries(_CuraEngine
stb::stb
boost::boost
scripta::scripta
neargye-semver::neargye-semver
semver::semver
curaengine_grpc_definitions::curaengine_grpc_definitions
asio-grpc::asio-grpc
grpc::grpc
Expand Down Expand Up @@ -271,11 +270,14 @@ if (ENABLE_TESTING OR ENABLE_BENCHMARKS)
endif ()
endif ()

if (ENABLE_BENCHMARKS)
add_subdirectory(benchmark)
if (NOT WIN32)
add_subdirectory(stress_benchmark)
endif()
endif ()

if (ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
endif ()

if (ENABLE_BENCHMARKS)
add_subdirectory(benchmark)
endif ()
6 changes: 4 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def export_sources(self):
copy(self, "*", path.join(self.recipe_folder, "src"), path.join(self.export_sources_folder, "src"))
copy(self, "*", path.join(self.recipe_folder, "include"), path.join(self.export_sources_folder, "include"))
copy(self, "*", path.join(self.recipe_folder, "benchmark"), path.join(self.export_sources_folder, "benchmark"))
copy(self, "*", path.join(self.recipe_folder, "stress_benchmark"), path.join(self.export_sources_folder, "stress_benchmark"))
copy(self, "*", path.join(self.recipe_folder, "tests"), path.join(self.export_sources_folder, "tests"))

def config_options(self):
Expand Down Expand Up @@ -79,6 +80,7 @@ def build_requirements(self):
self.test_requires("gtest/1.12.1")
if self.options.enable_benchmarks:
self.test_requires("benchmark/1.7.0")
self.test_requires("docopt.cpp/0.6.3")

def requirements(self):
for req in self.conan_data["requirements"]:
Expand All @@ -92,8 +94,8 @@ def requirements(self):
self.requires("boost/1.82.0")
self.requires("rapidjson/1.1.0")
self.requires("stb/20200203")
self.requires("spdlog/1.10.0")
self.requires("fmt/9.0.0")
self.requires("spdlog/1.12.0")
self.requires("fmt/10.1.1")
self.requires("range-v3/0.12.0")
self.requires("neargye-semver/0.3.0")
self.requires("protobuf/3.21.9")
Expand Down
20 changes: 10 additions & 10 deletions include/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#ifndef APPLICATION_H
#define APPLICATION_H

#include "utils/NoCopy.h"

#include <cassert>
#include <cstddef>
#include <string>

#include "utils/NoCopy.h"


namespace cura
{
Expand Down Expand Up @@ -38,19 +38,21 @@ class Application : NoCopy
* can assume that it is safe to access this without checking whether it is
* initialised.
*/
Communication* communication = nullptr;
Communication* communication_ = nullptr;

/*
* \brief The slice that is currently ongoing.
*
* If no slice has started yet, this will be a nullptr.
*/
Slice* current_slice = nullptr;
Slice* current_slice_ = nullptr;

/*!
* \brief ThreadPool with lifetime tied to Application
*/
ThreadPool* thread_pool = nullptr;
ThreadPool* thread_pool_ = nullptr;

std::string instance_uuid_;

/*!
* Gets the instance of this application class.
Expand Down Expand Up @@ -92,8 +94,6 @@ class Application : NoCopy
*/
void startThreadPool(int nworkers = 0);

std::string instance_uuid;

protected:
#ifdef ARCUS
/*!
Expand All @@ -120,13 +120,13 @@ class Application : NoCopy
/*
* \brief The number of arguments that the application was called with.
*/
size_t argc;
size_t argc_;

/*
* \brief An array of C strings containing the arguments that the
* application was called with.
*/
char** argv;
char** argv_;

/*!
* \brief Constructs a new Application instance.
Expand All @@ -147,4 +147,4 @@ class Application : NoCopy

} // namespace cura

#endif // APPLICATION_H
#endif // APPLICATION_H
Loading

0 comments on commit f022528

Please sign in to comment.