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

Benchmark internal STARDIS functions #85

Merged
merged 12 commits into from
Aug 18, 2023

Conversation

light2802
Copy link
Contributor

📝 Description

Type: 🪲 bugfix | 🚀 feature | 🚦 testing 🎢 infrastructure

This PR adds workflow to benchmark internal stardis functions like raytrace

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@light2802 light2802 force-pushed the internal_func branch 12 times, most recently from 8baec7b to 94520da Compare July 12, 2023 07:51
@light2802 light2802 added the benchmarks Trigger benchmarks to run on this pr label Jul 12, 2023
@light2802 light2802 force-pushed the internal_func branch 2 times, most recently from ffb1e29 to 8ecc43a Compare July 12, 2023 08:35
@light2802 light2802 marked this pull request as ready for review July 12, 2023 09:20
@light2802
Copy link
Contributor Author

This PR is based on top of PR #85 . So lets merge that first

@jvshields
Copy link
Contributor

This PR is based on top of PR #85 . So lets merge that first

Sorry, do you mean 74? 85 is this PR.

@light2802
Copy link
Contributor Author

This PR is based on top of PR #85 . So lets merge that first

Sorry, do you mean 74? 85 is this PR.

Sorry , yes PR #74

@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Merging #85 (7e5e053) into main (437e371) will not change coverage.
The diff coverage is n/a.

❗ Current head 7e5e053 differs from pull request most recent head 1474791. Consider uploading reports for the commit 1474791 to get more accurate results

@@           Coverage Diff           @@
##             main      #85   +/-   ##
=======================================
  Coverage   33.89%   33.89%           
=======================================
  Files          17       17           
  Lines         658      658           
=======================================
  Hits          223      223           
  Misses        435      435           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

jvshields
jvshields previously approved these changes Aug 3, 2023
@atharva-2001
Copy link
Member

I think this needs a rebase @light2802

@tardis-bot
Copy link
Contributor

tardis-bot commented Aug 9, 2023

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing main (437e371) and the latest commit (1474791).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts here.
Significantly changed benchmarks:

All benchmarks:

All benchmarks:

     before           after         ratio
   [437e3711]       [1474791c]
     10.3±0.01s       10.3±0.09s     1.00  run_stardis.BenchmarkStardis.time_calc_alpha
      206±0.7ms          201±2ms     0.97  run_stardis.BenchmarkStardis.time_raytrace
         failed           failed      n/a  run_stardis.BenchmarkStardis.time_run_stardis

@andrewfullard andrewfullard merged commit 384031f into tardis-sn:main Aug 18, 2023
5 checks passed
jvshields added a commit that referenced this pull request Aug 21, 2023
* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* removing copied files

* add back voigt test

* further clean up stardis/base.py

* remove transport files

* update documentation

