Bug#1012219: Please adjust StanHeaders to new version of (one)tbb

2022-09-03 Thread Nilesh Patra

Hi all,

On 9/3/22 22:06, Benjamin K Goodrich wrote:

Sorry for the late reply. I am told that StanHeaders can be built
successfully with oneTBB by setting environmental variables like
TBB_INC and TBB_LIB. On CRAN, we would like to use the version of TBB
that comes with the RcppParallel package
[...]


Thanks for the pointers, but
we are able to build cppparallel and stanheaders without problems as is. But 
the built package is
unusable as it uses "#include" statements that try to include files available 
in older tbb but
not in new onetbb, as observed in rstan compilation.

The problematic #include statment (and corresponding removed APIs) seems to be 
stemming from
"inst/include/stan/math/prim/core/init_threadpool_tbb.hpp"

On taking a deeper look, I observed that this is directly embedded from 
stan/math[1]
The current release of stanheaders contains an older copy of the math lib.
Going fwd, a patch had been added to stan/math to make it compatible with 
onetbb[2]
On cherry-picking a couple of changes from there, I am able to get rstan to 
compile.

I am not very sure if everything is good/works as expected (autopkgtests / CRAN 
tests seem
to pass, so that's a good indication), but I'd be thrilled to believe so.

[1]: https://github.com/stan-dev/math
[2]: 
https://github.com/stan-dev/math/commit/6f94b2a70d11276a53e5b5bc4100d3ffa524b96c

--
Best,
Nilesh


OpenPGP_signature
Description: OpenPGP digital signature


Bug#1012219: Please adjust StanHeaders to new version of (one)tbb

2022-09-03 Thread Benjamin K Goodrich
Sorry for the late reply. I am told that StanHeaders can be built
successfully with oneTBB by setting environmental variables like
TBB_INC and TBB_LIB. On CRAN, we would like to use the version of TBB
that comes with the RcppParallel package

https://github.com/RcppCore/RcppParallel/pull/144

Although with the next release of StanHeaders we will not be able to
achieve that because not all packages are LinkingTo RcppParallel so we
have to build a similar TBB in the StanHeaders shared object. But on
Debian, if r-cran-rcppparallel switches to oneTBB, then it would be
fine if r-cran-stanheaders, r-cran-rstan, etc. depends on
r-cran-rcppparallel.



Bug#1012219: Please adjust StanHeaders to new version of (one)tbb

2022-08-12 Thread Andreas Tille
Ping?  Is there any place where I can open an issue about this?
I've found
   https://github.com/cran/StanHeaders
but this is readonly and has no option to report issues.

Kind regards
 Andreas.

Am Mon, Jul 18, 2022 at 10:45:14AM +0200 schrieb Andreas Tille:
> Control: tags -1 upstream
> Control: forwarded -1 Ben Goodrich 
> 
> Hi Ben,
> 
> Debian is migrating from old tbb to onetbb (currently version 2021.5.0).  When
> trying to build rstan version 2.21.5 which includes StanHeaders we get the 
> error
> you can find here in our CI:
> 
>https://salsa.debian.org/r-pkg-team/r-cran-rstan/-/jobs/3011219
> 
> In file included from 
> /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/core.hpp:4,
>  from 
> /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat.hpp:6,
>  from 
> /usr/lib/R/site-library/StanHeaders/include/stan/math/rev/mat.hpp:12,
>  from ./stan/model/log_prob_grad.hpp:4,
>  from ./stan/model/test_gradients.hpp:7,
>  from ./stan/services/diagnose/diagnose.hpp:10,
>  from stan_fit.cpp:33:
> /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/core/init_threadpool_tbb.hpp:9:10:
>  fatal error: tbb/task_scheduler_init.h: No such file or directory
> 9 | #include 
>   |  ^~~
> compilation terminated.
> 
> It seems StanHeaders need to be adapted to onetbb.
> 
> There is a tbb -> onetbb transition guide:
> https://oneapi-src.github.io/oneTBB/main/tbb_userguide/Migration_Guide.html
> 
> Hope this helps
> 
>   Andreas.
> 
> -- 
> http://fam-tille.de
> 
> 

-- 
http://fam-tille.de



Bug#1012219: Please adjust StanHeaders to new version of (one)tbb

2022-07-18 Thread Andreas Tille
Control: tags -1 upstream
Control: forwarded -1 Ben Goodrich 

Hi Ben,

Debian is migrating from old tbb to onetbb (currently version 2021.5.0).  When
trying to build rstan version 2.21.5 which includes StanHeaders we get the error
you can find here in our CI:

   https://salsa.debian.org/r-pkg-team/r-cran-rstan/-/jobs/3011219

In file included from 
/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/core.hpp:4,
 from 
/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat.hpp:6,
 from 
/usr/lib/R/site-library/StanHeaders/include/stan/math/rev/mat.hpp:12,
 from ./stan/model/log_prob_grad.hpp:4,
 from ./stan/model/test_gradients.hpp:7,
 from ./stan/services/diagnose/diagnose.hpp:10,
 from stan_fit.cpp:33:
/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/core/init_threadpool_tbb.hpp:9:10:
 fatal error: tbb/task_scheduler_init.h: No such file or directory
9 | #include 
  |  ^~~
compilation terminated.

It seems StanHeaders need to be adapted to onetbb.

There is a tbb -> onetbb transition guide:
https://oneapi-src.github.io/oneTBB/main/tbb_userguide/Migration_Guide.html

Hope this helps

  Andreas.

-- 
http://fam-tille.de