1

For a project with a very large database I am using the following two procedures thousands of times in a loop:

select_points_object_model_3d()
render_object_model_3d()

This takes hours and hours for every test as it is using only 1/16 cores. Now I was wondering: Is there a way to run multiple HDev engines in different threads all executing said procedures?

Malinko
  • 124
  • 11

2 Answers2

2

I forgot to come back to this when I found a solution. For the next one who is stuck on this. Using taskList[i] = new Task<>(() => {"task code"}); I was able to run 450+ tasks that use HOP.SelectPointsObjectModel3d() and HOP.RenderObjectModel3d() consecutively completely utilizing all my cores. I didn't need multiple engines or anything like that.

Malinko
  • 124
  • 11
1

You can try to work with halcon multithreading operators.

Infinitely running:

par_start<Thread1>: procedure(...)

Wait for threads to finish:

par_start <Thread1> : process (...)
par_start <Thread2> : process (...)
par_join ([Thread1, Thread2])

See: https://www.mvtec.com/doc/halcon/12/en/par_join.html

ehlus
  • 31
  • 3
  • Hi! thnx for helping. I think (not sure) that this won't work as the help page of `render_object_model_3d` states: "Multithreading type: mutually exclusive (runs in parallel with other non-exclusive operators, but not with itself)." That's why I was hoping that having multiple engines running in C# with HalconDotNet would be possible somehow – Malinko Dec 29 '22 at 17:04