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

Project 12: High-level programming paradigm comparison #46

Merged
merged 126 commits into from
Oct 14, 2023

Conversation

iyanmv
Copy link
Contributor

@iyanmv iyanmv commented Sep 11, 2023

Hi @ofuhrer @twicki

This is the PR for the project 12 about high-level programming accelerators.

Authors: @dymastery @iyanmv

iyanmv and others added 30 commits July 24, 2023 00:48
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
Now it is possible to pass the desired order of the dimensions. It can
by any of the 6 possible permutations.
iyanmv and others added 27 commits September 9, 2023 17:05
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.
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.
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ofuhrer ofuhrer merged commit c07be60 into ofuhrer:main Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants