Closed boennecd closed 4 years ago
I think you've come across a difference between the github and the CRAN version of TMB. The github version prints using std::cout
which is thread safe. Due to a CRAN policy, the CRAN version is patched to print using Rcpp::Rcout
which is not thread safe.
If you can live without the parallelization diagnostic messages I guess, if I recall correctly, that trace.parallel=0
should solve the problem?
I think you've come across a difference between the github and the CRAN version of TMB. The github version prints using
std::cout
which is thread safe. Due to a CRAN policy, the CRAN version is patched to print usingRcpp::Rcout
which is not thread safe.
I see. I did not notice that there were a difference: https://github.com/kaskr/adcomp/blob/52002f8dd4e022661b1f4f32986a0c40a19fbd75/Makefile#L96-L115
If you can live without the parallelization diagnostic messages I guess, if I recall correctly, that
trace.parallel=0
should solve the problem?
Yes that solves the issue. I have no opinion. I wanted to make you aware of a potential issue but you already address it.
These lines prints output from a parallel region
https://github.com/kaskr/adcomp/blob/021e4f4eddbaae1d1fe72fd36c37014103d4faac/TMB/inst/include/tmb_core.hpp#L132-L147
The code is hard to reach but causes a crash with the following example (I think):
Running
path/to/batch-file.R
givesA similar output is produced by
which produces e.g.
Replacing
critical
withmaster
seems to solve the issue although I am not sure whether this is recommended. However, only the master thread will execute thestd::cout
line so the final result is