Parallel Sweep Loop?

Hi! I’m currently exploring OpenTAP and I was wondering if there’s a way to achieve parallel execution on an array of sweep values. That’s something I would call “Parallel Sweep Loop”.

As an example:

PARENT -- Parallel Sweep Loop: Sweep Values = [DUT1, DUT2, DUT3 ...]
  CHILD 1
  ...
  CHILD N

That should result in sequential execution of CHILD steps on each DUT from the list, in parallel.

Is there a way to fabricate something like that using a magic combination of existing basic steps?

Thanks!

4 Likes

@pythonized first welcome to the community!

I would say today, we don’t have the concept of a Parallel Sweep. This is a really interesting idea though, and I encourage you to submit a feature request here:
https://gitlab.com/OpenTAP/opentap/-/issues/new?issue[assignee_id]=&issue[milestone_id]=

You can see the code for the SweepLoop here, and it is explicitly blocking, but you can see what is being done here:

The closest we have would be leveraging the Parallel Step, the Sequence Step, and the “Parameterize on Parent” feature. So your test plan would be:

Parallel   
    Sequence - DUT1   
        Child 1...N   
    Sequence - DUT2  
        Child 1...N   
    Sequence - DUT3
        Child 1... N
    ...

So, not a perfect solution, but you can copy/paste the sequence block when adding new steps. Attached is a test plan and bench settings using the Demo plugin to give you a better idea:
ParallelSequences.TapPlan (4.8 KB)
DUTs.xml (1.1 KB)
Instruments.xml (1 KB)

Also, since you seem to be a fan of Python, be sure to look at our Python Plugin:
https://opentap.gitlab.io/Plugins/python/TAP%20Python%20Help/

Thanks for a warm welcome and a swift reply @brennen_direnzo!

The workaround you suggested works indeed, I’ve actually came up with the identical one but didn’t like it as it was not dynamic enough. It was not very clear from my example but I would like to have a variable number of DUTs, and 3 is not the maximum. So you can expect a feature request :slight_smile:

Also, thanks for the heads-up regarding the Python plugin. I’m already using it although I see some limitations. Which leads me to another question: if I want to implement something like Parallel Sweep myself, do you think it would be feasible to make it in Python or it’s more reasonable to do it natively in C#?

2 Likes

Great! Yes, I figured that may be the case. That is why I pointed out the copy/paste aspects but fully recognized that is ideal.

Sounds like you have made quite some progress already. As for implementing something in Python vs natively in C#, in general, our Python Plugin is an interface on top of the native C# (built using Python.NET ) so, everything that existing in Python, exists in C#. In general we tend to implement generic features natively in C#, so that they can benefit all other interfaces, and not just one specific.

If you are interested there is a lightweight CLA for OpenTAP that you can find here, and then we can add you to the project: CONTRIBUTING.md · master · OpenTAP / OpenTAP · GitLab

Does that mean that parallel sweep loops like below wouldn’t actually run in parallel?

Parallel   
    Sweep Loop - DUT1
    Sweep Loop - DUT2
    ...
    Sweep Loop - DUTN
1 Like

In that case, each individual Sweep Loop will run in parallel. No issues there. But what is not possible (as things are today) is having each iteration of the Loop executing on its own thread/in parallel.

Ah, I see what the OP is trying to do now. Thanks @brennen_direnzo

1 Like