From 6a95128082c0d5a944dff0cccb174a312bf32948 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Sun, 20 Aug 2023 18:18:03 -0700 Subject: [PATCH 01/13] Bump pixell version, WIP on modulefiles --- pkgs/pixell/meta.yaml | 4 ++-- templates/modulefile_lua.in | 19 ++++++++++++++++++- templates/modulefile_tcl.in | 8 ++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/pkgs/pixell/meta.yaml b/pkgs/pixell/meta.yaml index 5a8d30a..7d36fe6 100644 --- a/pkgs/pixell/meta.yaml +++ b/pkgs/pixell/meta.yaml @@ -1,5 +1,5 @@ -{% set version = "0.17.3" %} -{% set sha256 = "335742bb22a535add21dd6e63eb9bf35ee98c97efd2795989ca449d1fdc38ad1" %} +{% set version = "0.19.0" %} +{% set sha256 = "8142a2a368175de845166afffe3e4efd0ac0bdc109a96eb8f4cc0360e6191fd1" %} {% set build = 0 %} diff --git a/templates/modulefile_lua.in b/templates/modulefile_lua.in index 23c3b87..3b4ccdc 100644 --- a/templates/modulefile_lua.in +++ b/templates/modulefile_lua.in @@ -15,7 +15,7 @@ whatis("Version: " .. "@VERSION@") whatis("URL: " .. "https://github.com/simonsobs/soconda") whatis("Description: " .. "Simons Observatory Conda Tools") -conflict("sohpc", "so-env", "soconda") +conflict("sohpc", "so-env", "soconda", "python") -- Dependency module commands @MODLOAD@ @@ -36,6 +36,23 @@ setenv("CONDA_SHLVL", "1") setenv("CONDA_DEFAULT_ENV", "@ENVPREFIX@") prepend_path("PATH", "@ENVPREFIX@/bin") +local funcs = "conda __conda_activate __conda_hashr __conda_reactivate __add_sys_prefix_to_path" + +execute{cmd="source " .. @BASE@ .. "/etc/profile.d/conda.sh; conda activate @ENVNAME@; export -f " .. funcs, modeA={"load"}} + +execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=" .. conda_dir .. "; \ + export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ + export PATH=$(echo ${PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ + unset -f " .. funcs .. "; \ + unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\" | /bin/grep -v 'CONDA_ENVS_PATH\\|CONDA_PKGS_DIRS');", modeA={"unload"}} + +execute{cmd="source " .. conda_dir .. "/etc/profile.d/conda.sh; conda activate py${PYV}_${ENV}; export -f " .. funcs, modeA={"load"}} +execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=" .. conda_dir .. "; \ + export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ + export PATH=$(echo ${PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ + unset -f " .. funcs .. "; \ + + -- Create a versioned user directory for local pip installation local userbase = pathJoin(HOME, ".local", "soconda", "@VERSION@") setenv("PYTHONUSERBASE", userbase) diff --git a/templates/modulefile_tcl.in b/templates/modulefile_tcl.in index 85f89a2..e4e1f96 100644 --- a/templates/modulefile_tcl.in +++ b/templates/modulefile_tcl.in @@ -14,11 +14,15 @@ proc ModulesHelp { } { puts stderr "" } -conflict sohpc so-env soconda +conflict sohpc so-env soconda python # Dependency module commands @MODLOAD@ +if {[module-info command unload]} { + system AUTO_ACTIVATE_BASE=false @BASE@/bin/conda deactivate +} + # This might be set by OS python and gives us problems. unsetenv PYTHONSTARTUP @@ -27,7 +31,7 @@ unsetenv PYTHONSTARTUP # calls do not work. This solution could be fragile, so should # be revisited in the future. -setenv CONDA_EXE "@BASE@/bin/conda" +setenv CONDA_EXE @BASE@/bin/conda setenv CONDA_PYTHON_EXE "@BASE@/bin/python" setenv CONDA_PREFIX "@ENVPREFIX@" setenv CONDA_PROMPT_MODIFIER "" From c1c8c1dad010102d30cb8437b62c0f7dda593de1 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Tue, 22 Aug 2023 14:18:55 -0700 Subject: [PATCH 02/13] Work on docs --- docs/docs/automate.md | 1 + docs/docs/dev.md | 57 +++++++++++++++++ docs/docs/index.md | 14 ++++ docs/docs/install.md | 146 ++++++++++++++++++++++++++++++++++++++++++ docs/docs/usage.md | 41 ++++++++++++ docs/mkdocs.yml | 15 +++++ 6 files changed, 274 insertions(+) create mode 100644 docs/docs/automate.md create mode 100644 docs/docs/dev.md create mode 100644 docs/docs/index.md create mode 100644 docs/docs/install.md create mode 100644 docs/docs/usage.md create mode 100644 docs/mkdocs.yml diff --git a/docs/docs/automate.md b/docs/docs/automate.md new file mode 100644 index 0000000..6f36009 --- /dev/null +++ b/docs/docs/automate.md @@ -0,0 +1 @@ +# Automating the Install diff --git a/docs/docs/dev.md b/docs/docs/dev.md new file mode 100644 index 0000000..cafde5d --- /dev/null +++ b/docs/docs/dev.md @@ -0,0 +1,57 @@ +# Developer Notes + +This section covers steps needed when maintaining the `soconda` tools. + +## Releases + +After updating the versions of included packages, it is a good idea to make a +new release so that a new environment is built and deployed. After all +outstanding changes are merged to `main`, go to the github page for this +repository and click on the `Actions` tab. Trigger the `Test Build` workflow. +This will take an hour or so to run. Assuming it all works, create a new +release with some notes about what was updated. Cron jobs running on our +computing centers will check for new tags and build them if found. + +## Changing Installed Packages + +The three top-level files: `packages_conda.txt`, `packages_local.txt`, and +`packages_pip.txt` contain the packages that will be installed. The conda +packages are installed first, then local conda packages are built and +installed, and finally the pip packages are installed. When installing pip +packages, the `soconda.sh` script first extracts the dependencies of each pip +package and installs it instead with conda. This helps minimize the number of +pip packages installed in the environment and that makes it easier to avoid +dependency problems later. + +## Updating Bundled Recipes + +The conda recipes for bundled packages should be updated whenever upstream +packages have new releases. This involves the following steps: + +1. Update the version in the `meta.yaml` file of the package recipe. + +2. Update the download URL if needed. + +3. Manually download the new tarball of the package. For example: + + curl -SL -o pixel-0.19.0.tar.gz \ + https://github.com/simonsobs/pixell/archive/v0.19.0.tar.gz + +4. Get the sha256 checksum of the tarball, and copy that into the `meta.yaml` +entry: + + openssl sha256 pixel-0.19.0.tar.gz + SHA256(pixell-0.19.0.tar.gz)= 8142a2a368175de845166afffe3e4efd0ac0bdc109a96eb8f4cc0360e6191fd1 + +5. Ensure that the new version of the package does not have any updated +dependencies or other constraints. + +## Adding New Package Recipes + +This should not be needed very often, and will require some familiarity with +conda recipes. Create a new directory for the recipe in the `pkgs` directory. +Add a `meta.yaml` file, a `build.sh` file, and a copy of the package license. +See the conda documentation and existing conda-forge feedstocks for extensive +examples. You can load an existing soconda environment as a testbed and then +test your new recipe with `conda build`. After you can build it independently, +add it to the `packages_local.txt` file. diff --git a/docs/docs/index.md b/docs/docs/index.md new file mode 100644 index 0000000..c757ece --- /dev/null +++ b/docs/docs/index.md @@ -0,0 +1,14 @@ +# Simons Observatory Conda Tools + +This repository contains scripts to help with: + +- Installing a conda base system (optional) + +- Creating a conda environment with a well-defined set of conda and pip packages + +- Building a few legacy compiled packages into this environment + +- Creating a versioned modulefile for loading the environment + +The documentation also covers different user scenarios for loading and +customizing a pre-installed environment. diff --git a/docs/docs/install.md b/docs/docs/install.md new file mode 100644 index 0000000..9ebb66a --- /dev/null +++ b/docs/docs/install.md @@ -0,0 +1,146 @@ +# Creating a Simons Observatory Environment + +The install script takes options to specify the location of the base environment +(if it is not already activated) and the name (or full path) of the environment +to create. It also allows specifying a central location to install the +modulefile: + + $> ./soconda.sh -h + Usage: ./soconda.sh + [-e ] + [-b ] + [-v ] + [-m /modulefiles)>] + [-i ] + +--- +**NOTE** + +Running the `soconda.sh` script will create log files in the current directory. +Consider running the command from within a temporary build directory to avoid +clutter. + +--- + +## Base Conda Environment + +If you already have a conda-forge base environment, then you can skip this +step. Otherwise, decide on the install prefix for your overall conda +environment. For this example, we will use `/opt/conda` as the path to the +conda base installation. Now run the bootstrap script: + + $> ./tools/bootstrap_base "/opt/conda" + +This bootstrap will install a base system with the conda-forge channel set to +the default. You can now source the conda initialization file and activate the +base environment: + + $> source /opt/conda/etc/profile.d/conda.sh + $> conda activate base + +After installing an `soconda` environment below, you will not need this step +since it is done by the generated modulefile. + +## Special Note on mpi4py + +By default, the conda package for mpi4py will be installed. This should work +well for stand-alone workstations or single nodes. If you have a cluster with a +customized MPI compiler, then set the `MPICC` environment variable to the MPI C +compiler before creating an environment. That will cause the mpi4py package to +be built using your compiler. + +## Example: Local System + +Starting from scratch, bootstrap a small conda-forge base environment in `~/conda`: + + $> ./tools/bootstrap_base.sh ~/conda + $> source ~/conda/etc/profile.d/conda.sh + $> conda activate base + +Create an `soconda` environment with default name and version. However, we +decide to put all the modulefiles into a central location in the root of the +base conda install: + + $> ./soconda.sh -b ~/conda -m ~/conda/modulefiles + +Now we can load the module: + + $> module use ~/conda/modulefiles + $> module avail + $> module load soconda/XXXXXX + +## Example: NERSC + +At NERSC, the default provided python is from Anaconda, and does not work for +our needs. Instead, we have a conda-forge base system installed in our project +software directory: + + $> source /global/common/software/sobs/perlmutter/conda/etc/profile.d/conda.sh + $> conda activate base + +Now we can either install a shared software environment or use this base environment to build a conda environment in a personal directory. If you are installing to a shared software environment, you should do that as the project account and follow a specific naming convention which is beyond the scope of this document. If you wanted to install these tools to your home directory you could do: + + $> ./soconda.sh -b ~/conda_envs -m ~/conda_envs/modulefiles + +And then load the module: + + $> module use ~/conda_envs/modulefiles + $> module avail + $> module load soconda/XXXXXX + +## Running Tests + +After loading an `soconda` environment, you can run some tests with: + + $> ./run_tests.sh + +## Installing a Jupyter Kernel + +After loading an soconda module the first time, you can run (once) the included script: + + $> soconda_jupyter.sh + +This will install a kernel file so that jupyter knows how to launch a kernel +using this python stack. + +## Customizing an Environment + +If you want to dramatically change the package versions / content of an +`soconda` stack, just load the existing base conda environment and edit the +three lists of packages (`packages_[conda|pip|local].txt`) to exclude certain +packages or add extras. Then install it as usual. + +## Deleting an Environment + +The `soconda` environments are self contained and you can delete them by +removing the path or (if using a name), removing the `/envs/` directory. You can optionally delete the modulefile and the pip local +directory in your home directory. + +## Advanced Details + +The compiled packages assume the use of the conda compilers for consistency with +the libraries installed through conda. If you want to change those compilers you +can remove the `compilers` conda package and manually set the `CC`, `CXX`, and `FC` +environment variables. Full warning that this may cause problems with threading +interfaces, thread pinning, etc, when building packages that use OpenMP. + +### Pixell + +We currently build pixell from source with the conda compilers for consistency, +rather than installing the wheel. + +### So3g + +This package is currently installed from the wheel, but the conda package is +being tested (using boost from conda-forge). + +### TOAST + +This package is currently built from source by default, with dependencies +installed through conda. When toast-3.0 arrives in the conda-forge toast +feedstock, it should be added back to `packages_conda.txt`. It should also work +to install the python wheel package by commenting out the toast entry in +`packages_local.txt` and adding it to `packages_pip.txt`. + + diff --git a/docs/docs/usage.md b/docs/docs/usage.md new file mode 100644 index 0000000..df6caa2 --- /dev/null +++ b/docs/docs/usage.md @@ -0,0 +1,41 @@ +# Using an Existing Environment + +If you are just using an already-created environment, you can follow +instructions on the Simons Observatory project confluence site (see the Data +Management pages on Computing Infrastructure) about where to find the +installation for a particular system. After loading an environment, there are a +several ways to customize things. + +## Overriding a Few Packages + +Each `soconda` modulefile sets the user directory (for `pip install --user`) to +be in a versioned location in your home directory. If you want to use a +different / newer version of `sotodlib` (for example), then you can just do: + + $> pip install --user https://github.com/simonsobs/sotodlib/archive/master.tar.gz + +If you swap to a different `soconda` environment, your user package install +directory will also switch. + +## More Extensive Customization + +One benefit of an `soconda` environment is that it also contains conda packages +built for some legacy compiled tools. If you want to keep those, but +dramatically change which other conda packages are installed, you can first +create a new personal environment while cloning an existing one: + + $> conda create --clone soconda_20230809_1.0.0 /path/to/my/env + +Then activate your new environment and conda install whatever you like: + + $> conda activate /path/to/my/env + $> conda install foo bar blat + +Note that your pip user directory will still be set to the location created by +the original upstream module, and you can also "`pip install --user`" +additional packages to go with your custom conda environment. + +## Something Else + +You can also just load a conda base environment on a particular system and then +read the next section of this document to install your own environment. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml new file mode 100644 index 0000000..124d6f6 --- /dev/null +++ b/docs/mkdocs.yml @@ -0,0 +1,15 @@ +site_name: S.O. Conda + +theme: + name: "material" + features: + - navigation.expand + - navigation.path + +nav: + - Introduction: index.md + - Use and Customization: usage.md + - Installation: install.md + - Automated Deployment: automate.md + - Developer Notes: dev.md + From f7da3a171faa7e21550355fe5f922629670c81c4 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Thu, 31 Aug 2023 06:09:02 -0700 Subject: [PATCH 03/13] Switch back to miniforge installer. Documentation updates. --- docs/docs/install.md | 36 +++++++++++++++++-------- soconda.sh | 10 +++---- templates/modulefile_lua.in | 52 ++++++++++++++----------------------- templates/modulefile_tcl.in | 41 ++++++++++++++++++++++++++--- tools/bootstrap_base.sh | 42 +++++++++++++----------------- 5 files changed, 104 insertions(+), 77 deletions(-) diff --git a/docs/docs/install.md b/docs/docs/install.md index 9ebb66a..3a26db8 100644 --- a/docs/docs/install.md +++ b/docs/docs/install.md @@ -25,15 +25,18 @@ clutter. ## Base Conda Environment If you already have a conda-forge base environment, then you can skip this -step. Otherwise, decide on the install prefix for your overall conda -environment. For this example, we will use `/opt/conda` as the path to the -conda base installation. Now run the bootstrap script: +step. However, you should consider setting the "solver" in the base environment +to use libmamba. This will greatly speed up the dependency resolution +calculation. Once you decide on the install prefix for your overall conda +environment you can use the included bootstrap script. For this example, we +will use `/opt/conda` as the path to the conda base installation. Now run the +bootstrap script: $> ./tools/bootstrap_base "/opt/conda" This bootstrap will install a base system with the conda-forge channel set to -the default. You can now source the conda initialization file and activate the -base environment: +the default and using the mamba solver. You can now source the conda +initialization file and activate the base environment: $> source /opt/conda/etc/profile.d/conda.sh $> conda activate base @@ -46,7 +49,7 @@ since it is done by the generated modulefile. By default, the conda package for mpi4py will be installed. This should work well for stand-alone workstations or single nodes. If you have a cluster with a customized MPI compiler, then set the `MPICC` environment variable to the MPI C -compiler before creating an environment. That will cause the mpi4py package to +compiler before running `soconda.sh`. That will cause the mpi4py package to be built using your compiler. ## Example: Local System @@ -71,14 +74,19 @@ Now we can load the module: ## Example: NERSC -At NERSC, the default provided python is from Anaconda, and does not work for -our needs. Instead, we have a conda-forge base system installed in our project -software directory: +At NERSC, the default provided python is from Anaconda, and does not work well +for our needs. Instead, we have a conda-forge base system installed in our +project software directory: $> source /global/common/software/sobs/perlmutter/conda/etc/profile.d/conda.sh $> conda activate base -Now we can either install a shared software environment or use this base environment to build a conda environment in a personal directory. If you are installing to a shared software environment, you should do that as the project account and follow a specific naming convention which is beyond the scope of this document. If you wanted to install these tools to your home directory you could do: +Now we can either install a shared software environment or use this base +environment to build a conda environment in a personal directory. If you are +installing to a shared software environment, you should do that as the project +account and follow a specific naming convention which is beyond the scope of +this document. If you wanted to install these tools to your home directory you +could do: $> ./soconda.sh -b ~/conda_envs -m ~/conda_envs/modulefiles @@ -106,7 +114,7 @@ using this python stack. ## Customizing an Environment If you want to dramatically change the package versions / content of an -`soconda` stack, just load the existing base conda environment and edit the +`soconda` stack, just load the existing `base` conda environment and edit the three lists of packages (`packages_[conda|pip|local].txt`) to exclude certain packages or add extras. Then install it as usual. @@ -130,6 +138,12 @@ interfaces, thread pinning, etc, when building packages that use OpenMP. We currently build pixell from source with the conda compilers for consistency, rather than installing the wheel. +### Libactpol / Moby2 + +There are three conda recipes for `libactpol_deps`, `libactpol`, and `moby2`. +These are using git hashes that are either the latest or a branch / version +recommended for S.O. use. + ### So3g This package is currently installed from the wheel, but the conda package is diff --git a/soconda.sh b/soconda.sh index e074f04..ca6a7ec 100755 --- a/soconda.sh +++ b/soconda.sh @@ -127,9 +127,6 @@ if [ "x${env_check}" = "x" ]; then echo "channels:" >> "${CONDA_PREFIX}/.condarc" echo " - conda-forge" >> "${CONDA_PREFIX}/.condarc" echo "changeps1: true" >> "${CONDA_PREFIX}/.condarc" - echo "channel_priority: strict" >> "${CONDA_PREFIX}/.condarc" - echo "envs_dirs:" >> "${CONDA_PREFIX}/.condarc" - echo " - $(dirname ${CONDA_PREFIX})" >> "${CONDA_PREFIX}/.condarc" echo "env_prompt: '({name}) '" >> "${CONDA_PREFIX}/.condarc" # Reactivate to pick up changes @@ -165,11 +162,10 @@ rm -f "${CONDA_PREFIX}/bin/cc" conda deactivate conda activate "${fullenv}" -# Update conda and low-level tools, including pipgrip which we +# Install low-level tools, including pipgrip which we # use to install dependencies of pip packages with conda. -conda update --yes --all -conda install --yes setuptools wheel anytree click packaging -python3 -m pip install pipgrip +conda install --yes --update-all setuptools pip wheel anytree click packaging +pip install pipgrip mkdir -p "${CONDA_PREFIX}/conda-bld" conda-index "${CONDA_PREFIX}/conda-bld" diff --git a/templates/modulefile_lua.in b/templates/modulefile_lua.in index 3b4ccdc..06d1a23 100644 --- a/templates/modulefile_lua.in +++ b/templates/modulefile_lua.in @@ -23,39 +23,27 @@ conflict("sohpc", "so-env", "soconda", "python") -- This might be set by OS python and gives us problems. unsetenv("PYTHONSTARTUP") --- Activate the conda environment by modifying the environment --- directly. This is needed since the source-sh and system --- calls do not work. This solution could be fragile, so should --- be revisited in the future. - -setenv("CONDA_EXE", "@BASE@/bin/conda") -setenv("CONDA_PYTHON_EXE", "@BASE@/bin/python") -setenv("CONDA_PREFIX", "@ENVPREFIX@") -setenv("CONDA_PROMPT_MODIFIER", "") -setenv("CONDA_SHLVL", "1") -setenv("CONDA_DEFAULT_ENV", "@ENVPREFIX@") -prepend_path("PATH", "@ENVPREFIX@/bin") - -local funcs = "conda __conda_activate __conda_hashr __conda_reactivate __add_sys_prefix_to_path" - -execute{cmd="source " .. @BASE@ .. "/etc/profile.d/conda.sh; conda activate @ENVNAME@; export -f " .. funcs, modeA={"load"}} - -execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=" .. conda_dir .. "; \ - export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ - export PATH=$(echo ${PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ - unset -f " .. funcs .. "; \ - unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\" | /bin/grep -v 'CONDA_ENVS_PATH\\|CONDA_PKGS_DIRS');", modeA={"unload"}} - -execute{cmd="source " .. conda_dir .. "/etc/profile.d/conda.sh; conda activate py${PYV}_${ENV}; export -f " .. funcs, modeA={"load"}} -execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=" .. conda_dir .. "; \ - export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ - export PATH=$(echo ${PATH} | tr ':' '\\n' | /bin/grep . | /bin/grep -v $pre | tr '\\n' ':' | sed 's/:$//'); \ - unset -f " .. funcs .. "; \ - - --- Create a versioned user directory for local pip installation +-- Versioned user directory for local pip installation local userbase = pathJoin(HOME, ".local", "soconda", "@VERSION@") setenv("PYTHONUSERBASE", userbase) local userbin = pathJoin(userbase, "bin") -prepend_path("PATH", userbin) + +local funcs = "conda __conda_exe __conda_activate __conda_hashr __conda_reactivate" + +if (mode() == "load") then + execute{cmd="source " .. "@BASE@" .. "/etc/profile.d/conda.sh; \ + conda activate @ENVNAME@; export -f " .. funcs .. \ + "; export PATH=" .. userbin .. ":${PATH}", modeA={"load"}} +end + +if (mode() == "unload") then + execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; \ + pre=" .. "@BASE@" .. "; \ + pipusr=" .. userbin .. "; \ + export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | tr "\\n" ":" | sed 's/:$//'); \ + export PATH=$(echo ${PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | /bin/grep -v $pipusr | tr "\\n" ":" | sed 's/:$//'); \ + unset -f " .. funcs .. "; \ + unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");", modeA={"unload"}} +end + diff --git a/templates/modulefile_tcl.in b/templates/modulefile_tcl.in index e4e1f96..839c496 100644 --- a/templates/modulefile_tcl.in +++ b/templates/modulefile_tcl.in @@ -3,7 +3,6 @@ ## Simons Observatory Conda Environment. ## ## -# variables for Tcl script use only set version @VERSION@ module-whatis "Loads conda tools for the Simons Observatory." @@ -19,12 +18,48 @@ conflict sohpc so-env soconda python # Dependency module commands @MODLOAD@ +# This might be set by OS python and gives us problems. +unsetenv PYTHONSTARTUP + +# Versioned user directory for local pip installation +set userbase $env(HOME)/.local/soconda/@VERSION@ +setenv PYTHONUSERBASE $userbase +set userbin $userbase/bin + +set funcs "conda __conda_exe __conda_activate __conda_hashr __conda_reactivate" + +# WIP: port lua techniques here... + + +if {[module-info command load]} { + system "source @BASE@/etc/profile.d/conda.sh; \ + conda activate @ENVNAME@; export -f $funcs .. \ + "; export PATH=" .. userbin .. ":${PATH}" +} + +if (mode() == "load") then + execute{cmd=, modeA={"load"}} +end + +if (mode() == "unload") then + execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; \ + pre=" .. "@BASE@" .. "; \ + pipusr=" .. userbin .. "; \ + export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | tr "\\n" ":" | sed 's/:$//'); \ + export PATH=$(echo ${PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | /bin/grep -v $pipusr | tr "\\n" ":" | sed 's/:$//'); \ + unset -f " .. funcs .. "; \ + unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");", modeA={"unload"}} +end + + + + + if {[module-info command unload]} { system AUTO_ACTIVATE_BASE=false @BASE@/bin/conda deactivate } -# This might be set by OS python and gives us problems. -unsetenv PYTHONSTARTUP + # Activate the conda environment by modifying the environment # directly. This is needed since the source-sh and system diff --git a/tools/bootstrap_base.sh b/tools/bootstrap_base.sh index d2f598f..41c733a 100755 --- a/tools/bootstrap_base.sh +++ b/tools/bootstrap_base.sh @@ -18,28 +18,22 @@ if [ "x${base}" = "x" ]; then exit 1 fi - -if [ $(uname -s) = "Linux" ]; then - inst=$(eval "${scriptdir}/fetch_check.sh" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname -s)-$(uname -m).sh miniforge.sh) -else - if [ $(uname -s) = "Darwin" ]; then - inst=$(eval "${scriptdir}/fetch_check.sh" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-$(uname -m).sh miniforge.sh) - else - echo "Unsupported operating system" >&2 - exit 1 - fi -fi - -bash "${inst}" -b -f -p "${base}" \ - && echo "# condarc for soconda" > "${base}/.condarc" \ - && echo "channels:" >> "${base}/.condarc" \ - && echo " - conda-forge" >> "${base}/.condarc" \ - && echo "channel_priority: strict" >> "${base}/.condarc" \ - && echo "changeps1: true" >> "${base}/.condarc" - -# Activate and set solver. Re-enable after mamba supports -# strict channel order. -# source "${base}/etc/profile.d/conda.sh" -# conda install -n base conda-libmamba-solver -# conda config --file "${base}/.condarc" --set solver libmamba +inst=$(eval "${scriptdir}/fetch_check.sh" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh miniforge.sh) + +bash "${inst}" -b -f -p "${base}" + +# Activate base and install libmamba solver +source "${base}/etc/profile.d/conda.sh" +conda activate base +conda update -n base --yes conda +conda install -n base --yes conda-libmamba-solver +conda deactivate + +# Create base config file +echo "# condarc bootstrapped by soconda" > "${base}/.condarc" +echo "channels:" >> "${base}/.condarc" +echo " - conda-forge" >> "${base}/.condarc" +echo "changeps1: true" >> "${base}/.condarc" +echo "env_prompt: '({name}) '" >> "${base}/.condarc" +echo "solver: libmamba" >> "${base}/.condarc" From 1aaa3fafc18b696145cb225cc5970871c136644a Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Thu, 31 Aug 2023 07:43:28 -0700 Subject: [PATCH 04/13] More cleanup to tcl modulefile --- templates/modulefile_tcl.in | 46 ++----------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/templates/modulefile_tcl.in b/templates/modulefile_tcl.in index 839c496..b6830f6 100644 --- a/templates/modulefile_tcl.in +++ b/templates/modulefile_tcl.in @@ -32,51 +32,9 @@ set funcs "conda __conda_exe __conda_activate __conda_hashr __conda_reactivate" if {[module-info command load]} { - system "source @BASE@/etc/profile.d/conda.sh; \ - conda activate @ENVNAME@; export -f $funcs .. \ - "; export PATH=" .. userbin .. ":${PATH}" + system "source @BASE@/etc/profile.d/conda.sh; conda activate @ENVNAME@; export -f ${funcs}; export PATH=${userbin}:${PATH}" } -if (mode() == "load") then - execute{cmd=, modeA={"load"}} -end - -if (mode() == "unload") then - execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; \ - pre=" .. "@BASE@" .. "; \ - pipusr=" .. userbin .. "; \ - export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | tr "\\n" ":" | sed 's/:$//'); \ - export PATH=$(echo ${PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | /bin/grep -v $pipusr | tr "\\n" ":" | sed 's/:$//'); \ - unset -f " .. funcs .. "; \ - unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");", modeA={"unload"}} -end - - - - - if {[module-info command unload]} { - system AUTO_ACTIVATE_BASE=false @BASE@/bin/conda deactivate + system "for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=@BASE@; pipusr=$userbin; export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | tr "\\n" ":" | sed 's/:$//'); export PATH=$(echo ${PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | bin/grep -v $pipusr | tr "\\n" ":" | sed 's/:$//'); unset -f ${funcs}; unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");" } - - - -# Activate the conda environment by modifying the environment -# directly. This is needed since the source-sh and system -# calls do not work. This solution could be fragile, so should -# be revisited in the future. - -setenv CONDA_EXE @BASE@/bin/conda -setenv CONDA_PYTHON_EXE "@BASE@/bin/python" -setenv CONDA_PREFIX "@ENVPREFIX@" -setenv CONDA_PROMPT_MODIFIER "" -setenv CONDA_SHLVL "1" -setenv CONDA_DEFAULT_ENV "@ENVNAME@" -prepend-path PATH "@ENVPREFIX@/bin" - -# Create a versioned location for user-installed pip packages. -# Add this location to the start of the path. -set userbase $env(HOME)/.local/soconda/@VERSION@ -setenv PYTHONUSERBASE $userbase -prepend-path PATH $userbase/bin -prepend-path PYTHONPATH $userbase/lib/python@PYVER@/site-packages From c282e265fb69c2274392c536ab10a90e7ee6ff14 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Thu, 31 Aug 2023 13:05:01 -0700 Subject: [PATCH 05/13] More work on modulefiles --- templates/modulefile_lua.in | 10 +--------- templates/modulefile_tcl.in | 7 ++----- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/templates/modulefile_lua.in b/templates/modulefile_lua.in index 06d1a23..999edfe 100644 --- a/templates/modulefile_lua.in +++ b/templates/modulefile_lua.in @@ -37,13 +37,5 @@ if (mode() == "load") then end if (mode() == "unload") then - execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; \ - pre=" .. "@BASE@" .. "; \ - pipusr=" .. userbin .. "; \ - export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | tr "\\n" ":" | sed 's/:$//'); \ - export PATH=$(echo ${PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | /bin/grep -v $pipusr | tr "\\n" ":" | sed 's/:$//'); \ - unset -f " .. funcs .. "; \ - unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");", modeA={"unload"}} + execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=" .. "@BASE@" .. "; pipusr=" .. userbin .. "; export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr \":\" \"\\n\" | /bin/grep . | /bin/grep -v $pre | tr \"\\n\" \":\" | sed 's/:$//'); export PATH=$(echo ${PATH} | tr \":\" \"\\n\" | /bin/grep . | /bin/grep -v $pre | /bin/grep -v $pipusr | tr \"\\n\" \":\" | sed 's/:$//'); unset -f " .. funcs .. "; unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");", modeA={"unload"}} end - - diff --git a/templates/modulefile_tcl.in b/templates/modulefile_tcl.in index b6830f6..3354552 100644 --- a/templates/modulefile_tcl.in +++ b/templates/modulefile_tcl.in @@ -28,13 +28,10 @@ set userbin $userbase/bin set funcs "conda __conda_exe __conda_activate __conda_hashr __conda_reactivate" -# WIP: port lua techniques here... - - if {[module-info command load]} { - system "source @BASE@/etc/profile.d/conda.sh; conda activate @ENVNAME@; export -f ${funcs}; export PATH=${userbin}:${PATH}" + puts stdout "source @BASE@/etc/profile.d/conda.sh; conda activate @ENVNAME@; export -f ${funcs}; export PATH=${userbin}:\$PATH;" } if {[module-info command unload]} { - system "for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done; pre=@BASE@; pipusr=$userbin; export LD_LIBRARY_PATH=$(echo ${LD_LIBRARY_PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | tr "\\n" ":" | sed 's/:$//'); export PATH=$(echo ${PATH} | tr ":" "\\n" | /bin/grep . | /bin/grep -v $pre | bin/grep -v $pipusr | tr "\\n" ":" | sed 's/:$//'); unset -f ${funcs}; unset $(env | /bin/grep -o \"[^=]*CONDA[^=]*\");" + puts stdout "for i in \$(seq \${CONDA_SHLVL:=0}); do conda deactivate; done; pre=@BASE@; pipusr=${userbin}; export LD_LIBRARY_PATH=\$(echo \$LD_LIBRARY_PATH | tr \":\" \"\\n\" | /bin/grep . | /bin/grep -v \$pre | tr \"\\n\" \":\" | sed 's/:\$//'); export PATH=\$(echo \$PATH | tr \":\" \"\\n\" | /bin/grep . | /bin/grep -v \$pre | /bin/grep -v \$pipusr | tr \"\\n\" \":\" | sed 's/:\$//'); unset -f ${funcs}; unset \$(env | /bin/grep -o \"\[^=\]*CONDA\[^=\]*\");" } From 74932285238ee0fa57f6ad82e9f3f4aab369c41a Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Thu, 21 Sep 2023 16:49:48 -0700 Subject: [PATCH 06/13] Fix lua modulefile. Add explicit package dependency on openmp. --- pkgs/libactpol/meta.yaml | 4 ++++ pkgs/libactpol_deps/meta.yaml | 5 +++++ pkgs/pixell/meta.yaml | 10 +++++----- pkgs/toast/build.sh | 1 - pkgs/toast/meta.yaml | 3 ++- templates/modulefile_lua.in | 7 +++---- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/pkgs/libactpol/meta.yaml b/pkgs/libactpol/meta.yaml index 65282ab..7e2690f 100644 --- a/pkgs/libactpol/meta.yaml +++ b/pkgs/libactpol/meta.yaml @@ -20,7 +20,11 @@ build: requirements: build: - {{ compiler('c') }} + - llvm-openmp >=4.0.1 # [osx] + - libgomp # [linux] host: + - llvm-openmp >=4.0.1 # [osx] + - libgomp # [linux] - openblas * openmp_* - automake - autoconf diff --git a/pkgs/libactpol_deps/meta.yaml b/pkgs/libactpol_deps/meta.yaml index b4bd46c..15ee4d5 100644 --- a/pkgs/libactpol_deps/meta.yaml +++ b/pkgs/libactpol_deps/meta.yaml @@ -21,8 +21,13 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('fortran') }} + - llvm-openmp >=4.0.1 # [osx] + - libgomp # [linux] host: + - llvm-openmp >=4.0.1 # [osx] + - libgomp # [linux] - openblas * openmp_* + - blas=*=*openblas - automake - autoconf - m4 diff --git a/pkgs/pixell/meta.yaml b/pkgs/pixell/meta.yaml index 7d36fe6..82192d5 100644 --- a/pkgs/pixell/meta.yaml +++ b/pkgs/pixell/meta.yaml @@ -22,11 +22,10 @@ requirements: - {{ compiler('c') }} - {{ compiler('cxx') }} - {{ compiler('fortran') }} - - llvm-openmp >=4.0.1 # [osx] - - libgomp # [linux] + - llvm-openmp # [(osx or linux)] + - _openmp_mutex * *_llvm # [(osx or linux)] host: - - llvm-openmp >=4.0.1 # [osx] - - libgomp # [linux] + - llvm-openmp # [(osx or linux)] - openblas * openmp_* - automake - autoconf @@ -43,8 +42,9 @@ requirements: - h5py - pillow run: - - python + - llvm-openmp # [(osx or linux)] - openblas * openmp_* + - python - {{ pin_compatible('numpy') }} - scipy - astropy diff --git a/pkgs/toast/build.sh b/pkgs/toast/build.sh index ea32e4d..dd87bb1 100755 --- a/pkgs/toast/build.sh +++ b/pkgs/toast/build.sh @@ -21,7 +21,6 @@ cd build cmake \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ ${CMAKE_PLATFORM_FLAGS[@]} \ - -DPYTHON_EXECUTABLE:FILEPATH="${PYTHON}" \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DCMAKE_PREFIX_PATH="${PREFIX}" \ diff --git a/pkgs/toast/meta.yaml b/pkgs/toast/meta.yaml index 59464cb..1c4565c 100644 --- a/pkgs/toast/meta.yaml +++ b/pkgs/toast/meta.yaml @@ -27,8 +27,10 @@ requirements: - cmake - make # [unix] - llvm-openmp >=4.0.1 # [osx] + - libgomp # [linux] host: - llvm-openmp >=4.0.1 # [osx] + - libgomp # [linux] - python - fftw - openblas * openmp_* @@ -37,7 +39,6 @@ requirements: - libaatm - libflac run: - - llvm-openmp >=4.0.1 # [osx] - python - {{ pin_compatible('fftw') }} - openblas * openmp_* diff --git a/templates/modulefile_lua.in b/templates/modulefile_lua.in index 999edfe..2d5c7b5 100644 --- a/templates/modulefile_lua.in +++ b/templates/modulefile_lua.in @@ -24,16 +24,15 @@ conflict("sohpc", "so-env", "soconda", "python") unsetenv("PYTHONSTARTUP") -- Versioned user directory for local pip installation -local userbase = pathJoin(HOME, ".local", "soconda", "@VERSION@") +local home = os.getenv("HOME") +local userbase = pathJoin(home, ".local", "soconda", "@VERSION@") setenv("PYTHONUSERBASE", userbase) local userbin = pathJoin(userbase, "bin") local funcs = "conda __conda_exe __conda_activate __conda_hashr __conda_reactivate" if (mode() == "load") then - execute{cmd="source " .. "@BASE@" .. "/etc/profile.d/conda.sh; \ - conda activate @ENVNAME@; export -f " .. funcs .. \ - "; export PATH=" .. userbin .. ":${PATH}", modeA={"load"}} + execute{cmd="source " .. "@BASE@" .. "/etc/profile.d/conda.sh; conda activate @ENVNAME@; export -f " .. funcs .. "; export PATH=" .. userbin .. ":${PATH}", modeA={"load"}} end if (mode() == "unload") then From a6831509c35d81342f0ce14df27bc398595ec5bb Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Thu, 21 Sep 2023 16:50:25 -0700 Subject: [PATCH 07/13] Restore test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb77742..a4adfdb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: conda activate "soconda_CI" export OMP_NUM_THREADS=2 export MPI_DISABLE=1 - #python3 -c 'import toast.tests; toast.tests.run()' + python3 -c 'import toast.tests; toast.tests.run()' git clone --depth=1 --single-branch --branch=master https://github.com/simonsobs/sotodlib.git pushd sotodlib python3 setup.py test From 0dbc94eed63730ed9ca84e6b0ea930b90b85e9a1 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 Sep 2023 09:20:39 -0700 Subject: [PATCH 08/13] Clean up openmp dependencies --- .github/workflows/docs.yml | 52 +++++++++++++++++++++++++++++++++++ docs/docs/automate.md | 21 ++++++++++++++ docs/docs/install.md | 9 +++--- packages_conda.txt | 2 +- packages_local.txt | 2 +- packages_pip.txt | 2 +- pkgs/libactpol/meta.yaml | 10 +++++-- pkgs/libactpol_deps/meta.yaml | 9 ++++-- pkgs/moby2/meta.yaml | 13 +++++---- pkgs/pixell/meta.yaml | 18 ++++++------ pkgs/so3g/meta.yaml | 20 +++++++------- pkgs/toast/build.sh | 31 +++++++++++++++++---- pkgs/toast/debug_lapack.patch | 14 ++++++++++ pkgs/toast/meta.yaml | 27 ++++++++++-------- 14 files changed, 176 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 pkgs/toast/debug_lapack.patch diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..d601c9a --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,52 @@ +name: Deploy Documentation + +# on: +# push: +# tags: +# - '*' +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + update_docs: + name: Build and Deploy Documentation + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Create Cache ID + run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + + - name: Setup Cache + uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + + - name: Install Dependencies + run: | + pip install mkdocs mkdocstrings mkdocstrings-python mkdocs-material + + - name: Deploy Docs + run: mkdocs gh-deploy --force diff --git a/docs/docs/automate.md b/docs/docs/automate.md index 6f36009..0f74e3e 100644 --- a/docs/docs/automate.md +++ b/docs/docs/automate.md @@ -1 +1,22 @@ # Automating the Install + +The general process of automating the install proceeds like this: + +1. A cron job (or similar) runs periodically and launches a script which +examines current tags of soconda and finds the latest one. It looks at the +installation directory and determines whether this tag has been installed. If +not, it runs an installation wrapper script for the current system. + +2. The wrapper script has hard-coded paths to the various locations and also +knows how to build the version string to use. This script calls the +`soconda.sh` script to install the latest tag. + +3. If a new tag was installed, a message is posted via slack hook to one of the +Simons Observatory slack channels. + +## Example: Perlmutter at NERSC + +In the `deploy` subdirectory are the relevant files. The perlmutter install +wrapper script is in `install_perlmutter.sh`. The tag checking script run by +the cron job is in `install_nersc_tag.sh`, and the example lines in the scron +tab are in `scron_check_tag.slurm`. diff --git a/docs/docs/install.md b/docs/docs/install.md index 3a26db8..d87222f 100644 --- a/docs/docs/install.md +++ b/docs/docs/install.md @@ -35,8 +35,8 @@ bootstrap script: $> ./tools/bootstrap_base "/opt/conda" This bootstrap will install a base system with the conda-forge channel set to -the default and using the mamba solver. You can now source the conda -initialization file and activate the base environment: +the default and using the libmamba solver. You can now source the conda +initialization file and activate this base environment: $> source /opt/conda/etc/profile.d/conda.sh $> conda activate base @@ -50,7 +50,7 @@ By default, the conda package for mpi4py will be installed. This should work well for stand-alone workstations or single nodes. If you have a cluster with a customized MPI compiler, then set the `MPICC` environment variable to the MPI C compiler before running `soconda.sh`. That will cause the mpi4py package to -be built using your compiler. +be built using your system MPI compiler. ## Example: Local System @@ -88,7 +88,8 @@ account and follow a specific naming convention which is beyond the scope of this document. If you wanted to install these tools to your home directory you could do: - $> ./soconda.sh -b ~/conda_envs -m ~/conda_envs/modulefiles + $> mkdir -p ~/conda_envs + $> ./soconda.sh -e ~/conda_envs/soconda -m ~/conda_envs/modulefiles And then load the module: diff --git a/packages_conda.txt b/packages_conda.txt index f928daf..29d0385 100644 --- a/packages_conda.txt +++ b/packages_conda.txt @@ -48,4 +48,4 @@ ipykernel # https://github.com/conda-forge/pyfftw-feedstock/issues/51 pyfftw==0.12 # Uncomment the next line if building so3g from source -#boost +boost diff --git a/packages_local.txt b/packages_local.txt index 52e41fa..f36d157 100644 --- a/packages_local.txt +++ b/packages_local.txt @@ -7,4 +7,4 @@ moby2 toast # Uncomment next line to build so3g from source, and # comment out line in packages_pip.txt -#so3g +so3g diff --git a/packages_pip.txt b/packages_pip.txt index 8d5ef3f..1a20b56 100644 --- a/packages_pip.txt +++ b/packages_pip.txt @@ -2,6 +2,6 @@ qpoint pysm3 # Uncomment here if installing wheel, and comment out # line in packages_local.txt -so3g +#so3g https://github.com/simonsobs/sotodlib/archive/master.tar.gz https://github.com/galsci/mapsims/archive/main.tar.gz diff --git a/pkgs/libactpol/meta.yaml b/pkgs/libactpol/meta.yaml index 7e2690f..db75357 100644 --- a/pkgs/libactpol/meta.yaml +++ b/pkgs/libactpol/meta.yaml @@ -20,12 +20,14 @@ build: requirements: build: - {{ compiler('c') }} - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] host: - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - automake - autoconf - m4 @@ -39,9 +41,11 @@ requirements: - healpy run: - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas + - {{ pin_compatible('libactpol_deps') }} - {{ pin_compatible('cfitsio') }} - {{ pin_compatible('wcslib') }} - - {{ pin_compatible('libactpol_deps') }} test: commands: diff --git a/pkgs/libactpol_deps/meta.yaml b/pkgs/libactpol_deps/meta.yaml index 15ee4d5..954dfdd 100644 --- a/pkgs/libactpol_deps/meta.yaml +++ b/pkgs/libactpol_deps/meta.yaml @@ -21,13 +21,14 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('fortran') }} - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] host: - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* - - blas=*=*openblas + - libblas * *openblas + - liblapack * *openblas - automake - autoconf - m4 @@ -36,6 +37,8 @@ requirements: - zziplib run: - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - {{ pin_compatible('zziplib') }} test: diff --git a/pkgs/moby2/meta.yaml b/pkgs/moby2/meta.yaml index 9a723e4..985077f 100644 --- a/pkgs/moby2/meta.yaml +++ b/pkgs/moby2/meta.yaml @@ -17,19 +17,18 @@ source: build: number: {{ build }} skip: true # [win] - run_exports: - - moby2 requirements: build: - {{ compiler('c') }} - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] - - openblas * openmp_* host: - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - python - fftw - gsl @@ -37,8 +36,10 @@ requirements: - numpy>=1.20 - future run: - - python - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas + - python - {{ pin_compatible('fftw') }} - {{ pin_compatible('gsl') }} - {{ pin_compatible('libactpol') }} diff --git a/pkgs/pixell/meta.yaml b/pkgs/pixell/meta.yaml index 82192d5..6757020 100644 --- a/pkgs/pixell/meta.yaml +++ b/pkgs/pixell/meta.yaml @@ -1,5 +1,5 @@ -{% set version = "0.19.0" %} -{% set sha256 = "8142a2a368175de845166afffe3e4efd0ac0bdc109a96eb8f4cc0360e6191fd1" %} +{% set version = "0.19.2" %} +{% set sha256 = "aecc1bf6b2c6685d4641e76bdce40a4e4ed337cdffad69c294a9186ab8a5f9a1" %} {% set build = 0 %} @@ -14,19 +14,20 @@ source: build: number: {{ build }} skip: true # [win] - run_exports: - - pixell requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - {{ compiler('fortran') }} - - llvm-openmp # [(osx or linux)] - - _openmp_mutex * *_llvm # [(osx or linux)] + - llvm-openmp # [osx] + - libgomp # [linux] host: - - llvm-openmp # [(osx or linux)] + - llvm-openmp # [osx] + - libgomp # [linux] - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - automake - autoconf - m4 @@ -42,8 +43,9 @@ requirements: - h5py - pillow run: - - llvm-openmp # [(osx or linux)] - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - python - {{ pin_compatible('numpy') }} - scipy diff --git a/pkgs/so3g/meta.yaml b/pkgs/so3g/meta.yaml index 71b15a0..41e21aa 100644 --- a/pkgs/so3g/meta.yaml +++ b/pkgs/so3g/meta.yaml @@ -1,5 +1,5 @@ -{% set version = "0.1.6" %} -{% set sha256 = "50284e8f1c61a0488811791ce05941d5bdd1bd30ab61e2bf6a2f052c1f6cb059" %} +{% set version = "0.1.8" %} +{% set sha256 = "0e6d3e32af61524465892c575f92150bbc95aeb6e8349a1369cb013713cd8b7f" %} {% set build = 0 %} @@ -20,32 +20,32 @@ build: script_env: - CFLAGS="-Wno-error -O3 -g -fPIC" - CXXFLAGS="-Wno-error -O3 -g -fPIC -std=c++14" - run_exports: - - so3g requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - cmake - - llvm-openmp >=4.0.1 # [osx] + - make # [unix] + - llvm-openmp # [osx] - libgomp # [linux] - - openblas * openmp_* - - make host: - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - python - numpy>=1.20 - scipy - boost - libflac run: + - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - python - {{ pin_compatible('numpy') }} - - openblas * openmp_* - - {{ pin_compatible('liblapack') }} - {{ pin_compatible('boost') }} - {{ pin_compatible('libflac') }} - astropy diff --git a/pkgs/toast/build.sh b/pkgs/toast/build.sh index dd87bb1..1c87a4a 100755 --- a/pkgs/toast/build.sh +++ b/pkgs/toast/build.sh @@ -4,24 +4,45 @@ set -x declare -a CMAKE_PLATFORM_FLAGS if [[ ${HOST} =~ .*darwin.* ]]; then - CMAKE_PLATFORM_FLAGS+=(-DCMAKE_OSX_SYSROOT="${CONDA_BUILD_SYSROOT}") - # export LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,-dead_strip_dylibs//g") + CMAKE_PLATFORM_FLAGS+=(-DCMAKE_OSX_SYSROOT="${CONDA_BUILD_SYSROOT}") + # export LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,-dead_strip_dylibs//g") else - CMAKE_PLATFORM_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="${RECIPE_DIR}/cross-linux.cmake") + CMAKE_PLATFORM_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="${RECIPE_DIR}/cross-linux.cmake") fi if [[ ${DEBUG_C} == yes ]]; then - CMAKE_BUILD_TYPE=Debug + CMAKE_BUILD_TYPE=Debug else - CMAKE_BUILD_TYPE=Release + CMAKE_BUILD_TYPE=Release fi +echo "DBG: PATH=${PATH}" +echo "DBG: PYTHON=${PYTHON}" +echo "DBG: python3=$(which python3)" +echo "DBG: PY_VER=${PY_VER}" + mkdir -p build cd build cmake \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ ${CMAKE_PLATFORM_FLAGS[@]} \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ + -DPython3_EXECUTABLE=$(which python3) \ + -DPython3_INCLUDE_DIR="${PREFIX}/include/python${PY_VER}" \ + -DPython3_FIND_VIRTUALENV=ONLY \ + -DCMAKE_C_COMPILER="${CC}" \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_C_FLAGS="-O3 -g -fPIC" \ + -DCMAKE_CXX_FLAGS="-O3 -g -fPIC" \ + -DCMAKE_VERBOSE_MAKEFILE=1 \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DCMAKE_PREFIX_PATH="${PREFIX}" \ + -DFFTW_ROOT="${PREFIX}" \ + -DAATM_ROOT="${PREFIX}" \ + -DBLAS_LIBRARIES="${PREFIX}/lib/libblas${SHLIB_EXT}" \ + -DLAPACK_LIBRARIES="${PREFIX}/lib/liblapack${SHLIB_EXT}" \ + -DSUITESPARSE_INCLUDE_DIR_HINTS="${PREFIX}/include" \ + -DSUITESPARSE_LIBRARY_DIR_HINTS="${LIBDIR}" \ -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DCMAKE_PREFIX_PATH="${PREFIX}" \ "${SRC_DIR}" diff --git a/pkgs/toast/debug_lapack.patch b/pkgs/toast/debug_lapack.patch new file mode 100644 index 0000000..73511d8 --- /dev/null +++ b/pkgs/toast/debug_lapack.patch @@ -0,0 +1,14 @@ +diff -urN toast-3.0.0a19_orig/cmake/FindLAPACKnames.cmake toast-3.0.0a19/cmake/FindLAPACKnames.cmake +--- toast-3.0.0a19_orig/cmake/FindLAPACKnames.cmake 2023-08-16 18:34:01.000000000 -0700 ++++ toast-3.0.0a19/cmake/FindLAPACKnames.cmake 2023-09-22 09:51:26.249656186 -0700 +@@ -29,8 +29,8 @@ + COMPILE_DEFINITIONS "-DLAPACK_${MANGLING}" + LINK_LIBRARIES "${LAPACK_LIBRARIES}" "${BLAS_LIBRARIES}" "${OMP_BLAS}" + OUTPUT_VARIABLE OUTPUT_MANGLING) +- # message("Test output for LAPACK_${MANGLING}:") +- # message(${OUTPUT_MANGLING}) ++ message("Test output for LAPACK_${MANGLING}:") ++ message(${OUTPUT_MANGLING}) + if(TRY_MANGLING) + set(LAPACK_NAMES "${MANGLING}") + break() diff --git a/pkgs/toast/meta.yaml b/pkgs/toast/meta.yaml index 1c4565c..95e996b 100644 --- a/pkgs/toast/meta.yaml +++ b/pkgs/toast/meta.yaml @@ -1,6 +1,6 @@ -{% set version = "3.0.0a18" %} -{% set sha256 = "281d4c649cc5e2908ebbbe530dc85e2c86c7816827d102026cd084b7626b1f79" %} +{% set version = "3.0.0a19" %} +{% set sha256 = "e37c6e6de7a6829af378e0147113bd9439490cb5478be096c197fc6f7db6d6fe" %} {% set build = 0 %} @@ -11,42 +11,45 @@ package: source: url: https://github.com/hpc4cmb/toast/archive/{{ version }}.tar.gz sha256: {{ sha256 }} + # patches: + # - debug_lapack.patch build: skip: True # [py<38] skip: True # [win] number: {{ build }} string: "py{{ py }}h{{ PKG_HASH }}_{{ build }}" - run_exports: - - toast requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - cmake - - make # [unix] - - llvm-openmp >=4.0.1 # [osx] + - make # [unix] + - llvm-openmp # [osx] - libgomp # [linux] host: - - llvm-openmp >=4.0.1 # [osx] + - llvm-openmp # [osx] - libgomp # [linux] + - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - python - fftw - - openblas * openmp_* - - liblapack - suitesparse - libaatm - libflac + - numpy>=1.20 run: + - openblas * openmp_* + - libblas * *openblas + - liblapack * *openblas - python + - {{ pin_compatible('numpy') }} - {{ pin_compatible('fftw') }} - - openblas * openmp_* - - {{ pin_compatible('liblapack') }} - {{ pin_compatible('suitesparse') }} - {{ pin_compatible('libaatm') }} - {{ pin_compatible('libflac') }} - - numpy>=1.20 - scipy - matplotlib - astropy From af12d2f817fff80bee07f9b2bea36d2cf4d681f0 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 Sep 2023 13:55:28 -0700 Subject: [PATCH 09/13] More work on consistent blas / openmp stack --- packages_conda.txt | 14 +++++++++++--- pkgs/libactpol/meta.yaml | 2 ++ pkgs/libactpol_deps/meta.yaml | 2 ++ pkgs/moby2/meta.yaml | 2 ++ pkgs/pixell/meta.yaml | 2 ++ pkgs/so3g/meta.yaml | 2 ++ pkgs/toast/meta.yaml | 2 ++ soconda.sh | 2 +- 8 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages_conda.txt b/packages_conda.txt index 29d0385..2821425 100644 --- a/packages_conda.txt +++ b/packages_conda.txt @@ -1,10 +1,18 @@ python=3.10.* compilers -libopenblas=*=*openmp* +# The LLVM openmp implementation is compatible with gcc +# and fork-safe. +_openmp_mutex=*=*_llvm +# +# Require the OpenBLAS + OpenMP flavor of linear algebra packages +openblas=*=openmp_* +libopenblas=*=openmp_* libblas=*=*openblas +libcblas=*=*openblas +liblapack=*=*openblas +liblapacke=*=*openblas +# conda-build -libcblas -blas-devel cmake autoconf automake diff --git a/pkgs/libactpol/meta.yaml b/pkgs/libactpol/meta.yaml index db75357..3e4c9d8 100644 --- a/pkgs/libactpol/meta.yaml +++ b/pkgs/libactpol/meta.yaml @@ -26,6 +26,7 @@ requirements: - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - automake @@ -41,6 +42,7 @@ requirements: - healpy run: - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - {{ pin_compatible('libactpol_deps') }} diff --git a/pkgs/libactpol_deps/meta.yaml b/pkgs/libactpol_deps/meta.yaml index 954dfdd..17f6ccf 100644 --- a/pkgs/libactpol_deps/meta.yaml +++ b/pkgs/libactpol_deps/meta.yaml @@ -27,6 +27,7 @@ requirements: - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - automake @@ -37,6 +38,7 @@ requirements: - zziplib run: - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - {{ pin_compatible('zziplib') }} diff --git a/pkgs/moby2/meta.yaml b/pkgs/moby2/meta.yaml index 985077f..c1df12e 100644 --- a/pkgs/moby2/meta.yaml +++ b/pkgs/moby2/meta.yaml @@ -27,6 +27,7 @@ requirements: - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python @@ -37,6 +38,7 @@ requirements: - future run: - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python diff --git a/pkgs/pixell/meta.yaml b/pkgs/pixell/meta.yaml index 6757020..2f949f8 100644 --- a/pkgs/pixell/meta.yaml +++ b/pkgs/pixell/meta.yaml @@ -26,6 +26,7 @@ requirements: - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - automake @@ -44,6 +45,7 @@ requirements: - pillow run: - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python diff --git a/pkgs/so3g/meta.yaml b/pkgs/so3g/meta.yaml index 41e21aa..218cc8d 100644 --- a/pkgs/so3g/meta.yaml +++ b/pkgs/so3g/meta.yaml @@ -33,6 +33,7 @@ requirements: - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python @@ -42,6 +43,7 @@ requirements: - libflac run: - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python diff --git a/pkgs/toast/meta.yaml b/pkgs/toast/meta.yaml index 95e996b..2acd1f9 100644 --- a/pkgs/toast/meta.yaml +++ b/pkgs/toast/meta.yaml @@ -32,6 +32,7 @@ requirements: - llvm-openmp # [osx] - libgomp # [linux] - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python @@ -42,6 +43,7 @@ requirements: - numpy>=1.20 run: - openblas * openmp_* + - libopenblas * openmp_* - libblas * *openblas - liblapack * *openblas - python diff --git a/soconda.sh b/soconda.sh index ca6a7ec..2ad30fd 100755 --- a/soconda.sh +++ b/soconda.sh @@ -203,7 +203,7 @@ while IFS='' read -r line || [[ -n "${line}" ]]; do conda-build ${pkgrecipe} > "log_${pkgname}" 2>&1 cat "log_${pkgname}" echo "Installing local package '${pkgname}'" - conda install --yes --use-local --no-deps ${pkgname} + conda install --yes --use-local ${pkgname} fi done < "${scriptdir}/packages_local.txt" From d1cf0770d435ba5aea54b639ee4d52b2eef7e011 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 Sep 2023 15:41:03 -0700 Subject: [PATCH 10/13] Default to using so3g wheel for now --- packages_conda.txt | 2 +- packages_local.txt | 6 ++++-- packages_pip.txt | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages_conda.txt b/packages_conda.txt index 2821425..662f5ef 100644 --- a/packages_conda.txt +++ b/packages_conda.txt @@ -56,4 +56,4 @@ ipykernel # https://github.com/conda-forge/pyfftw-feedstock/issues/51 pyfftw==0.12 # Uncomment the next line if building so3g from source -boost +#boost diff --git a/packages_local.txt b/packages_local.txt index f36d157..c52b269 100644 --- a/packages_local.txt +++ b/packages_local.txt @@ -6,5 +6,7 @@ moby2 # and move to packages_conda.txt toast # Uncomment next line to build so3g from source, and -# comment out line in packages_pip.txt -so3g +# comment out line in packages_pip.txt. NOTE: this +# requires addressing pysqlite3-wheels and qpoint +# dependencies. +#so3g diff --git a/packages_pip.txt b/packages_pip.txt index 1a20b56..8d5ef3f 100644 --- a/packages_pip.txt +++ b/packages_pip.txt @@ -2,6 +2,6 @@ qpoint pysm3 # Uncomment here if installing wheel, and comment out # line in packages_local.txt -#so3g +so3g https://github.com/simonsobs/sotodlib/archive/master.tar.gz https://github.com/galsci/mapsims/archive/main.tar.gz From 191a3835a76642617b5ba57b60e0897bff18edf8 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 Sep 2023 15:51:25 -0700 Subject: [PATCH 11/13] Add badges for documentation and test build --- .github/workflows/docs.yml | 4 +- README.md | 203 +------------------------------------ 2 files changed, 6 insertions(+), 201 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d601c9a..cb1fc4c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -49,4 +49,6 @@ jobs: pip install mkdocs mkdocstrings mkdocstrings-python mkdocs-material - name: Deploy Docs - run: mkdocs gh-deploy --force + run: | + cd docs + mkdocs gh-deploy --force diff --git a/README.md b/README.md index 0bd4edc..c429d53 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Documentation building status](https://github.com/simonsobs/soconda/actions/workflows/docs.yml/badge.svg) ![Latest test build](https://github.com/simonsobs/soconda/actions/workflows/test.yml/badge.svg) + # Simons Observatory Conda Tools This repository contains scripts to help with: @@ -10,204 +12,5 @@ This repository contains scripts to help with: - Creating a versioned modulefile for loading the environment -## Using an Existing Environment - -If you are just using an already-created environment, you can follow -instructions on project resources (Confluence) for how to load a particular -version on a system. After loading an environment, there are a several ways to -customize things. - -### Overriding a Few Packages - -Each `soconda` modulefile sets the user directory (for `pip install --user`) to -be in a versioned location in your home directory. If you want to use a -different / newer version of `sotodlib` (for example), then you can just do: - - $> pip install --user https://github.com/simonsobs/sotodlib/archive/master.tar.gz - -If you swap to a different `soconda` environment, your user package install -directory will also switch. - -### More Extensive Customization - -One benefit of an `soconda` environment is that it also contains conda packages -built for some legacy compiled tools. If you want to keep those, but -dramatically change which other conda packages are installed, you can first -create a new personal environment while cloning an existing one: - - $> conda create --clone soconda_20230809_1.0.0 /path/to/my/env - -Then activate your new environment and conda install whatever you like: - - $> conda activate /path/to/my/env - $> conda install foo bar blat - -Note that your pip user directory will still be set to the location created by -the original upstream module, and you can also "`pip install --user`" -additional packages to go with your custom conda environment. - -### Rolling Your Own - -You can also just load a conda base environment on a particular system and then -read the rest of this document to install your own environment. You can edit -the files: - - packages_conda.txt - packages_local.txt - packages_pip.txt - -to control which packages will be installed with conda, pip, or built locally. - -## Creating a Simons Observatory Environment - -The install script takes options to specify the location of the base environment -(if it is not already activated) and the name (or full path) of the environment -to create. It also allows specifying a central location to install the -modulefile. - ---- -**NOTE** - -Running the `soconda.sh` script will create log files and downloaded sources in -the current directory. Consider running the command from within a temporary -build directory to avoid clutter. - ---- - -### Base Conda Environment - -If you already have a conda-forge base environment, then you can skip this -step. Otherwise, decide on the install prefix for your overall conda -environment. For this example, we will use `/opt/conda` as the path to the -conda base installation. Now run the bootstrap script: - - $> ./tools/bootstrap_base "/opt/conda" - -This bootstrap will install a base system with the conda-forge channel set to -the default. You can now source the conda initialization file and activate the -base environment: - - $> source /opt/conda/etc/profile.d/conda.sh - $> conda activate base - -After installing an `soconda` environment below, the resulting module file will -do this on load. - -### Special Note on mpi4py - -By default, the conda package for mpi4py will be installed using the mpich -flavor. This should work well for stand-alone workstations or single nodes. If -you have a cluster with a customized MPI compiler, then set the `MPICC` -environment variable to the MPI C compiler before creating an environment. That -will cause the mpi4py package to be built using your compiler. - -### Example: Local System - -Starting from scratch, bootstrap a small conda-forge base environment in `~/conda`: - - $> ./tools/bootstrap_base.sh ~/conda - $> source ~/conda/etc/profile.d/conda.sh - $> conda activate base - -Create an `soconda` environment with default name and version. However, we -decide to put all the modulefiles into a central location in the root of the -base conda install: - - $> ./soconda.sh -b ~/conda -m ~/conda/modulefiles - -Now we can load the module: - - $> module use ~/conda/modulefiles - $> module avail - $> module load soconda/XXXXXX - -### Example: NERSC - -At NERSC, the default provided python is from Anaconda, and cannot be easily -customized for our needs. Instead, we have a conda-forge base system installed -in our project software directory: - - $> source /global/common/software/sobs/perlmutter/conda/etc/profile.d/conda.sh - $> conda activate base - -Now we can either install a shared software environment or use this base environment to build a conda environment in a personal directory. - -## Loading an Environment - -The created conda environment includes the root "name" (or path) specified at -creation time and has the version appended to this. For example, if you did not -specify the name or the version, then it would have created an environment under -`envs/soconda_`. - -### Loading an Environment with a Modulefile - -There is a module file installed with each soconda environment. If you -specified the module directory during install, then a module named after the -version was created in that directory. The module file will initialize the -conda base environment and then activate the environment you created. - -Ensure that the location of the modulefile is in your search path: - - # (If you specified a custom module file directory) - $> module use /path/to/custom/modulefiles - - # OR (you are using the defaults, and your base install is in /opt/conda) - $> module use /opt/conda/envs/soconda_1.0.0/modulefiles - -And then load the module: - - $> module load soconda/1.0.0 - -Doing a `module unload soconda` will deactivate the conda environment and -remove any conda initialization from your shell environment. - -### Running Tests - -After loading an `soconda` environment, you can run some tests with: - - $> ./run_tests.sh - -## Customizing an Environment - -If you want to dramatically change the package versions / content of an -`soconda` stack, just load the existing base conda environment and edit the -three lists of packages (`packages_[conda|pip|local].txt`) to exclude certain -packages or add extras. Then install it to some personal location outside the -base install (i.e. pass the full path to `soconda -e `). - -## Deleting an Environment - -The `soconda` environments are self contained and you can delete them by -removing the path or (if using a name), removing the -`/envs/` directory. You can optionally delete the -modulefile and the pip local directory in your home directory. - -## Advanced Details - -The compiled packages assume the use of the conda compilers for consistency with -the libraries installed through conda. If you want to change those compilers you -can remove the `compilers` conda package and manually set the `CC`, `CXX`, and `FC` -environment variables. Full warning that this may cause problems with threading -interfaces, thread pinning, etc, when building packages that use OpenMP. - -### Pixell - -We currently build pixell from source with the conda compilers for consistency, -rather than installing the wheel. - -### So3g - -This package is currently built from source by default, but the pre-built wheel -(which comes bundled with OpenMP-enabled libopenblas) should also work. To use -that, comment out the so3g line in `packages_local.txt` and uncomment the -line in `packages_pip.txt`. - -### TOAST - -This package is currently built from source by default, with dependencies -installed through conda. When toast-3.0 arrives in the conda-forge toast -feedstock, it should be added back to `packages_conda.txt`. It should also work -to install the python wheel package by commenting out the toast entry in -`packages_local.txt` and adding it to `packages_pip.txt`. - +## [Full Documentation](https://simonsobs.github.io/soconda/) From a78d0c8f60dc473ef96a67a3ec08955d3bde9c67 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 Sep 2023 15:58:09 -0700 Subject: [PATCH 12/13] Try to fix docs deploy from action --- .github/workflows/docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cb1fc4c..d5ee518 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -47,6 +47,8 @@ jobs: - name: Install Dependencies run: | pip install mkdocs mkdocstrings mkdocstrings-python mkdocs-material + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Deploy Docs run: | From dbd993e9728edd144249421b7131515e09e52dbb Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 Sep 2023 16:06:37 -0700 Subject: [PATCH 13/13] Add link from docs back to site --- docs/docs/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/index.md b/docs/docs/index.md index c757ece..5bea652 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -1,6 +1,7 @@ # Simons Observatory Conda Tools -This repository contains scripts to help with: +[This git repository](https://github.com/simonsobs/soconda) contains scripts to +help with: - Installing a conda base system (optional)