Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some performance tweak #687

Merged
merged 56 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
89911d0
parallel
markaren Oct 6, 2021
613f312
update
markaren Oct 11, 2021
d85fcf2
update
markaren Oct 11, 2021
a8b1c8c
Merge branch 'master' into parallel
markaren Oct 14, 2021
0f678e6
fix indent
markaren Nov 11, 2021
998e252
add linux dependency
markaren Nov 11, 2021
cb507a5
Using threadpool
markaren Nov 17, 2021
843b318
Fix multi-step test
markaren Nov 17, 2021
3d37ed1
cleanup
markaren Nov 17, 2021
d7c8ce4
Disable utility_concurrency_unittest
markaren Nov 17, 2021
05eb22e
include thread
markaren Nov 17, 2021
d05273e
missing iostream
markaren Nov 18, 2021
2cb7943
refactor
markaren Nov 18, 2021
ef36c3a
Passing thread_count from the ctor. (#680)
davidhjp01 Feb 16, 2022
8e9c1de
Support numWorkerThreads in SSP
markaren Feb 18, 2022
b9860e5
Merge branch 'master' into parallel-pool
markaren Feb 18, 2022
4dd5a0f
add license header
markaren Feb 18, 2022
3e5c74f
state
markaren Feb 18, 2022
566995d
simulator interface have no terminate
markaren Feb 18, 2022
78c2e3f
typo
markaren Feb 20, 2022
11225f2
re-add indeterminate
markaren Feb 20, 2022
dd6a6f8
Some performance tweak
davidhjp01 Mar 2, 2022
3233c79
Some performance tweak - 02
davidhjp01 Mar 4, 2022
bf5f73f
Variable decl
davidhjp01 Mar 4, 2022
fd4a467
Initialze stepFinished to nullptr
davidhjp01 Mar 17, 2022
583074b
Removed unused functions
davidhjp01 Mar 17, 2022
92017f0
noexcept destructor
markaren Mar 21, 2022
ad48f7b
limit thread creation
markaren Mar 21, 2022
00279a0
disable copy and move
markaren Mar 21, 2022
8e1e2a0
Refactor submit
markaren Mar 21, 2022
53a78e1
std::move task
markaren Mar 21, 2022
1bfc80a
pool was not parallelized?
markaren Mar 21, 2022
478267d
thread_pool update (#691)
davidhjp01 Mar 22, 2022
ea319b6
thread pool suggestions commit
restenb Mar 22, 2022
69f1eb8
Cleaned up
davidhjp01 Mar 22, 2022
2a60015
unlock before notify as pr. documentation
restenb Mar 23, 2022
fac95fc
possible fix to possible deadlock problem
restenb Mar 23, 2022
a99fd55
unfix, wait(..) addresses this problem
restenb Mar 23, 2022
87d7309
another unlock()
restenb Mar 23, 2022
0704d4a
no need for the default, set via std::min under
restenb Mar 23, 2022
af315e2
protect done_ here as well
restenb Mar 23, 2022
84a4090
gut feeling; we don't need to do this
restenb Mar 23, 2022
5f7c204
Includes concurrency unit tests
Mar 28, 2022
29fa322
sleeping a bit longer
Mar 28, 2022
226e0da
slight refactoring to max_threads_ variable
restenb Mar 30, 2022
b1a23d4
Update const
davidhjp01 Mar 30, 2022
261daa8
Merge branch 'master' into parallel-pool
markaren Mar 30, 2022
3a1a697
clang-format
markaren Mar 30, 2022
46ca0c3
undo const reference
markaren Mar 30, 2022
61a1b7a
Small typo
markaren Mar 30, 2022
8a1d584
Merge branch 'parallel-pool' into parallel-pool-opt
davidhjp01 Mar 30, 2022
1d6a86c
Undo const reference pt2
markaren Mar 30, 2022
cadb7ad
Merge branch 'parallel-pool' into parallel-pool-opt
davidhjp01 Mar 30, 2022
f6116bc
merge artifact (?)
markaren Mar 30, 2022
81c5557
Merge branch 'parallel-pool' into parallel-pool-opt
davidhjp01 Mar 30, 2022
5b95080
Merge branch 'master' into parallel-pool-opt
davidhjp01 Mar 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if(LIBCOSIM_USING_CONAN)
endif()
endif()

set(Boost_components date_time fiber log)
set(Boost_components date_time log)
if (LIBCOSIM_BUILD_TESTS)
list(APPEND Boost_components timer unit_test_framework)
endif()
Expand Down
4 changes: 2 additions & 2 deletions docs/main_page.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ By far, the easiest way to set up an execution is to first create a
`cosim::system_structure`, as described above, and inject this structure
into an empty `cosim::execution` using `cosim::inject_system_structure()`.
However, it is also possible to build the execution "by hand" by adding
simulators and functions to it in the form of `cosim::async_slave` and
simulators and functions to it in the form of `cosim::slave` and
`cosim::function` objects, respectively.

When would you choose which method? Starting with `cosim::system_structure`
Expand Down Expand Up @@ -156,7 +156,7 @@ completeness and ease of reference:
* `cosim::algorithm` – to implement alternative co-simulation algorithms
* `cosim::observer` – to implement your own observers
* `cosim::manipulator` – to implement your own manipulators
* `cosim::model`, `cosim::async_slave` and `cosim::slave` – to implement
* `cosim::model` and `cosim::slave` – to implement
simulators that don't necessarily come in the form of FMUs
* `cosim::function_type` and `cosim::function` – to implement additional
function types
Expand Down
5 changes: 4 additions & 1 deletion include/cosim/algorithm/fixed_step_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ class fixed_step_algorithm : public algorithm
*
* \param baseStepSize
* The base communication interval length.
*
* \param workerThreadCount
* A number of worker threads to spawn for running FMUs
*/
explicit fixed_step_algorithm(duration baseStepSize);
explicit fixed_step_algorithm(duration baseStepSize, std::optional<unsigned int> workerThreadCount = std::nullopt);

~fixed_step_algorithm() noexcept;

Expand Down
18 changes: 4 additions & 14 deletions include/cosim/algorithm/simulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <cosim/model_description.hpp>
#include <cosim/time.hpp>

#include <boost/fiber/future.hpp>

#include <functional>
#include <optional>
#include <string_view>
Expand All @@ -29,14 +27,6 @@ namespace cosim
*
* This is the simulator interface exposed to `algorithm` implementers,
* and is used to control one "sub-simulator" in a co-simulation.
*
* Some of the functions in this class, specifically the ones that return a
* `boost::fibers::future` object, are asynchronous. Only one asynchronous
* operation may be executed per `simulator` object at any given time,
* meaning that client code must *always* ensure that the previous operation
* has completed before starting a new one. This is typically done by calling
* `boost::fibers::future::get()` on the future returned from the previous
* function call.
*/
class simulator : public manipulable
{
Expand Down Expand Up @@ -91,7 +81,7 @@ class simulator : public manipulable
* solver doesn't use error estimation, it will just ignore this
* parameter.
*/
virtual boost::fibers::future<void> setup(
virtual void setup(
time_point startTime,
std::optional<time_point> stopTime,
std::optional<double> relativeTolerance) = 0;
Expand All @@ -118,7 +108,7 @@ class simulator : public manipulable
* propagate initial values between simulators and/or bring the system
* to a steady state.
*/
virtual boost::fibers::future<void> do_iteration() = 0;
virtual void do_iteration() = 0;

/**
* Signals to the simulator that the initialization phase is complete
Expand All @@ -127,7 +117,7 @@ class simulator : public manipulable
* This function must be called at the end of the initialisation phase,
* after any call to `do_iteration()` and before the first `do_step()` call.
*/
virtual boost::fibers::future<void> start_simulation() = 0;
virtual void start_simulation() = 0;

/**
* Performs a single time step.
Expand All @@ -140,7 +130,7 @@ class simulator : public manipulable
* \param deltaT
* The length of the time step. Must be positive.
*/
virtual boost::fibers::future<step_result> do_step(
virtual step_result do_step(
time_point currentT,
duration deltaT) = 0;
};
Expand Down
Loading