Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tbb to 2020 3 #2447

Merged
merged 12 commits into from
Mar 26, 2021
Merged

Update tbb to 2020 3 #2447

merged 12 commits into from
Mar 26, 2021

Conversation

SteveBronder
Copy link
Collaborator

@SteveBronder SteveBronder commented Mar 24, 2021

Summary

This updates the tbb to 2020 3. The only code side change here is that in order to be backwards compatible, but still use the new task_arena interface we look at the tbb version major and if it is >= 2020 we define TBB_INTERFACE_NEW and use that, but otherwise we use the old interface

#include <tbb/tbb_stddef.h>

#if TBB_VERSION_MAJOR >= 2020
#ifndef TBB_INTERFACE_NEW
#define TBB_INTERFACE_NEW
#endif
#endif

And for backwards compatibility I removed the priority::normal from the new interfaces task arena since that's the default but priority::normal is not defined for the old version of tbb

Tests

Side Effects

Just the macro flag to be aware of

Release notes

Update tbb to 2020 3

Checklist

  • Math issue #(issue number)

  • Copyright holder: Steve Bronder

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

Copy link
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, just minor issue with readme.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@rok-cesnovar
Copy link
Member

The handling of TBB_INTERFACE_NEW seems logical to me.

rok-cesnovar
rok-cesnovar previously approved these changes Mar 24, 2021
Copy link
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@rok-cesnovar
Copy link
Member

@SteveBronder
Copy link
Collaborator Author

Ooof, that's not a fun error. Lemme see where we are pulling that in. It's only an warning promoted to an error but I'd rather make a patch for it

@SteveBronder
Copy link
Collaborator Author

Alright all I had to do here is add -Wno-deprecated-copy like we do for clang

Copy link
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go assuming tests pass. Thanks!

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.32 3.38 0.98 -1.76% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.91 -10.3% slower
eight_schools/eight_schools.stan 0.11 0.11 1.01 1.06% faster
gp_regr/gp_regr.stan 0.16 0.17 0.92 -9.02% slower
irt_2pl/irt_2pl.stan 5.49 5.35 1.03 2.47% faster
performance.compilation 91.65 89.09 1.03 2.8% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.58 8.6 1.0 -0.19% slower
pkpd/one_comp_mm_elim_abs.stan 30.22 30.33 1.0 -0.34% slower
sir/sir.stan 128.08 130.05 0.98 -1.54% slower
gp_regr/gen_gp_data.stan 0.04 0.03 1.04 3.81% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.2 3.16 1.01 1.43% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.39 0.39 1.01 0.83% faster
arK/arK.stan 1.99 2.01 0.99 -0.87% slower
arma/arma.stan 0.93 0.63 1.48 32.49% faster
garch/garch.stan 0.51 0.51 1.01 0.78% faster
Mean result: 1.02625341667

Jenkins Console Log
Blue Ocean
Commit hash: 9730ca7


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@SteveBronder
Copy link
Collaborator Author

It looks like we need to make the task schedular initialization into auto for cmdstan. I'll open up a PR

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.43 3.38 1.01 1.32% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.91 -9.52% slower
eight_schools/eight_schools.stan 0.11 0.11 1.02 1.83% faster
gp_regr/gp_regr.stan 0.16 0.16 0.98 -1.81% slower
irt_2pl/irt_2pl.stan 5.39 5.34 1.01 0.97% faster
performance.compilation 90.29 88.7 1.02 1.76% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.63 8.63 1.0 -0.01% slower
pkpd/one_comp_mm_elim_abs.stan 30.62 30.06 1.02 1.81% faster
sir/sir.stan 125.23 128.21 0.98 -2.38% slower
gp_regr/gen_gp_data.stan 0.03 0.04 0.98 -1.56% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.27 3.03 1.08 7.43% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.38 0.4 0.94 -6.83% slower
arK/arK.stan 1.99 2.01 0.99 -1.03% slower
arma/arma.stan 0.94 0.64 1.49 32.68% faster
garch/garch.stan 0.51 0.51 1.0 0.27% faster
Mean result: 1.02860724918

