Skip to content

Conversation

ahmadsharif1
Copy link
Contributor

@ahmadsharif1 ahmadsharif1 commented Nov 11, 2024

The batch mode is a new mode that decodes a batch of 40 copies of the decoder using 8 threads.

Tested:

video=/home/ahmads/personal/torchcodec/benchmarks/decoders/../../test/resources/nasa_13013.mp4, decoder=TorchCodecPublic
[---------------------------------------------------------------- video=/home/ahmads/personal/torchcodec/benchmarks/decoders/../../test/resources/nasa_13013.mp4 h264 480x270, 13.013s 29.97002997002997fps -----------------------------------------------------------------]
                        |  uniform 10 seek()+next()  |  batch uniform 10 seek()+next()  |  random 10 seek()+next()  |  batch random 10 seek()+next()  |  1 next()  |  batch 1 next()  |  10 next()  |  batch 10 next()  |  100 next()  |  batch 100 next()  |  create()+next()
1 threads: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      TorchCodecPublic  |            67.0            |              841.9               |            60.5           |              743.9              |    21.4    |      219.4       |     24.1    |       276.5       |     69.9     |       812.5        |                 
      TorchCodecCore    |                            |                                  |                           |                                 |            |                  |             |                   |              |                    |        18.5     

Times are in milliseconds (ms).

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2024
@scotts
Copy link
Contributor

scotts commented Nov 12, 2024

I assume the removal of the other decoders is temporary while getting everything working?

On the chart generated by generate_readme_*.py, I think we want to be selective on what we add to it. I think we want no more than four experiments per row. This is in contrast to the output from benchmark_decoders.py, where we can have many experiments. I see benchmark_decoders.py as a perf development tool, and generate_readme_*.py as our external showcase.

Copy link
Contributor Author

@ahmadsharif1 ahmadsharif1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't want to update the chart or data in this PR.

I just want the cli tool to have the option to benchmark throughput for now.

CUDA and decord may not work in the same process (I haven't tested those). I just wanted the ability to benchmark throughput. I already got an interesting finding that the cuda decoder is slower on some videos.

@ahmadsharif1 ahmadsharif1 changed the title Add batch benchmarks and cuda decoder Add the ability to benchmark throughput using multiple threads Nov 12, 2024
@ahmadsharif1 ahmadsharif1 marked this pull request as ready for review November 12, 2024 15:50
return VideoDecoder(video_file_path).metadata


class BatchParameters(NamedTuple):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason we're using NamedTuple and not a dataclass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would be lighterweight than dataclass, but I am not too sure. Do you have a preference?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer dataclasses. There are some instances where you need to use a namedtuple, but in general, I consider dataclasses to have supplanted namedtuples.

@ahmadsharif1 ahmadsharif1 merged commit bd9d5cb into meta-pytorch:main Nov 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants