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

Implemented Numba JIT compilation for planck_function() and performan… #2527

Closed
wants to merge 3 commits into from

Conversation

leilayesufu
Copy link

@leilayesufu leilayesufu commented Mar 4, 2024

…ce comparison

📝 Description

Type: :| 📝 documentation

This pull request introduces enhancements to the TARDIS project's Jupyter Notebook responsible for creating the initialization page of the documentation. Specifically, the following modifications have been implemented:

  • Numba JIT Compilation for planck_function(): The planck_function() function, located in code cell 6 of the notebook, has been optimized by implementing Numba JIT compilation.

  • Performance Benchmarking: A comparison of the execution time between the original planck_function() and the JIT-compiled version has been conducted. This comparison is performed for different numbers of frequency bins (100, 200, and 500), as specified in code cell 7. The goal is to assess the performance improvement achieved through Numba JIT compilation under varying computational workloads.

📌 Resources

Link to the Jupyter Notebook: This is the Jupyter Notebook where the changes were made. here

🚦 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.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@leilayesufu
Copy link
Author

@andrewfullard @atharva-2001 Kindly review my PR. It is the first Objective of the idea Parallelization and GPU in the list of GSOC ideas here

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a good start! As a note, it's much better to use njit than the jit decoratpr, or you can do jit(nopython=True), which is functionally equivalent. Using just the jit decorator means that the code will fall back on python if it can't figure out how to compile.

Also, it'd be good to separate the timings from the plots. For this first objective, we're mainly interested in seeing the code timings.

Finally, if you could be a bit more systematic about execution timing, by running each of the bin sizes some number of times and finding the mean and standard deviation of the execution times, that would be really interesting.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your feedback! I've made the following adjustments:

  • I replaced the jit decorator with njit for Numba compilation, ensuring better performance.
  • I separated the timing measurements from the plots, focusing solely on code timings as requested.
  • I adopted a more systematic approach to timing by running each bin size multiple times and calculating the mean and standard deviation of the execution times.
    Here are the results of the execution times:
Mean and standard deviation of execution times for the original function:

Bin size: 100, Mean time: 0.0006856918334960938, Standard deviation: 0.0003326150415747104
Bin size: 200, Mean time: 0.0007090330123901367, Standard deviation: 0.00037616331345380154
Bin size: 500, Mean time: 0.0006082057952880859, Standard deviation: 0.00011986670416905664

Mean and standard deviation of execution times for the njit-compiled function:

Bin size: 100, Mean time: 6.556510925292969e-05, Standard deviation: 2.453465036165e-05
Bin size: 200, Mean time: 6.003379821777344e-05, Standard deviation: 9.53423944032505e-06
Bin size: 500, Mean time: 6.287097930908203e-05, Standard deviation: 1.4083274673289586e-05

@jvshields jvshields marked this pull request as draft March 6, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants