# vtk wasm threads

**URL:** https://discourse.vtk.org/t/vtk-wasm-threads/12778
**Category:** vtk.wasm
**Created:** [November 22, 2023, 4:08pm UTC](https://discourse.vtk.org/t/vtk-wasm-threads/12778 "2023-11-22T16:08:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![0ZzYy0](https://discourse.vtk.org/user_avatar/discourse.vtk.org/0zzyy0/32/8031_2.png) [@0ZzYy0](https://discourse.vtk.org/u/0ZzYy0)
#### Post date: [November 22, 2023, 4:08pm UTC](https://discourse.vtk.org/t/vtk-wasm-threads/12778/1 "2023-11-22T16:08:47Z")

</div>

When compiling the code with PTHREADS or WASM\_WORKERS enabled, I encountered an error stating “because it was not compiled with ‘atomics’ or ‘bulk-memory’ features.” How can I resolve this issue?

 ![Snipaste_2023-11-23_00-08-22](https://discourse.vtk.org/uploads/default/original/2X/2/28222d65f0b888e1c2fbdd5933653594b1c3ce91.png)

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [January 10, 2024, 3:12pm UTC](https://discourse.vtk.org/t/vtk-wasm-threads/12778/2 "2024-01-10T15:12:33Z")

</div>

When wasm threads are enabled, all translation units must be compiled with those features. Configure and re-build VTK with `-DCMAKE_CXX_FLAGS=-pthread`.

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [April 19, 2024, 8:27pm UTC](https://discourse.vtk.org/t/vtk-wasm-threads/12778/3 "2024-04-19T20:27:51Z")

</div>

> [@jaswantp](#):
>
> `DCMAKE_CXX_FLAGS=-pthread`.

Would this mean that the `pthreads` are used for `vtkSMPTools`?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [April 21, 2024, 12:46am UTC](https://discourse.vtk.org/t/vtk-wasm-threads/12778/4 "2024-04-21T00:46:17Z")

</div>

Yes. The default STDThread backend works. TBB/OpenMP can be made to work by using pthread.

I’ll have some examples up soon.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [August 23, 2024, 7:50pm UTC](https://discourse.vtk.org/t/vtk-wasm-threads/12778/5 "2024-08-23T19:50:26Z")

</div>

Two new examples were recently added in [vtk/vtk#11386](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11386) to illustrate usage of threads in VTK.wasm
