-
Notifications
You must be signed in to change notification settings - Fork 45
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
Project 12: High-level programming paradigm comparison #46
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In this notebook we explore the performance of using lists and NumPy arrays to update 3D fields using pointwise stencils (copy and sin()) and two variants of a simple 1D stencil.
The script has not been tested on the cluster. The dependencies are managed using PDM using pdm add <dependency>. I configured the pyrpoject.toml so that versions are chosen compatible with python >=3.9 (which is the version used by cray-python in the cluster).
I commit this so I can checkout to their code and fix their stencil2d module. Will complete this after I'm done with that.
The result field is not exactly the same as the one from the original code, but it's close enough to be able to do the benchmark analysis. To achieve correctness we have to implement the `extend` kwarg, and for that probably we cannot use the @Stencil decorator as it is the current version of numba.
Now the diffusion operator is computed explicitly instead of calling two times the laplace operator. In this way we achieve correctness and the code is also faster since @jit(parallel=True) optimizes better the code
No need to create a new Jupyter kernel. We can reuse the HPC4WC_kernel from the course
@cuda.jit is not a simple replacement for @numba.jit, so I don't think it fits good to have a dedicated section in this notebook. Maybe we can revisit this later if we have time.
Changes so far till 1D GT4Py stencil work.
Add Jupyter notebook with initial tests
This allows to diff and merge jupyter notebooks locally
…ebook and added basic function. Don't know if it works on the cluster.
… numpy backend successful. Rewrite initiate function in common.py.
We are using the latest stable tag (v1.0.1). We had to downgrade NumPy becuase GT4Py is not compatible with NumPy > 1.24.
* Use main branch in README instructions * Delete Jupyter kernel folder so it doesn't fail when reinstalling
iter() is a built-in function(), so let's avoid using this name for a variable
…and 2D stencil part (WIP). Renew result.csv
Now it is possible to pass the desired order of the dimensions. It can by any of the 6 possible permutations.
By removing num_iter and num_halo as arguments of the apply_diffusion() function, Numba compiler can do a much better work, improving run time from ~60 ms to ~15 ms.
Same argument as previous fix in the stencil2d module. If num_iter is even, the output is not correct because the swapping only affects the scope of the function.
…ointwise code in GT4Py.
We were not recompiling the functions decorated with @numba.jit, so we were always computing with NX=NY=128 and NZ=80 instead of the new values. That is why the run times with Numba were almost constant for all the array sizes.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @ofuhrer @twicki
This is the PR for the project 12 about high-level programming accelerators.
Authors: @dymastery @iyanmv