Skip to content

Commit

Permalink
#39 disable multithreading on Windows
Browse files Browse the repository at this point in the history
jwijffels committed Jan 6, 2023
1 parent 647a61e commit 23c2d39
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ruimtehol
Type: Package
Title: Learn Text 'Embeddings' with 'Starspace'
Version: 0.3
Version: 0.3.1
Maintainer: Jan Wijffels <jwijffels@bnosac.be>
Authors@R: c(
person('Jan', 'Wijffels', role = c('aut', 'cre', 'cph'), email = 'jwijffels@bnosac.be', comment = "R wrapper"),
@@ -22,5 +22,5 @@ Depends: R (>= 2.10)
Imports: Rcpp (>= 0.11.5), utils, graphics, stats
Suggests: udpipe, data.table
LinkingTo: Rcpp, BH
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
SystemRequirements: C++11
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## CHANGES IN ruimtehol VERSION 0.3.1

- Changes in src/Starspace/src/model.cpp (EmbedModel::train). On Windows, no longer use threads as on CRAN that seems to make the package FAIL.

## CHANGES IN ruimtehol VERSION 0.3

- Fixed a bug in saving models trained with ngrams > 1. Embeddings of hashed buckets were not saved.
8 changes: 4 additions & 4 deletions src/Starspace/src/model.cpp
Original file line number Diff line number Diff line change
@@ -214,9 +214,9 @@ Real EmbedModel::train(shared_ptr<InternDataHandler> data,
assert(rate >= finishRate);
assert(rate >= 0.0);

#ifdef __APPLE__
#if defined(__APPLE__) || defined(_WIN32)
if(numThreads > 1){
Rcpp::Rcerr << "Mac OS does not work with threads > 1, will perform training using 1 thread instead." << "\n";
Rcpp::Rcerr << "Mac OS / Windows does not work with threads > 1, will perform training using 1 thread instead." << "\n";
}
#endif

@@ -343,7 +343,7 @@ Real EmbedModel::train(shared_ptr<InternDataHandler> data,
assert(b >= indices.begin());
assert(e >= b);
assert(e <= indices.end());
#ifdef __APPLE__
#if defined(__APPLE__) || defined(_WIN32)
trainThread(i, b, e);
#else
threads.emplace_back(thread([=] {
@@ -371,7 +371,7 @@ Real EmbedModel::train(shared_ptr<InternDataHandler> data,
}
}
};
#ifdef __APPLE__
#if defined(__APPLE__) || defined(_WIN32)
doneTraining = true;
normThread();
#else

0 comments on commit 23c2d39

Please sign in to comment.