Skip to content

Use mamba to install Continuous Integration dependencies - #841

Merged
weiji14 merged 13 commits into
mainfrom
mambaforge
Sep 18, 2021
Merged

Use mamba to install Continuous Integration dependencies#841
weiji14 merged 13 commits into
mainfrom
mambaforge

Conversation

@weiji14

@weiji14weiji14 commented Feb 6, 2021

Copy link
Copy Markdown
Member

Description of proposed changes

To cut down on our Continuous Integration's installation time (~9 min on Windows), let's replace conda with a more efficient installer called mamba! Specifically using mambaforge which is a faster miniconda replacement that defaults to using the conda-forge channel and mamba instead of conda by default.

Continuation of #813 which sped up our Continuous Documentation builds.

Update September 2021: Below shows comparison on Windows - Python 3.9 with a 5min speedup (18m44s -> 13m42s), this is without caching.

Old using conda (18m 44s)New using mamba (13m 42s)
imageimage

More benchmarks:

BuildOld timeNew timeDiff
ubuntu-latest - Python 3.7 / NumPy 1.1810m27s9m8s-1m19s
macOS-latest - Python 3.7 / NumPy 1.1814m42s10m11s-4m31s
windows-latest - Python 3.7 / NumPy 1.1817m12s13m0s-4m12s
ubuntu-latest - Python 3.9 / NumPy 1.2113m22s7m32s-5m50s
macOS-latest - Python 3.9 / NumPy 1.2117m4s13m15s-3m49s
windows-latest - Python 3.9 / NumPy 1.2119m12s14m41s-4m41s

References:

Addresses #584

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

Specifically using `mambaforge` which is a `miniconda`
replacement that defaults to using the `conda-forge`
channel and `mamba` instead of `conda` by default.
@weiji14weiji14 added the maintenance Boring but important stuff for the core devs label Feb 6, 2021
@weiji14weiji14 changed the title Use mamba to install Continuous Integration dependenciesWIP: Use mamba to install Continuous Integration dependenciesFeb 6, 2021
Delete the requirements-dev.txt file, and update the ci_test.yml to install GMT dependencies while setting up mamba.
@seisman

Copy link
Copy Markdown
Member

Should we try the cache action?

@weiji14

Copy link
Copy Markdown
MemberAuthor

Should we try the cache action?

Sure, feel free to try it out in this branch. I'll be heading out for most of the day.

@seisman

Copy link
Copy Markdown
Member

As you can see, caching (bf1e97d) doesn't help.

See PR #932 for another test. It's clear that fewer packages mean faster speed.

@weiji14weiji14 changed the title WIP: Use mamba to install Continuous Integration dependenciesUse mamba to install Continuous Integration dependenciesSep 17, 2021
@weiji14
weiji14 marked this pull request as ready for review September 17, 2021 11:44

@weiji14weiji14 left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

As you can see, caching (bf1e97d) doesn't help.

See PR #932 for another test. It's clear that fewer packages mean faster speed.

I've reverted the caching step, and configured setup-miniconda to use strict channel priority (conda-forge only, with no packages from default anaconda channel) which speeds up the conda/mamba resolver step (see https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html#strict-channel-priority). See if this looks ok @seisman.

Comment thread.github/workflows/ci_tests.yaml Outdated
@seisman

Copy link
Copy Markdown
Member

It looks great. Maybe also update ci_docs.yml, cache_data.yml and even vercel's package.json file.

@weiji14

Copy link
Copy Markdown
MemberAuthor

It looks great. Maybe also update ci_docs.yml, cache_data.yml and even vercel's package.json file.

Ok, updated ci_docs.yml and cache_data.yml to use mamba! I won't update the vercel package.json file because using micromamba didn't seem to give a noticeable speedup last time we tried (ref #813 (review)).

@weiji14weiji14 self-assigned this Sep 17, 2021
@weiji14weiji14 added this to the 0.5.0 milestone Sep 17, 2021
@weiji14weiji14 added the final review call This PR requires final review and approval from a second reviewer label Sep 18, 2021

@weiji14weiji14 left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Thanks @seisman, I'll merge this PR on second approval or in ~12 hours, and that should give us some good CI time savings!

Comment thread.github/workflows/ci_tests_dev.yaml Outdated
@seisman

Copy link
Copy Markdown
Member

Don't forget to remove the python-version: 3.7 line before merging.

@weiji14
weiji14 merged commit 8409764 into mainSep 18, 2021
@weiji14
weiji14 deleted the mambaforge branch September 18, 2021 10:41
@seismanseisman removed the final review call This PR requires final review and approval from a second reviewer label Sep 18, 2021
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…ingTools#841)
Specifically using `mambaforge` which is a `miniconda`
replacement that defaults to using the `conda-forge`
channel and `mamba` instead of `conda` by default.
* Set strict channel priority to conda-forge only with no
defaults to see if it speeds up resolver. See also
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html#strict-channel-priority
* Use mamba on GMT Dev Tests CI build
* Use mamba in CI docs and Cache Data workflows
* Pin gmt dev version to 6.3 on Windows CI
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenanceBoring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@weiji14@seisman@maxrjones