openvino icon indicating copy to clipboard operation
openvino copied to clipboard

[Good First Issue]: Enable parallel execution of OVC Python API python tests

Open mryzhov opened this issue 1 year ago • 15 comments

Context

Current CI (https://github.com/openvinotoolkit/openvino/blob/c0381ab08d2fcdc51c621196e935aa02c64a4b50/.github/workflows/linux.yml#L869) runs all the python tests sequentially one by one and it takes too much time. The idea is to run all those tests in parallel by using pytest-xdist plugin, but tests should be modified for that. Please find bellow the common tests issues:

  • Random inputs generation as parametrization arguments. Solution: all random test arguments should be generated inside of the tests
  • Tests create, use and remove the same artifacts (temporary data, models, etc). Hot fix solution: all test data should be generated in the system temporary directory (TMPDIR) which can be unique for each thread. Long term solution: all test data should be generated in the unique temporary directory or with unique names.

What needs to be done?

  • Modify OVC Python API tests to solve issues described in the Context. Tests are located here - https://github.com/openvinotoolkit/openvino/tree/master/tests/layer_tests/ovc_python_api_tests
  • Enable parallel execution of those test in the CI (https://github.com/openvinotoolkit/openvino/blob/4a0098b26ad6c4cbae97fbe34505fa63c08036eb/.github/workflows/linux.yml#L1001C15-L1001C35)

Example Pull Requests

https://github.com/openvinotoolkit/openvino/pull/20613

Resources

Contact points

@mryzhov @akashchi

Ticket

No response

mryzhov avatar Nov 07 '23 10:11 mryzhov

I would be happy to help with the issue. Could you assign this issue to me?

boringlyBoring avatar Nov 20 '23 15:11 boringlyBoring

Thanks, I will working on it Friday night

boringlyBoring avatar Nov 23 '23 03:11 boringlyBoring

Please let us know if you have any questions! :)

p-wysocki avatar Nov 24 '23 10:11 p-wysocki

Hello @boringlyBoring, is there anything we can help you with? Do you have any questions?

p-wysocki avatar Dec 08 '23 14:12 p-wysocki

The task has been returned to be picked up due to current assignee's inactivity. @boringlyBoring if you're still out there working on it, please let us know - we'll return the task to you. :)

p-wysocki avatar Dec 15 '23 10:12 p-wysocki

Hi! I'd like to work on this issue. I have a couple of questions.

  1. For the temporary directory issue, isn't the temp_dir fixture here already generating a unique temporary directory per test?
  2. I couldn't figure out where the random test inputs are being used. Can you link an example test taking random arguments?

Prakhar314 avatar Dec 16 '23 00:12 Prakhar314

Hi @Prakhar314, I would recommend you to run those tests in parallel as first step and collect list of the failed tests. It may help to find out the root cause. tmp_dir issue could not be applicable for those tests.

mryzhov avatar Dec 21 '23 11:12 mryzhov

@rajatkrishna could you please take this one?

ilya-lavrenov avatar Jan 19 '24 16:01 ilya-lavrenov

Hey @mryzhov i would like work on this issue. could you please assign me this issue?

Ruman-12 avatar Jan 22 '24 03:01 Ruman-12

@mlukasze thanks for assigning me this issue ill work on it. and create pr as soon as possible

Ruman-12 avatar Jan 22 '24 08:01 Ruman-12

hey @mlukasze @mryzhov
I wanted to provide an update regarding the issue assigned to me. I've been diligently working on it for the past week, but unfortunately, progress has been slower than anticipated due to unforeseen personal commitments. Specifically, I have exams scheduled that require my immediate attention and focus. I acknowledge that it may take some time for me to resolve this issue. I would appreciate your patience as I navigate through my exams and allocate time to address the problem effectively. I am committed to contributing to the project and will do my best to resolve this issue as soon as my schedule permits.

Ruman-12 avatar Jan 29 '24 15:01 Ruman-12

Hello @Ruman-12, no worries! As long as you let us know that it's in progress it's alright. :)

p-wysocki avatar Jan 29 '24 15:01 p-wysocki

Hello @Ruman-12, is there anything we could help with?

p-wysocki avatar Feb 19 '24 13:02 p-wysocki

I would like to contribute.

SaltTheClouds avatar Feb 23 '24 02:02 SaltTheClouds

Hello @SaltTheClouds, thanks for taking a look! Please let us know if you have any questions, we're here to help. :)

p-wysocki avatar Feb 23 '24 13:02 p-wysocki

Hello @SaltTheClouds, thanks for taking a look! Please let us know if you have any questions, we're here to help. :)

Thank you for including me

SaltTheClouds avatar Feb 27 '24 18:02 SaltTheClouds

Hello @SaltTheClouds, thanks for taking a look! Please let us know if you have any questions, we're here to help. :)

I just wanted to check in with you. I'm still working on this issue, but I'm very new to this and I had some technical problems that I didn't expect. I believe I have them worked out now though.

SaltTheClouds avatar Feb 29 '24 01:02 SaltTheClouds

I'm sorry, I'm just not ready for this one.

SaltTheClouds avatar Mar 01 '24 02:03 SaltTheClouds

.take

mahajanparth avatar Mar 01 '24 06:03 mahajanparth

Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue.

github-actions[bot] avatar Mar 01 '24 06:03 github-actions[bot]

Hey folks, I would like to contribute, could I take a look at it? Seems interesting !!!

mahajanparth avatar Mar 01 '24 06:03 mahajanparth

@SaltTheClouds do not worry, maybe some other Good First Issue will fit to you better? For now I'm reassigning task to @mahajanparth

mlukasze avatar Mar 01 '24 06:03 mlukasze

@mlukasze . Just wanted to confirm some things , even with no parallelism , i can see there are 8 test cases failing and a few skipped. Are there any additional requirements that i am failing to install or is it okay for now ?

Program : test_tf_output_order.py .x.x....xxx.xx.x is the culprit

Image

mahajanparth avatar Mar 02 '24 01:03 mahajanparth

@mryzhov could you check it out, please?

mlukasze avatar Mar 04 '24 05:03 mlukasze

Hey, @mlukasze

  1. I have converted all the test cases to be run in parallel using pytest-xdist .
  2. Also shifted random tensor creation from being done in the test data before parameteritization to inside of the test cases itself.
  3. The temp dir fixture was already there so the second part of the ticket didn't need any attention as per now .
  4. I am still finding a few test cases to be failing with both sequential and parallelized approach does it need attention from my end ? Please find the running Time difference in the images below :
  • parallel execution 8 core : 98 seconds ( 542 passed , 12 skipped , 8 failed )
  • sequential execution : 407 seconds ( 542 passed , 12 skipped , 8 failed )

sequential execution :

Image

parallel execution :

Image

Parallel_execution.txt

should i raise a PR for the changes ?

mahajanparth avatar Mar 04 '24 11:03 mahajanparth

That sounds like a significant speedup! Could you please open a PR with your changes? It would speed up the review process a lot.

p-wysocki avatar Mar 04 '24 12:03 p-wysocki

@p-wysocki please find the PR at #23261

mahajanparth avatar Mar 05 '24 13:03 mahajanparth