* Add CUDA GPU JIT compilation to `faddeeva()` (#107)

* Add cuda import

* Add cuda boilerplate for faddeeva

* Add square root of pi as constant to scope of entire file

* Add faddeeva_cuda test

* Vectorize faddeeva

* Refactor faddeeva to be vectorized and work with cuda

* Clean up faddeeva_cuda test

* Rename variables to keep with convention

* Refactor faddeeva_gpu and include associated tests

* Add functionality for more datatypes for faddeeva_cuda

Also add associated tests

* Clean up faddeeva_gpu tests by testing numpy and cuda array types separately

* Optimize faddeeva function to be branchless

* Use cupy arrays instead of numba.cuda arrays

Also call faddeeva_cuda with prespecified numbers of blocks and threads

* Only import cupy if the machine has GPUs available

* Typecast input to complex

* Size should be of output array

* Return cupy array by default

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* add units to stardis outputs (#122)

* add units to stardis outputs

* explicitly declare units to F_lambda

* Benchmark internal STARDIS functions (#85)

* Fix posting comment

* Try addding token as env var

* Put env var at correct place

* fix benchmark comment bug

* Benchmark raytrace function

* Correct path for config soft link

* Increase timeout time for raytrace benchmark

* Add code to benchmark calc_alpha_line_at_nu

* Add push trigger for all branches temporarily

* Group all the benchmarking code under one class

* Add tracing_lambdas attribute to benchmark class

* Update benchmark setup

* Fix breaking benchmark pipeline (#128)

* Refactor and add CUDA JIT compilation to `voigt_profile()` (#113)

* Add pi as a constant with file scope

* Use real attribute of datatype rather than numpy call

* Vectorize voigt_profile and add tests

* Change indenting to improve readability

* Typecast inputs to float and remove tests that include complex inputs

* Add cuda versions of voigt_profile along with associated tests

* Return cupy array by default

* Size should be of output array

* Fix typo in mathematical formula for `voigt_profile()`

* Fix unit tests

* Add CUDA JIT to `calc_n_effective()` (#119)

* Add basic test for `calc_doppler_width()`

* Refactor `calc_doppler_width()` and add test for vectorized implementation

* Typecast to float

* Add unwrapped cuda implementation of doppler_width

Also typecast all global constants to float

* Add wrapped cuda implementation of calc_doppler_width

* Return cupy array by default

* Add test for `calc_n_effective()`

* Typecast inputs and refactor

* Add cuda implementations and tests for `calc_n_effective()`

* Return cupy array by default

* Revert changes to `voigt_profile()` formula (#131)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* add back voigt test

* removing copied files

* further clean up stardis/base.py

* remove transport files

* update documentation

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* fix imports

* fix broadening merge

* apply black

* change benchmark paths

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>
jvshields added a commit to jvshields/stardis that referenced this pull request Aug 22, 2023
* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* removing copied files

* add back voigt test

* further clean up stardis/base.py

* remove transport files

* update documentation

* Add CUDA GPU JIT compilation to `faddeeva()` (tardis-sn#107)

* Add cuda import

* Add cuda boilerplate for faddeeva

* Add square root of pi as constant to scope of entire file

* Add faddeeva_cuda test

* Vectorize faddeeva

* Refactor faddeeva to be vectorized and work with cuda

* Clean up faddeeva_cuda test

* Rename variables to keep with convention

* Refactor faddeeva_gpu and include associated tests

* Add functionality for more datatypes for faddeeva_cuda

Also add associated tests

* Clean up faddeeva_gpu tests by testing numpy and cuda array types separately

* Optimize faddeeva function to be branchless

* Use cupy arrays instead of numba.cuda arrays

Also call faddeeva_cuda with prespecified numbers of blocks and threads

* Only import cupy if the machine has GPUs available

* Typecast input to complex

* Size should be of output array

* Return cupy array by default

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* add units to stardis outputs (tardis-sn#122)

* add units to stardis outputs

* explicitly declare units to F_lambda

* Benchmark internal STARDIS functions (tardis-sn#85)

* Fix posting comment

* Try addding token as env var

* Put env var at correct place

* fix benchmark comment bug

* Benchmark raytrace function

* Correct path for config soft link

* Increase timeout time for raytrace benchmark

* Add code to benchmark calc_alpha_line_at_nu

* Add push trigger for all branches temporarily

* Group all the benchmarking code under one class

* Add tracing_lambdas attribute to benchmark class

* Update benchmark setup

* Fix breaking benchmark pipeline (tardis-sn#128)

* Refactor and add CUDA JIT compilation to `voigt_profile()` (tardis-sn#113)

* Add pi as a constant with file scope

* Use real attribute of datatype rather than numpy call

* Vectorize voigt_profile and add tests

* Change indenting to improve readability

* Typecast inputs to float and remove tests that include complex inputs

* Add cuda versions of voigt_profile along with associated tests

* Return cupy array by default

* Size should be of output array

* Fix typo in mathematical formula for `voigt_profile()`

* Fix unit tests

* Add CUDA JIT to `calc_n_effective()` (tardis-sn#119)

* Add basic test for `calc_doppler_width()`

* Refactor `calc_doppler_width()` and add test for vectorized implementation

* Typecast to float

* Add unwrapped cuda implementation of doppler_width

Also typecast all global constants to float

* Add wrapped cuda implementation of calc_doppler_width

* Return cupy array by default

* Add test for `calc_n_effective()`

* Typecast inputs and refactor

* Add cuda implementations and tests for `calc_n_effective()`

* Return cupy array by default

* Revert changes to `voigt_profile()` formula (tardis-sn#131)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* add back voigt test

* removing copied files

* further clean up stardis/base.py

* remove transport files

* update documentation

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* fix imports

* fix broadening merge

* apply black

* change benchmark paths

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>
andrewfullard pushed a commit that referenced this pull request Sep 11, 2023
* Restructure: Add radiation field (#123)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* removing copied files

* add back voigt test

* further clean up stardis/base.py

* remove transport files

* update documentation

* Add CUDA GPU JIT compilation to `faddeeva()` (#107)

* Add cuda import

* Add cuda boilerplate for faddeeva

* Add square root of pi as constant to scope of entire file

* Add faddeeva_cuda test

* Vectorize faddeeva

* Refactor faddeeva to be vectorized and work with cuda

* Clean up faddeeva_cuda test

* Rename variables to keep with convention

* Refactor faddeeva_gpu and include associated tests

* Add functionality for more datatypes for faddeeva_cuda

Also add associated tests

* Clean up faddeeva_gpu tests by testing numpy and cuda array types separately

* Optimize faddeeva function to be branchless

* Use cupy arrays instead of numba.cuda arrays

Also call faddeeva_cuda with prespecified numbers of blocks and threads

* Only import cupy if the machine has GPUs available

* Typecast input to complex

* Size should be of output array

* Return cupy array by default

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* add units to stardis outputs (#122)

* add units to stardis outputs

* explicitly declare units to F_lambda

* Benchmark internal STARDIS functions (#85)

* Fix posting comment

* Try addding token as env var

* Put env var at correct place

* fix benchmark comment bug

* Benchmark raytrace function

* Correct path for config soft link

* Increase timeout time for raytrace benchmark

* Add code to benchmark calc_alpha_line_at_nu

* Add push trigger for all branches temporarily

* Group all the benchmarking code under one class

* Add tracing_lambdas attribute to benchmark class

* Update benchmark setup

* Fix breaking benchmark pipeline (#128)

* Refactor and add CUDA JIT compilation to `voigt_profile()` (#113)

* Add pi as a constant with file scope

* Use real attribute of datatype rather than numpy call

* Vectorize voigt_profile and add tests

* Change indenting to improve readability

* Typecast inputs to float and remove tests that include complex inputs

* Add cuda versions of voigt_profile along with associated tests

* Return cupy array by default

* Size should be of output array

* Fix typo in mathematical formula for `voigt_profile()`

* Fix unit tests

* Add CUDA JIT to `calc_n_effective()` (#119)

* Add basic test for `calc_doppler_width()`

* Refactor `calc_doppler_width()` and add test for vectorized implementation

* Typecast to float

* Add unwrapped cuda implementation of doppler_width

Also typecast all global constants to float

* Add wrapped cuda implementation of calc_doppler_width

* Return cupy array by default

* Add test for `calc_n_effective()`

* Typecast inputs and refactor

* Add cuda implementations and tests for `calc_n_effective()`

* Return cupy array by default

* Revert changes to `voigt_profile()` formula (#131)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* add back voigt test

* removing copied files

* further clean up stardis/base.py

* remove transport files

* update documentation

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* fix imports

* fix broadening merge

* apply black

* change benchmark paths

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>

* fix voigt test that got overwritten by the rebase

* add black to voigt.py

* include fixto voight profile from pr 131

* fix benchmarks

* further fix of benchmarks

* remove blackbody import comment in radiation_field_solvers/base.py

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>
smokestacklightnin pushed a commit to smokestacklightnin/stardis that referenced this pull request Sep 20, 2023
* Fix posting comment

* Try addding token as env var

* Put env var at correct place

* fix benchmark comment bug

* Benchmark raytrace function

* Correct path for config soft link

* Increase timeout time for raytrace benchmark

* Add code to benchmark calc_alpha_line_at_nu

* Add push trigger for all branches temporarily

* Group all the benchmarking code under one class

* Add tracing_lambdas attribute to benchmark class

* Update benchmark setup
smokestacklightnin added a commit to smokestacklightnin/stardis that referenced this pull request Sep 20, 2023
* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* removing copied files

* add back voigt test

* further clean up stardis/base.py

* remove transport files

* update documentation

* Add CUDA GPU JIT compilation to `faddeeva()` (tardis-sn#107)

* Add cuda import

* Add cuda boilerplate for faddeeva

* Add square root of pi as constant to scope of entire file

* Add faddeeva_cuda test

* Vectorize faddeeva

* Refactor faddeeva to be vectorized and work with cuda

* Clean up faddeeva_cuda test

* Rename variables to keep with convention

* Refactor faddeeva_gpu and include associated tests

* Add functionality for more datatypes for faddeeva_cuda

Also add associated tests

* Clean up faddeeva_gpu tests by testing numpy and cuda array types separately

* Optimize faddeeva function to be branchless

* Use cupy arrays instead of numba.cuda arrays

Also call faddeeva_cuda with prespecified numbers of blocks and threads

* Only import cupy if the machine has GPUs available

* Typecast input to complex

* Size should be of output array

* Return cupy array by default

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* add units to stardis outputs (tardis-sn#122)

* add units to stardis outputs

* explicitly declare units to F_lambda

* Benchmark internal STARDIS functions (tardis-sn#85)

* Fix posting comment

* Try addding token as env var

* Put env var at correct place

* fix benchmark comment bug

* Benchmark raytrace function

* Correct path for config soft link

* Increase timeout time for raytrace benchmark

* Add code to benchmark calc_alpha_line_at_nu

* Add push trigger for all branches temporarily

* Group all the benchmarking code under one class

* Add tracing_lambdas attribute to benchmark class

* Update benchmark setup

* Fix breaking benchmark pipeline (tardis-sn#128)

* Refactor and add CUDA JIT compilation to `voigt_profile()` (tardis-sn#113)

* Add pi as a constant with file scope

* Use real attribute of datatype rather than numpy call

* Vectorize voigt_profile and add tests

* Change indenting to improve readability

* Typecast inputs to float and remove tests that include complex inputs

* Add cuda versions of voigt_profile along with associated tests

* Return cupy array by default

* Size should be of output array

* Fix typo in mathematical formula for `voigt_profile()`

* Fix unit tests

* Add CUDA JIT to `calc_n_effective()` (tardis-sn#119)

* Add basic test for `calc_doppler_width()`

* Refactor `calc_doppler_width()` and add test for vectorized implementation

* Typecast to float

* Add unwrapped cuda implementation of doppler_width

Also typecast all global constants to float

* Add wrapped cuda implementation of calc_doppler_width

* Return cupy array by default

* Add test for `calc_n_effective()`

* Typecast inputs and refactor

* Add cuda implementations and tests for `calc_n_effective()`

* Return cupy array by default

* Revert changes to `voigt_profile()` formula (tardis-sn#131)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* add back voigt test

* removing copied files

* further clean up stardis/base.py

* remove transport files

* update documentation

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* fix imports

* fix broadening merge

* apply black

* change benchmark paths

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>
smokestacklightnin added a commit to smokestacklightnin/stardis that referenced this pull request Sep 20, 2023
* Restructure: Add radiation field (tardis-sn#123)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* removing copied files

* add back voigt test

* further clean up stardis/base.py

* remove transport files

* update documentation

* Add CUDA GPU JIT compilation to `faddeeva()` (tardis-sn#107)

* Add cuda import

* Add cuda boilerplate for faddeeva

* Add square root of pi as constant to scope of entire file

* Add faddeeva_cuda test

* Vectorize faddeeva

* Refactor faddeeva to be vectorized and work with cuda

* Clean up faddeeva_cuda test

* Rename variables to keep with convention

* Refactor faddeeva_gpu and include associated tests

* Add functionality for more datatypes for faddeeva_cuda

Also add associated tests

* Clean up faddeeva_gpu tests by testing numpy and cuda array types separately

* Optimize faddeeva function to be branchless

* Use cupy arrays instead of numba.cuda arrays

Also call faddeeva_cuda with prespecified numbers of blocks and threads

* Only import cupy if the machine has GPUs available

* Typecast input to complex

* Size should be of output array

* Return cupy array by default

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* add units to stardis outputs (tardis-sn#122)

* add units to stardis outputs

* explicitly declare units to F_lambda

* Benchmark internal STARDIS functions (tardis-sn#85)

* Fix posting comment

* Try addding token as env var

* Put env var at correct place

* fix benchmark comment bug

* Benchmark raytrace function

* Correct path for config soft link

* Increase timeout time for raytrace benchmark

* Add code to benchmark calc_alpha_line_at_nu

* Add push trigger for all branches temporarily

* Group all the benchmarking code under one class

* Add tracing_lambdas attribute to benchmark class

* Update benchmark setup

* Fix breaking benchmark pipeline (tardis-sn#128)

* Refactor and add CUDA JIT compilation to `voigt_profile()` (tardis-sn#113)

* Add pi as a constant with file scope

* Use real attribute of datatype rather than numpy call

* Vectorize voigt_profile and add tests

* Change indenting to improve readability

* Typecast inputs to float and remove tests that include complex inputs

* Add cuda versions of voigt_profile along with associated tests

* Return cupy array by default

* Size should be of output array

* Fix typo in mathematical formula for `voigt_profile()`

* Fix unit tests

* Add CUDA JIT to `calc_n_effective()` (tardis-sn#119)

* Add basic test for `calc_doppler_width()`

* Refactor `calc_doppler_width()` and add test for vectorized implementation

* Typecast to float

* Add unwrapped cuda implementation of doppler_width

Also typecast all global constants to float

* Add wrapped cuda implementation of calc_doppler_width

* Return cupy array by default

* Add test for `calc_n_effective()`

* Typecast inputs and refactor

* Add cuda implementations and tests for `calc_n_effective()`

* Return cupy array by default

* Revert changes to `voigt_profile()` formula (tardis-sn#131)

* setting up radiation field structure

* further work moving structures around

* hook up radiation field to run_stardis()

* fix bug with output

* add back voigt test

* removing copied files

* further clean up stardis/base.py

* remove transport files

* update documentation

* Change name of blackbody function. Hook up RadiationField.source_function to raytrace.

* fix imports

* fix broadening merge

* apply black

* change benchmark paths

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>

* fix voigt test that got overwritten by the rebase

* add black to voigt.py

* include fixto voight profile from pr 131

* fix benchmarks

* further fix of benchmarks

* remove blackbody import comment in radiation_field_solvers/base.py

---------

Co-authored-by: smokestacklightnin <[email protected]>
Co-authored-by: light2802 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmarks Trigger benchmarks to run on this pr
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants