# Why doesn't VTK\_SMP\_IMPLEMENTATION\_TYPE default to STDThread?

**URL:** https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293
**Category:** Development
**Created:** [April 13, 2022, 8:39pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293 "2022-04-13T20:39:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![seanm](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@seanm](https://discourse.vtk.org/u/seanm)
#### Post date: [April 13, 2022, 8:39pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/1 "2022-04-13T20:39:52Z")

</div>

Hi all,

Why does VTK\_SMP\_IMPLEMENTATION\_TYPE default to Sequential instead of STDThread?

Are there platforms where STDThread doesn’t exist/work?

Cheers,

Sean

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [April 13, 2022, 8:46pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/2 "2022-04-13T20:46:53Z")

</div>

Good question, but note that std::thread is extremely sensitive to any hint of race conditions. I have also seen it much, much slower than TBB, and even slower than sequential on occasion. I personally never use std::thread except when debugging, and always prefer TBB.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [April 13, 2022, 8:55pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/3 "2022-04-13T20:55:59Z")

</div>

Yes, the deadlocks that were still around in STDThread blocked it from being the default. See `.gitlab/ci/ctest_exclusions.cmake` for the tests that seem to be affected.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [April 14, 2022, 7:33am UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/4 "2022-04-14T07:33:28Z")

</div>

@Charles_Gueunet

---

<div class="post-metadata">

### Author: ![seanm](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@seanm](https://discourse.vtk.org/u/seanm)
#### Post date: [April 14, 2022, 4:21pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/5 "2022-04-14T16:21:02Z")

</div>

Sounds like a job for Thread Sanitizer!

I should restore my TSan nightly build… I believe I disabled it because it was taking a long time, but perhaps I can build less of VTK to get things going.

I also have a patch coming that fixes at least one TSan complaint…

Sean

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [April 14, 2022, 4:54pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/6 "2022-04-14T16:54:57Z")

</div>

Yes, tsan is extremely useful but as you say slow. It would be good to work through the std::thread issues that Ben referred to.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [April 14, 2022, 4:55pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/7 "2022-04-14T16:55:21Z")

</div>

I have an MR somewhere to re-enable the sanitizers, but the CI is a complete mess and I don’t have time to make it happy enough to turn on.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [April 14, 2022, 5:00pm UTC](https://discourse.vtk.org/t/why-doesnt-vtk-smp-implementation-type-default-to-stdthread/8293/8 "2022-04-14T17:00:06Z")

</div>

Let me just cheer on from the sidelines to getting std::thread in shape. I guess once it’s mature enough, it could be used for the PyPI wheels? That would be great.
