Skip to content

adapt thread affinity to possibly restricted CPU set #62

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

Merged
merged 5 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RcppThread
Title: R-Friendly Threading in C++
Version: 2.0.2
Version: 2.1.0
Authors@R: c(
person("Thomas", "Nagler",, "mail@tnagler.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1855-0046"))
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2021
YEAR: 2022
COPYRIGHT HOLDER: Thomas Nagler
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================

Copyright © 2021 Thomas Nagler.
Copyright © 2022 Thomas Nagler.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# RcppThread 2.1.0

NEW FEATURE

* safe printing to the R error stream with `RcppThread::Rcerr` (#60, thanks to
@appelmar).

BUG FIX

* adapt thread affinity to possibly restricted CPU set (#61).


# RcppThread 2.0.1

BUG FIX
Expand Down
2 changes: 1 addition & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = RcppThread
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.0.0
PROJECT_NUMBER = 2.1.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
1 change: 1 addition & 0 deletions docs/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ <h1>Classes</h1>
<li>class <a href="classRcppThread_1_1ProgressBar.html" class="m-doc">ProgressBar</a> <span class="m-doc">A progress bar showing progress in percent.</span></li>
<li>class <a href="classRcppThread_1_1ProgressCounter.html" class="m-doc">ProgressCounter</a> <span class="m-doc">A counter showing progress in percent.</span></li>
<li>class <a href="classRcppThread_1_1ProgressPrinter.html" class="m-doc">ProgressPrinter</a> <span class="m-doc">Abstract class for printing progress.</span></li>
<li>class <a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a> <span class="m-doc">Safely printing to the R console from threaded code.</span></li>
<li>class <a href="classRcppThread_1_1RMonitor.html" class="m-doc">RMonitor</a> <span class="m-doc">Singleton class for tracking threads and safe communication.</span></li>
<li>class <a href="classRcppThread_1_1RPrinter.html" class="m-doc">RPrinter</a> <span class="m-doc">Safely printing to the R console from threaded code.</span></li>
<li>class <a href="classRcppThread_1_1Thread.html" class="m-doc">Thread</a> <span class="m-doc">R-friendly version of <code>std::thread</code>.</span></li>
Expand Down
190 changes: 190 additions & 0 deletions docs/classRcppThread_1_1RErrPrinter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>RcppThread::RErrPrinter class | RcppThread R-friendly
threading
in
C++</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
<link rel="stylesheet" href="m-dark+documentation.compiled.css" />
<link rel="icon" href="favicon-dark.png" type="image/png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#22272e" />
</head>
<body>
<header><nav id="navigation">
<div class="m-container">
<div class="m-row">
<span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
<a href="https://github.com/tnagler/RcppThread">RcppThread</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">R-friendly
threading
in
C++</a>
</span>
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
<a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
</svg></a>
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
</div>
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
<div class="m-row">
<ol class="m-col-t-6 m-col-m-none">
<li><a href="namespaceRcppThread.html">RcppThread</a></li>
<li><a href="overrides.html">Automatic overrides</a></li>
</ol>
<ol class="m-col-t-6 m-col-m-none" start="3">
<li><a href="https://github.com/tnagler/RcppThread">GitHub</a></li>
<li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<use href="#m-doc-search-icon-path" />
</svg></a></li>
</ol>
</div>
</div>
</div>
</div>
</nav></header>
<main><article>
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<h1>
<span class="m-breadcrumb"><a href="namespaceRcppThread.html">RcppThread</a>::<wbr/></span>RErrPrinter <span class="m-thin">class</span>
</h1>
<p>Safely printing to the R console from threaded code.</p>
<div class="m-block m-default">
<h3>Contents</h3>
<ul>
<li>
Reference
<ul>
<li><a href="#pub-methods">Public functions</a></li>
</ul>
</li>
</ul>
</div>
<section id="pub-methods">
<h2><a href="#pub-methods">Public functions</a></h2>
<dl class="m-doc">
<dt>
<div class="m-doc-template">template&lt;class T&gt;</div>
<span class="m-doc-wrap-bumper">auto <a href="#adeee1773d69206c2e0c806dbc72ce8e1" class="m-doc">operator&lt;&lt;</a>(</span><span class="m-doc-wrap">T&amp; object) -&gt; <a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>&amp;</span>
</dt>
<dd></dd>
<dt>
<div class="m-doc-template">template&lt;class T&gt;</div>
<span class="m-doc-wrap-bumper">auto <a href="#a04842e0c5c9bcb6b13f49623896067e7" class="m-doc">operator&lt;&lt;</a>(</span><span class="m-doc-wrap">const T&amp; object) -&gt; <a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>&amp;</span>
</dt>
<dd></dd>
<dt>
<span class="m-doc-wrap-bumper">auto <a href="#a679a95fb8a26668c8e224cb4467598d8" class="m-doc">operator&lt;&lt;</a>(</span><span class="m-doc-wrap">std::ostream&amp;(*)(std::ostream&amp;) object) -&gt; <a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>&amp;</span>
</dt>
<dd></dd>
</dl>
</section>
<section>
<h2>Function documentation</h2>
<section class="m-doc-details" id="adeee1773d69206c2e0c806dbc72ce8e1"><div>
<h3>
<div class="m-doc-template">
template&lt;class T&gt;
</div>
<span class="m-doc-wrap-bumper"><a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>&amp; RcppThread::<wbr />RErrPrinter::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#adeee1773d69206c2e0c806dbc72ce8e1" class="m-doc-self">operator&lt;&lt;</a>(</span><span class="m-doc-wrap">T&amp; object)</span></span>
</h3>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">object</td>
<td>a string (or coercible object) to print.</td>
</tr>
</tbody>
</table>
<p>prints <code>object</code> to R error stream íf called from main thread; otherwise adds a printable version of <code>object</code> to a buffer for deferred printing.
Declared as a friend in <code>RMonitor</code>.</p>
</div></section>
<section class="m-doc-details" id="a04842e0c5c9bcb6b13f49623896067e7"><div>
<h3>
<div class="m-doc-template">
template&lt;class T&gt;
</div>
<span class="m-doc-wrap-bumper"><a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>&amp; RcppThread::<wbr />RErrPrinter::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#a04842e0c5c9bcb6b13f49623896067e7" class="m-doc-self">operator&lt;&lt;</a>(</span><span class="m-doc-wrap">const T&amp; object)</span></span>
</h3>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">object</td>
<td>a string (or coercible object) to print.</td>
</tr>
</tbody>
</table>
<p>prints <code>object</code> to R error stream íf called from main thread; otherwise adds a printable version of <code>object</code> to a buffer for deferred printing.
Declared as a friend in <code>RMonitor</code>.</p>
</div></section>
<section class="m-doc-details" id="a679a95fb8a26668c8e224cb4467598d8"><div>
<h3>
<span class="m-doc-wrap-bumper"><a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>&amp; RcppThread::<wbr />RErrPrinter::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#a679a95fb8a26668c8e224cb4467598d8" class="m-doc-self">operator&lt;&lt;</a>(</span><span class="m-doc-wrap">std::ostream&amp;(*)(std::ostream&amp;) object)</span></span>
</h3>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">object</td>
<td>a string (or coercible object) to print.</td>
</tr>
</tbody>
</table>
<p>prints <code>object</code> to R error stream íf called from main thread; otherwise adds a printable version of <code>object</code> to a buffer for deferred printing.
Declared as a friend in <code>RMonitor</code>.</p>
</div></section>
</section>
</div>
</div>
</div>
</article></main>
<div class="m-doc-search" id="search">
<a href="#!" onclick="return hideSearch()"></a>
<div class="m-container">
<div class="m-row">
<div class="m-col-m-8 m-push-m-2">
<div class="m-doc-search-header m-text m-small">
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
<div id="search-symbolcount">&hellip;</div>
</div>
<div class="m-doc-search-content">
<form>
<input type="search" name="q" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
</form>
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
<div id="search-help" class="m-text m-dim m-text-center">
<p class="m-noindent">Search for symbols, directories, files, pages, OpenGL, GLSL, Vulkan and OpenAL APIs. You can omit any prefix from the symbol or file path; adding a <code>:</code> or <code>/</code> suffix lists all members of given symbol or directory.</p> <p class="m-noindent">Use <span class="m-label m-dim">&darr;</span> / <span class="m-label m-dim">&uarr;</span> to navigate through the list, <span class="m-label m-dim">Enter</span> to go. <span class="m-label m-dim">Tab</span> autocompletes common prefix, you can copy a link to the result using <span class="m-label m-dim">⌘</span> <span class="m-label m-dim">L</span> while <span class="m-label m-dim">⌘</span> <span class="m-label m-dim">M</span> produces a Markdown link.</p>
</div>
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
</div>
<script src="search-v1.js"></script>
<script src="searchdata-v1.js" async="async"></script>
<footer><nav>
<div class="m-container">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<p>RcppThread docs. copyright © <a href="http://tnagler.com/">Thomas Nagler</a> 2021.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.8.17 and <a href="https://mcss.mosra.cz/">m.css</a>. Contact the author via <a href="https://github.com/tnagler/RcppThread">GitHub</a> or <a href="mailto:mail@tnagler.com">e-mail</a>
</div>
</div>
</div>
</nav></footer>
</body>
</html>
25 changes: 25 additions & 0 deletions docs/classRcppThread_1_1RMonitor.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ <h2><a href="#pro-methods">Protected functions</a></h2>
<span class="m-doc-wrap-bumper">void <a href="#a98b81ed3996a37a51b5cdb8dbed89712" class="m-doc">safelyPrint</a>(</span><span class="m-doc-wrap">const T&amp; object)</span>
</dt>
<dd></dd>
<dt>
<div class="m-doc-template">template&lt;class T&gt;</div>
<span class="m-doc-wrap-bumper">void <a href="#aca4da9d515e3366af9e8185a7d2b866a" class="m-doc">safelyPrintErr</a>(</span><span class="m-doc-wrap">const T&amp; object)</span>
</dt>
<dd></dd>
</dl>
</section>
<section id="friends">
Expand Down Expand Up @@ -172,6 +177,26 @@ <h3>
</tbody>
</table>
<p>prints <code>object</code> to R console íf called from main thread; otherwise adds a printable version of <code>object</code> to a buffer for deferred printing.</p>
</div></section>
<section class="m-doc-details" id="aca4da9d515e3366af9e8185a7d2b866a"><div>
<h3>
<div class="m-doc-template">
template&lt;class T&gt;
</div>
<span class="m-doc-wrap-bumper">void RcppThread::<wbr />RMonitor::<wbr /></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#aca4da9d515e3366af9e8185a7d2b866a" class="m-doc-self">safelyPrintErr</a>(</span><span class="m-doc-wrap">const T&amp; object) <span class="m-label m-warning">protected</span></span></span>
</h3>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">object</td>
<td>a string or coercible object to print.</td>
</tr>
</tbody>
</table>
<p>prints <code>object</code> to R error stream íf called from main thread; otherwise adds a printable version of <code>object</code> to a buffer for deferred printing.</p>
</div></section>
<section class="m-doc-details" id="ad81d4d6402e7bfe7f254b2d5388fb97b"><div>
<h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<h1>
RcppThread: R-friendly threading in C++
</h1>
<aside class="m-note m-default"><h4>Authors</h4><p>Thomas Nagler</p></aside><p>This is the API documentation for the RcppThread C++ library. For a more high-level overview see the <a href="https://doi.org/10.18637/jss.v097.c01">vignette</a> and <a href="https://github.com/tnagler/RcppThread/blob/main/README.md">README</a>.</p><section id="license"><h2><a href="#license">License</a></h2><p>The MIT License (MIT)</p><p>Copyright © 2021 Thomas Nagler</p><p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p><p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p><p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></section>
<aside class="m-note m-default"><h4>Authors</h4><p>Thomas Nagler</p></aside><p>This is the API documentation for the RcppThread C++ library. For a more high-level overview see the <a href="https://doi.org/10.18637/jss.v097.c01">vignette</a> and <a href="https://github.com/tnagler/RcppThread/blob/main/README.md">README</a>.</p><section id="license"><h2><a href="#license">License</a></h2><p>The MIT License (MIT)</p><p>Copyright © 2022 Thomas Nagler</p><p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p><p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p><p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></section>
</div>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions docs/namespaceRcppThread.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ <h2><a href="#nested-classes">Classes</a></h2>
class <a href="classRcppThread_1_1ProgressPrinter.html" class="m-doc">ProgressPrinter</a>
</dt>
<dd>Abstract class for printing progress.</dd>
<dt>
class <a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a>
</dt>
<dd>Safely printing to the R console from threaded code.</dd>
<dt>
class <a href="classRcppThread_1_1RMonitor.html" class="m-doc">RMonitor</a>
</dt>
Expand Down Expand Up @@ -159,6 +163,10 @@ <h2><a href="#func-members">Functions</a></h2>
<section id="var-members">
<h2><a href="#var-members">Variables</a></h2>
<dl class="m-doc">
<dt id="a8393ba347760237abf9d823000af775e">
static <a href="classRcppThread_1_1RErrPrinter.html" class="m-doc">RErrPrinter</a> <a href="#a8393ba347760237abf9d823000af775e" class="m-doc-self">Rcerr</a>
</dt>
<dd>global <code>RPrinter</code> instance called &#x27;Rcerr&#x27; (as in Rcpp).</dd>
<dt id="a314d0d8e34b9799f4dda1b4d5da36ed0">
static <a href="classRcppThread_1_1RPrinter.html" class="m-doc">RPrinter</a> <a href="#a314d0d8e34b9799f4dda1b4d5da36ed0" class="m-doc-self">Rcout</a>
</dt>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchdata-v1.js

Large diffs are not rendered by default.

Loading