Is VEX multithreaded in Solaris?

   Views 930   Replies 7   Subscribers 1
User Avatar
Member
100 posts
Joined: 11月 2019
Offline
Is VEX in solaris multithreaded? Reading this https://openusd.org/dev/api/_usd__page__multi_threading.html [openusd.org] I feel like USD leaves that door open. How does vex work underneath and how does it compare to python (when workin in /stage)?
In general, what is the best approach in terms of performance to dealing with both reading and writing data in usd? VEX or python with USD's different APIs?
Edited by Cicuta - 2025年2月17日 05:16:19
User Avatar
Member
2637 posts
Joined: 6月 2008
Offline
The way I understand it is that VEX wrangles running over points and primitives are multi-threaded. When you run a VEX wrangle in detail mode, it's running single core.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
100 posts
Joined: 11月 2019
Offline
Yes, that is clear in Houdini's documentation, but that is in SOPs context. The question is how does that translate into USD/Solaris context? The wrangle runs over usd primitives, or if the "Run on Elements of Array Attributes" is on, over array attributes/primvars. Is that multithreaded?
Edited by Cicuta - 2025年2月17日 09:19:33
User Avatar
Member
226 posts
Joined: 1月 2015
Offline
Take a look at task manager CPU usage when running your code.

From what I have heard Python is faster for stage editing.
Edited by Heileif - 2025年2月17日 14:38:31
User Avatar
Member
100 posts
Joined: 11月 2019
Offline
I have heard a similar thing but it would be nice understanding why, and a bit more about how VEX works with USD in contrast with how it does with SOPs for example.

Heileif
Take a look at task manager CPU usage when running your code.

Edit: That makes sense, but not sure if it will be easy to read or draw conclusions from. I will check
Edited by Cicuta - 2025年2月18日 08:59:33
User Avatar
Member
226 posts
Joined: 1月 2015
Offline
Cicuta
I have heard a similar thing but it would be nice understanding why, and a bit more about how VEX works with USD in contrast with how it does with SOPs for example.

Heileif
Take a look at task manager CPU usage when running your code.
Unfortunately this won't give any info about if it's multithreaded or not.

If mostly all CPU cores is close to 100% load when running code, the code running is multithreaded.
Edited by Heileif - 2025年2月18日 06:53:09
User Avatar
Member
100 posts
Joined: 11月 2019
Offline
I am not sure if the conclusions I am getting are correct, but it seems like when the wrangle is modified or applied all cores spike. Therefore I assume that there is some level of multithreading. I ran similar tests with native LOP nodes and saw similar behavior. However, when testing with Python, I don't see that same "collective spiking" in the cores. Again I am not sure if I am reading this right.

Nevertheless, if my conclusions are not too wrong, how can python then more efficient?
Edited by Cicuta - 2025年2月18日 07:19:07
User Avatar
スタッフ
4228 posts
Joined: 9月 2007
Online
In USD, reading stages can be multi-threaded, but writing is single-threaded. As for VEX in LOPs, Python is better when operating entirely on USD prims. There is overhead to getting the USD data into VEX, in order to run the SIMD operations in parallel. While the kernels run, threads are saturated, but after those run, we're back to converting data and doing single-threaded writes to USD. This is also why adding VEX into your prim patterns can add a lot of overhead, compared to using the prim pattern functions. So Python is better for performance in LOPs, though VEX can be convenient to write (and is preferred when doing mixed SOP/USD read/write).

Python can be so fast, because it's often a pretty thin wrapper around the USD/SDF C++ operations. It's certainly possible to make the Python functions slow in LOPs, but I'm continually amazed at how much performance can be squeezed out of Python with Solaris.

I highly recommend this presentation by Mark Tucker (Solaris lead), where he goes over LOPs cooking details, and how to make your networks/nodes as performant as possible: https://www.youtube.com/watch?v=ukfe2gOJ3l0 [www.youtube.com]. A fair bit of the details make more sense when writing C++ LOP nodes, but also covers Python, VEX, profiling performance, etc...

Hope this helps!
I'm o.d.d.
  • Quick Links