koheiw / seededlda

LDA for semisupervised topic modeling
https://koheiw.github.io/seededlda/
73 stars 15 forks source link

installation fails on Alpine Linux #70

Closed bastistician closed 3 months ago

bastistician commented 5 months ago

Simply because the tbb namespace is undeclared (see the error log below). This could be fixed by a bulk #include <tbb/tbb.h> of all of TBB in src/lda.h, but I think it would be better to selectively include the required headers only. Thanks!

Error Log (version 1.1.0) ``` In file included from lda.cpp:4: lda.h: In constructor 'LDA::LDA(int, double, double, double, int, double, int, int, bool, int)': lda.h:128:33: error: 'tbb' has not been declared 128 | if (0 < thread && thread <= tbb::this_task_arena::max_concurrency()) | ^~~ lda.h: In member function 'void LDA::set_default_values()': lda.h:152:14: error: 'tbb' has not been declared 152 | thread = tbb::this_task_arena::max_concurrency(); | ^~~ lda.h: In member function 'void LDA::estimate()': lda.h:255:5: error: 'tbb' has not been declared 255 | tbb::mutex mutex_sync; | ^~~ lda.h:263:9: error: 'tbb' has not been declared 263 | tbb::task_arena arena(thread); | ^~~ lda.h:264:9: error: 'arena' was not declared in this scope 264 | arena.execute([&]{ | ^~~~~ lda.h: In lambda function: lda.h:265:13: error: 'tbb' has not been declared 265 | tbb::parallel_for(tbb::blocked_range(0, M, batch), [&](tbb::blocked_range r) { | ^~~ lda.h:265:31: error: 'tbb' has not been declared 265 | tbb::parallel_for(tbb::blocked_range(0, M, batch), [&](tbb::blocked_range r) { | ^~~ lda.h:265:50: error: expected primary-expression before 'int' 265 | tbb::parallel_for(tbb::blocked_range(0, M, batch), [&](tbb::blocked_range r) { | ^~~ lda.h:265:73: error: 'tbb' has not been declared 265 | tbb::parallel_for(tbb::blocked_range(0, M, batch), [&](tbb::blocked_range r) { | ^~~ lda.h:265:91: error: expected ',' or '...' before '<' token 265 | tbb::parallel_for(tbb::blocked_range(0, M, batch), [&](tbb::blocked_range r) { | ^ lda.h: In lambda function: lda.h:267:29: error: 'r' was not declared in this scope 267 | int begin = r.begin(); | ^ lda.h:303:17: error: 'mutex_sync' was not declared in this scope 303 | mutex_sync.lock(); | ^~~~~~~~~~ lda.h: In lambda function: lda.h:308:16: error: 'tbb' has not been declared 308 | }, tbb::static_partitioner()); | ^~~ ```
koheiw commented 5 months ago

Thanks. We are making big changes in quanteda currently: it will link directly to TBB without RcppParallel. I will make similar changes In this package too.

bastistician commented 3 months ago

I can confirm that version 1.2.1 installs and checks OK on my Alpine Linux server. Thanks!