numpower icon indicating copy to clipboard operation
numpower copied to clipboard

[FEAT] Implement benchmark for CPU and GPU for linear algebra, arithmetic and initializer methods

Open henrique-borba opened this issue 1 year ago • 6 comments

Create the benchmark using phpbench (https://github.com/phpbench/phpbench), a solid and well-maintained tool.

  • [x] Add phpbench as requirement (require-dev)
  • [x] Add benchmarks for the Initializers (https://numpower.org/api/category/initializers)
  • [ ] Add benchmarks for the linear algebra methods (https://numpower.org/api/category/linear-algebra)
  • [ ] Add benchmarks for the arithmetic methods (https://numpower.org/api/category/arithmetics)
  • [ ] Add benchmarks for sum and products methods (https://numpower.org/api/category/sums-products-differences)

henrique-borba avatar Jul 08 '24 20:07 henrique-borba

I would like to contribute and work on this feature

jiyo4476 avatar Jul 09 '24 18:07 jiyo4476

Nice @jiyo4476, thanks!

You can start with the initializers first so we can discuss a pattern and see what it looks like.

I was thinking of 3 matrices of sizes 10x100, 1000x500 and 10000x1000 and 3 vectors of size 100, 500, 1000 elements. This way we could also use it to identify algorithms that are potentially less performant with larger/smaller arrays.

When you want me to take a look, you can open the merge request. Ignore the merge request template guidelines as this issue does not apply.

henrique-borba avatar Jul 11 '24 14:07 henrique-borba

Thank you! @henrique-borba

I created a new branch at https://github.com/jiyo4476/numpower and submitted a pull request. I added a composer.json file and installed dependencies with composer install.

Then I ran the benchmarks using ./vendor/bin/phpbench run benchmarks/initializers --report=aggregate

Currently, I only ran the tests with the compilation for CPU. I wanted to make sure I was adding the benchmarks correctly.

jiyo4476 avatar Jul 15 '24 01:07 jiyo4476

I was focused on update 0.6.0 but now I'm going to prioritize your MR.

Thanks again @jiyo4476

henrique-borba avatar Jul 16 '24 16:07 henrique-borba

Made another pull request to be reviewed for the benchmarks for the other benchmarks. I would love to be able to help with other features as well.

Please review @henrique-borba

jiyo4476 avatar Sep 21 '24 20:09 jiyo4476

@jiyo4476 Hi, sorry for the delay, I had a big project at work and was also finishing another open source project for PHP. I'll do the review this week as soon as I get back to my home city. Thanks again.

henrique-borba avatar Sep 22 '24 17:09 henrique-borba