Skip to content

Commit 4463e78

Browse files
committed
prepare release 2.1.0
1 parent c20eebc commit 4463e78

File tree

7 files changed

+17
-23
lines changed

7 files changed

+17
-23
lines changed

cran-comments.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@ also the problems on Fedora, which I could not reproduce.
66
* macOS X (release)
77
* Windows Server 2019 (release)
88
* CRAN win builder (devel)
9-
* rhub::check_for_cran()
10-
* rhub::check_with_sanitizers()
11-
* rhub::check_with_valgrind()
129

1310
## Check status summary
14-
WARN NOTE OK
15-
Source packages 0 0 1
16-
Reverse depends 1 17 1
17-
18-
The warning in package CDSeq is known and expected.
11+
NOTE OK
12+
Source packages 0 1
13+
Reverse depends 17 1

docs/xml/Rcerr_8hpp.xml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<compoundname>Rcerr.hpp</compoundname>
55
<includes local="no">ostream</includes>
66
<includes refid="RMonitor_8hpp" local="yes">RcppThread/RMonitor.hpp</includes>
7-
<includedby refid="ThreadPool_8hpp" local="yes">/data/dev/r/RcppThread/inst/include/RcppThread/ThreadPool.hpp</includedby>
87
<includedby refid="Thread_8hpp" local="yes">/data/dev/r/RcppThread/inst/include/RcppThread/Thread.hpp</includedby>
98
<includedby refid="RcppThread_8h" local="yes">/data/dev/r/RcppThread/inst/include/RcppThread.h</includedby>
109
<incdepgraph>

docs/xml/ThreadPool_8hpp.xml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<compoundname>ThreadPool.hpp</compoundname>
55
<includes refid="RMonitor_8hpp" local="yes">RcppThread/RMonitor.hpp</includes>
66
<includes refid="Rcout_8hpp" local="yes">RcppThread/Rcout.hpp</includes>
7-
<includes refid="Rcerr_8hpp" local="yes">RcppThread/Rcerr.hpp</includes>
87
<includes refid="quickpool_8hpp" local="yes">RcppThread/quickpool.hpp</includes>
98
<includes local="no">atomic</includes>
109
<includes local="no">condition_variable</includes>

inst/include/RcppThread/RMonitor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class RMonitor {
112112
if ( calledFromMainThread() && (msgsErr_.str() != std::string("")) ) {
113113
// release messages in buffer
114114
REprintf("%s", msgsErr_.str().c_str());
115-
//R_FlushConsole();
115+
// R_FlushConsole();
116116
// clear message buffer
117117
msgsErr_.str("");
118118
}

inst/include/RcppThread/ThreadPool.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "RcppThread/RMonitor.hpp"
1010
#include "RcppThread/Rcout.hpp"
11-
#include "RcppThread/Rcerr.hpp"
11+
// #include "RcppThread/Rcerr.hpp"
1212
#include "RcppThread/quickpool.hpp"
1313

1414
#include <atomic>
@@ -233,12 +233,12 @@ ThreadPool::wait()
233233
do {
234234
pool_->wait(100);
235235
Rcout << "";
236-
Rcerr << "";
236+
// Rcerr << "";
237237
checkUserInterrupt();
238238

239239
} while (!pool_->done());
240240
Rcout << "";
241-
Rcerr << "";
241+
// Rcerr << "";
242242
}
243243

244244
//! waits for all jobs to finish.

inst/include/RcppThread/quickpool.hpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -748,14 +748,14 @@ class TaskManager
748748
std::exception_ptr err_ptr_{ nullptr };
749749
};
750750

751+
#if (defined __linux__)
751752
// find out which cores are allowed for use by pthread
752753
inline std::vector<size_t>
753754
get_avail_cores()
754755
{
755756
auto ncores = std::thread::hardware_concurrency();
756757
std::vector<size_t> avail_cores;
757758
avail_cores.reserve(ncores);
758-
#if (defined __linux__)
759759
cpu_set_t cpuset;
760760
int rc = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
761761
if (rc != 0) {
@@ -766,9 +766,9 @@ get_avail_cores()
766766
avail_cores.push_back(id);
767767
}
768768
}
769-
#endif
770769
return avail_cores;
771770
}
771+
#endif
772772

773773
inline size_t
774774
num_cores_avail()
@@ -829,6 +829,8 @@ class ThreadPool
829829
if (!task_manager_.called_from_owner_thread())
830830
return;
831831

832+
active_threads_ = threads;
833+
832834
if (threads <= workers_.size()) {
833835
task_manager_.resize(threads);
834836
} else {
@@ -845,7 +847,6 @@ class ThreadPool
845847
set_thread_affinity();
846848
#endif
847849
}
848-
active_threads_ = threads;
849850
}
850851

851852
//! @brief retrieves the number of active worker threads in the thread pool.
@@ -970,7 +971,7 @@ class ThreadPool
970971
{
971972
cpu_set_t cpuset;
972973
auto avail_cores = sched::get_avail_cores();
973-
for (size_t id = 0; id < workers_.size(); id++) {
974+
for (size_t id = 0; id < active_threads_; id++) {
974975
CPU_ZERO(&cpuset);
975976
CPU_SET(avail_cores[id % avail_cores.size()], &cpuset);
976977
int rc = pthread_setaffinity_np(

tests/tests.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,18 @@ testThreadPoolSingleThreaded()
237237
x[i] = 2 * x[i];
238238
};
239239

240-
// for (size_t i = 0; i < x.size(); i++)
241-
// pool.push(dummy, i);
242-
// pool.wait();
240+
for (size_t i = 0; i < x.size(); i++)
241+
pool.push(dummy, i);
242+
pool.wait();
243243

244244
pool.parallelFor(0, x.size(), dummy);
245245
pool.wait();
246246

247247
size_t count_wrong = 0;
248248
for (size_t i = 0; i < x.size(); i++)
249-
count_wrong += (x[i] != 2);
249+
count_wrong += (x[i] != 4);
250250
if (count_wrong > 0)
251-
Rcout << "push gives wrong result" << std::endl;
251+
Rcout << "single threaded gives wrong result" << std::endl;
252252
pool.join();
253253
}
254254

0 commit comments

Comments
 (0)