Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 of 5 tasks
henrique-borba opened this issue Jul 8, 2024 · 6 comments · Fixed by #63
Open
2 of 5 tasks
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@henrique-borba
Copy link
Member

henrique-borba commented Jul 8, 2024

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

@henrique-borba henrique-borba added the enhancement New feature or request label Jul 8, 2024
@henrique-borba henrique-borba added this to the 0.6.0 milestone Jul 8, 2024
@henrique-borba henrique-borba self-assigned this Jul 8, 2024
@henrique-borba henrique-borba removed their assignment Jul 8, 2024
@henrique-borba henrique-borba added the good first issue Good for newcomers label Jul 8, 2024
@jiyo4476
Copy link
Contributor

jiyo4476 commented Jul 9, 2024

I would like to contribute and work on this feature

@henrique-borba
Copy link
Member Author

henrique-borba commented Jul 11, 2024

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 henrique-borba removed this from the 0.6.0 milestone Jul 11, 2024
@jiyo4476
Copy link
Contributor

jiyo4476 commented Jul 15, 2024

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.

@henrique-borba
Copy link
Member Author

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

Thanks again @jiyo4476

@jiyo4476
Copy link
Contributor

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

@henrique-borba
Copy link
Member Author

@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 added a commit that referenced this issue Sep 30, 2024
…oses #57 (#65)

* CPU Benchmark files for initializers

Added benchmark files for CPU initializers using phpBench

* New methods and features for 0.6.0 (#64)

* feat: squeeze manipulation routine with axis support

* feat: NDArray::full implementation

* feat: NDArray::fill release

* feat: argmin and argmax with axis support

* feat: NDArray::positive implementation

* feat: NDArray::reciprocal implementation

* feat: NDArray::reciprocal stubs

* feat: NDArray::reciprocal stubs

* feat: NDArray::swapaxes implementation
feat: NDArray::transpose permutation

* feat: NDArray::swapaxes and new transpose stubs

* feat: NDArray::argmin and argmax keepdims option

* feat: NDArray::rollaxis implementation

* feat: NDArray::moveaxis implementation

* fix: improvements to the slicing mechanism

* feat: ndarray slicing stubs

* fix: fixed slicing shape when arrays contain values

* feat: hstack, vstack and dstack implementation

* feat: column_stack implementation

* feat: column_stack PHP stubs

* feat: NDArray::concatenate implementation

* feat: NDArray::append implementation

* feat: NDArray::append stubs

* docs: update README.md

* fix: NDArray::append memory leak when using PHP arrays as arguments.

* fix: new routines GPU implementation

* Added Param Providers

+ Added parameter providers for readability and coding best practices

- removed repetitive code

* Added default phpbench file

+ Added default PHPBench configuration file

* Update composer.json

* Update initializers.c

Fixed comment for NDArray ones

* Fixed setUp for benchmarking

Refactored function names for clarity, and fixed phpBench setup method

* Added benchmarks for the linear algebra methods

Added benchmarks for Linear Algebra methods with the exception of functions Cond, Inv, and Qr

* Added benchmarks for sum and products methods

Added benchmarks for sum and products methods

* Added benchmarks for the arithmetic methods

Added benchmarks for the arithmetic methods
- removed initial testArray values

* Added default values for aggregate benchmarking

Added default Revs and iteration values for more accurate runtime time estimates.

* Added Benchmarks for QR decomp, Condi, and Inverse

- remove extra comments on Cholesky benchmark file
- removed extra param comment in linalg file
+ Benchmark for QR decomposition function
+ Benchmark for Inverse function
+ Benchmark for Cond function

* Added annotations and ignore configure~ file

+ Updated .gitignore to ignore generated configure file
+ Added MIT license under composer file

* Added Group annotations

Added Group annotations to all benchmarks.

* Update readability of ArrayInitializerBench

Updated Array Initializer Benchmark to utilize zeros Initializer for setup instead of hard coded arrays

* Temp files in .gitignore

Removed temp files from .gitignore

---------

Co-authored-by: Henrique Borba <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Development

Successfully merging a pull request may close this issue.

2 participants