Skip to content

Commit

Permalink
Merge branch 'main' into CURA-11364_add_sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo committed Nov 30, 2023
2 parents 67eb8e0 + 537f1c2 commit 686df6a
Show file tree
Hide file tree
Showing 76 changed files with 24,977 additions and 101 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
16 changes: 10 additions & 6 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 @@ -201,7 +202,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_SENTRY)
find_package(sentry REQUIRED)
Expand All @@ -221,7 +222,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 @@ -282,11 +283,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 ()
2 changes: 2 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,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 @@ -85,6 +86,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):
if self.options.enable_arcus:
Expand Down
2 changes: 1 addition & 1 deletion include/SupportInfillPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SupportInfillPart
// for infill_areas[x][n], x means the density level and n means the thickness
std::vector<VariableWidthLines> wall_toolpaths; //!< Any walls go here, not in the areas, where they could be combined vertically (don't combine walls). Binned by inset_idx.

coord_t custom_line_distance;
coord_t custom_line_distance; //!< The distance between support infill lines. 0 means use the default line distance instead.
bool use_fractional_config; //!< Request to use the configuration used to fill a partial layer height here, instead of the normal full layer height configuration.

SupportInfillPart(const PolygonsPart& outline, coord_t support_line_width, bool use_fractional_config, int inset_count_to_generate = 0, coord_t custom_line_distance = 0);
Expand Down
4 changes: 3 additions & 1 deletion include/sliceDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@ class SupportLayer
* \param wall_line_count Wall-line count around the fill.
* \param grow_layer_above (optional, default to 0) In cases where support shrinks per layer up, an appropriate offset may be nescesary.
* \param unionAll (optional, default to false) Wether to 'union all' for the split into parts bit.
* \param custom_line_distance (optional, default to 0) Distance between lines of the infill pattern. custom_line_distance of 0 means use the default instead.
*/
void fillInfillParts(
const LayerIndex layer_nr,
const std::vector<Polygons>& support_fill_per_layer,
const coord_t support_line_width,
const coord_t wall_line_count,
const coord_t grow_layer_above = 0,
const bool unionAll = false);
const bool unionAll = false,
const coord_t custom_line_distance = 0);
};

class SupportStorage
Expand Down
69 changes: 52 additions & 17 deletions include/utils/SVG.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//Copyright (c) 2022 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
// Copyright (c) 2022 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef SVG_H
#define SVG_H

#include <concepts>
#include <stdio.h> // for file output

#include <boost/polygon/voronoi.hpp>

#include "AABB.h"
#include "ExtrusionLine.h" //To accept variable-width paths.
#include "IntPoint.h"
Expand All @@ -19,7 +22,8 @@ class FPoint3;
class SVG : NoCopy
{
public:
enum class Color {
enum class Color
{
BLACK,
WHITE,
GRAY,
Expand All @@ -40,18 +44,20 @@ class SVG : NoCopy
Color color;
int r, g, b;
ColorObject(Color color)
: is_enum(true)
, color(color)
{}
: is_enum(true)
, color(color)
{
}
ColorObject(int r, int g, int b)
: is_enum(false)
, r(r)
, g(g)
, b(b)
{}
: is_enum(false)
, r(r)
, g(g)
, b(b)
{
}
};
private:

private:
std::string toString(const Color color) const;
std::string toString(const ColorObject& color) const;

Expand Down Expand Up @@ -103,10 +109,10 @@ class SVG : NoCopy

/*!
* \brief Draws a polyline on the canvas.
*
*
* The polyline is the set of line segments between each pair of consecutive
* points in the specified vector.
*
*
* \param polyline A set of points between which line segments must be
* drawn.
* \param color The colour of the line segments. If this is not specified,
Expand All @@ -122,14 +128,14 @@ class SVG : NoCopy

/*!
* \brief Draws a dashed line on the canvas from point A to point B.
*
*
* This is useful in the case where multiple lines may overlap each other.
*
*
* \param a The starting endpoint of the line.
* \param b The ending endpoint of the line.
* \param color The stroke colour of the line.
*/
void writeDashedLine(const Point& a,const Point& b, ColorObject color = Color::BLACK) const;
void writeDashedLine(const Point& a, const Point& b, ColorObject color = Color::BLACK) const;

template<typename... Args>
void printf(const char* txt, Args&&... args) const;
Expand Down Expand Up @@ -188,6 +194,35 @@ class SVG : NoCopy
*/
void writeCoordinateGrid(const coord_t grid_size = MM2INT(1), const Color color = Color::BLACK, const float stroke_width = 0.1, const float font_size = 10) const;

/*!
* Draws the provided Voronoi diagram.
*
* @tparam T numeric type
* @param voronoi The Voronoi diagram to draw.
* @param color The colour to draw the diagram with.
* @param stroke_width The width of the lines.
*/
template<typename T> // Currently our compiler for Mac can't handle `template<std::floating_point T>`, since aparently floating_point isn't in std yet.
void writeVoronoiDiagram(const boost::polygon::voronoi_diagram<T>& voronoi_diagram, const Color color = Color::BLACK, const float stroke_width = 0.1) const
{
for (const auto& edge : voronoi_diagram.edges())
{
if (! edge.is_finite())
{
continue;
}

const auto& v0 = edge.vertex0();
const auto& v1 = edge.vertex1();

if (v0 == nullptr || v1 == nullptr)
{
continue;
}

writeLine(Point(v0->x(), v0->y()), Point(v1->x(), v1->y()), color, stroke_width);
}
}
};

template<typename... Args>
Expand Down
Loading

0 comments on commit 686df6a

Please sign in to comment.