Jenkins Console Log
Blue Ocean
Commit hash: 9730ca7


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@rok-cesnovar
Copy link
Member

Needs stan-dev/cmdstan#1001 then just restart upstream tests and should be good to go.

@rok-cesnovar
Copy link
Member

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.39 3.48 0.97 -2.67% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.96 -3.92% slower
eight_schools/eight_schools.stan 0.11 0.11 1.02 2.35% faster
gp_regr/gp_regr.stan 0.16 0.16 0.99 -0.66% slower
irt_2pl/irt_2pl.stan 5.29 5.35 0.99 -1.09% slower
performance.compilation 90.77 89.08 1.02 1.86% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.91 8.69 1.03 2.47% faster
pkpd/one_comp_mm_elim_abs.stan 31.26 33.06 0.95 -5.75% slower
sir/sir.stan 127.35 128.86 0.99 -1.18% slower
gp_regr/gen_gp_data.stan 0.03 0.04 0.98 -2.21% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.09 2.99 1.03 3.28% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.37 0.39 0.94 -6.01% slower
arK/arK.stan 1.93 1.98 0.97 -2.82% slower
arma/arma.stan 0.65 0.63 1.03 2.89% faster
garch/garch.stan 0.52 0.52 1.0 0.04% faster
Mean result: 0.991960557006

Jenkins Console Log
Blue Ocean
Commit hash: 9730ca7


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.37 3.38 1.0 -0.41% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.99 -0.54% slower
eight_schools/eight_schools.stan 0.11 0.11 0.99 -1.28% slower
gp_regr/gp_regr.stan 0.17 0.16 1.04 3.96% faster
irt_2pl/irt_2pl.stan 5.34 5.36 1.0 -0.32% slower
performance.compilation 89.67 89.32 1.0 0.39% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.89 8.62 1.03 3.07% faster
pkpd/one_comp_mm_elim_abs.stan 30.32 29.0 1.05 4.37% faster
sir/sir.stan 130.66 140.64 0.93 -7.64% slower
gp_regr/gen_gp_data.stan 0.04 0.04 1.01 0.81% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.09 3.03 1.02 2.12% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.39 0.4 0.99 -0.58% slower
arK/arK.stan 1.9 1.99 0.95 -5.11% slower
arma/arma.stan 0.64 0.63 1.01 0.6% faster
garch/garch.stan 0.51 0.51 1.0 -0.33% slower
Mean result: 1.00029521657

Jenkins Console Log
Blue Ocean
Commit hash: 9730ca7


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@rok-cesnovar rok-cesnovar merged commit 0500503 into develop Mar 26, 2021
@rok-cesnovar rok-cesnovar deleted the feature/update-tbb2020-3 branch March 26, 2021 17:29
@SteveBronder
Copy link
Collaborator Author

@rok-cesnovar odd, it looks like the tests passed but the jenkins here still has an X

https://jenkins.mc-stan.org/blue/organizations/jenkins/Math%20Pipeline/detail/PR-2447/5/pipeline

@rok-cesnovar
Copy link
Member

Looks good to me:

image

@@ -5,6 +5,14 @@

#include <boost/lexical_cast.hpp>

#include <tbb/tbb_stddef.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks external oneTBB since tbb/tbb_stddef.h is not found:

stan/math/prim/core/init_threadpool_tbb.hpp(8):
  catastrophic error: cannot open source file "tbb/tbb_stddef.h"
  #include <tbb/tbb_stddef.h>

TBB_VERSION_MAJOR is now defined in tbb/version.h.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! So seems we need to add another ONE_TBB compile time define.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll submit a hot fix shortly; testing it now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rok-cesnovar #2452 does the trick.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll put in a fix pr. I think we can just move #ifndef TBB_INTERFACE_NEW up since if they have that defined then we know already we are using the new interface

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is what @hsbadr did in #2452

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly :)

hsbadr added a commit to hsbadr/math that referenced this pull request Mar 26, 2021
@hsbadr hsbadr mentioned this pull request Mar 26, 2021
4 tasks
SteveBronder added a commit that referenced this pull request Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants