Repository navigation
Working with regridding using YAC in UXARRAY #1810
dylannelson
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Working with some of the team on UCAR's HPC resources, specifcically CASPER in my case, I was able to get some regridding functions and workflows working using YAC. It has a comparatively more difficult install than other packages, as it needs to be downloaded separately from
conda/pip, and connected to a python environment manually. Here's roughly how I was able to get a YAC friendly python environment working for me:Before you start
Change the first line to give your future conda environment a different name, or the second to chose where all the build files will be installed. I chose to make it in my home directory to make it easier to group all my regridding work into one folder, including my scripts. Both of these lines are just setting variables that the rest of the code will use. Meaning if you close your terminal between this command and any of the upcoming commands, they won't work. Any time you see
$ENV_NAMEit's referring to this line, so you hopefully don't need to manually change any of the following commands. Copy + Pasting them exactly as they appear below should work.1. Modules
Load the same modules for the build and for every later run, so the compiler and MPI runtime libraries match.
2. The environment
Answer
ythen check some of the important packages:uxarraymust be2026.09.0(or newer) andnumbaandnetcdf4must both be listed (this may vary in the future, but we need to make sure these packages are here). Then:conda activate "$ENV_NAME"You can add
ipykernelif you need this env to work in JupyterHub.3. mpi4py, built against Casper's MPI
Not from a wheel here, it must link the same MPI as YAC:
Check
which mpiccfirst. It must print a path under/glade/u/apps, not one inside the conda env. A conda path means the env has its own MPI and the build will link the wrong one.4. YAXT
This is a long one line install for YAXT, while convoluted, it's still similar to what's on the official docs. It's one
&&chain, so it stops at the first failure and printsYAXT OKonly if every step worked. If you see that line printed in the terminal, you should be all good.5. YAC
Similar to the above command, if you see "YAC OK" you should be all good and it installed correctly
This builds only YAC's core library and Python bindings, which is what UXarray uses.
If a block stops, the error is just above where it stopped. For a
configurefailure:6. Make the env find it
YAC installs outside the env (you should now see it in a
buildorYAC_Installfolder withinRegriddingif you used the same path I did. This should set the 2 variables needed to connect YAC to the conda package:Reactivate to pick it up:
7. Verify
python -c "import mpi4py; from uxarray.remap.yac import _import_yac; print(_import_yac().__file__)"Expected: a path under
$REGRID_DIR/YAC_Install, i.e./glade/u/home/$USER/Regridding/YAC_Install/lib/python3.14/site-packages/yac/__init__.py. A pathinside the conda env instead means you are importing a PyPI
yacwheel, not this build.import mpi4pycomes first on purpose: with Open MPI 5 it has to loadlibmpibeforeyac.core.For a real test, run UXarray's YAC suite:
16 passed is the expected result
At this time we were having some odd interactions with minimum versions for packages like cartopy, and this may need to be revised in the future as we are in the middle of changing how some default packages work with UXarray. If you have any concerns or different outputs, please comment below, as we would appreciate seeing how this method works for others and how it can be improved.
8. Every session after this
To open the env later on, especially in a new terminal, it's preferred to activate like this to ensure the packages are opened in the right order:
module load gcc openmpi/5.0.8 conda && conda activate YAC_IntroChange the
YAC_Introto whatever you named the env, if you changed itAll reactions