-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Bai-Chiang/micromamba
Add micromamba support and various fix and improvements.
- Loading branch information
Showing
22 changed files
with
306 additions
and
160 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tmpfs | ||
log_* | ||
toast_test_output |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Adjust the default python version | ||
python=3.10.* | ||
# | ||
jupyterlab | ||
wurlitzer | ||
plotly | ||
plotly-resampler |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pixell | ||
quaternionarray | ||
pysm3 | ||
# Uncomment here if installing wheel, and comment out | ||
# line in packages_local.txt | ||
posix-ipc | ||
toast==3.0.0a20 | ||
pysqlite3-wheels | ||
qpoint | ||
so3g | ||
# | ||
# Latest tag | ||
https://github.com/simonsobs/sotodlib/archive/master.tar.gz | ||
# | ||
# The mapsims package has hard-coded versions of pysm3 and | ||
# pixell, which un-installs our versions of those packages. | ||
#https://github.com/galsci/mapsims/archive/main.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This script is sourced in the main `soconda.sh` script. | ||
# Any commands placed here will be executed within that shell | ||
# and have access to all environment variables defined there. | ||
# There are 2 variables defined here which control the optional | ||
# creation of a modulefile to load the environment and also | ||
# which create a small script that installs a jupyter kernel | ||
# for the environment into a user's home directory. | ||
|
||
# Install a module file? | ||
install_module=yes | ||
|
||
# Install jupyter kernel setup script? | ||
install_jupyter_setup=yes | ||
|
||
# Add any other shell commands here for this system... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# and parse pip dependencies with pipgrip. | ||
# | ||
conda-build | ||
conda-verify | ||
compilers | ||
setuptools | ||
pip | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Adjust the default python version | ||
python=3.10.* | ||
python=3.11.* | ||
# |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +0,0 @@ | ||
# This config skips all the ACT tools and just installs | ||
# binary packages for everything. | ||
#qpoint | ||
#pixell | ||
#libactpol_deps | ||
#libactpol | ||
#moby2 | ||
# Remove next line once toast-3.0 is on conda-forge, | ||
# and move to packages_conda.txt | ||
#toast | ||
# Uncomment next line to build so3g from source, and | ||
# comment out line in packages_pip.txt. | ||
#so3g | ||
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- No module dependencies |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Adjust the default python version | ||
python=3.10.* | ||
# | ||
wurlitzer | ||
plotly | ||
plotly-resampler |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
qpoint | ||
pixell | ||
libactpol_deps | ||
libactpol | ||
moby2 | ||
# Remove next line once toast-3.0 is on conda-forge, | ||
# and move to packages_conda.txt | ||
toast | ||
# Uncomment next line to build so3g from source, and | ||
# comment out line in packages_pip.txt. | ||
so3g |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
quaternionarray | ||
pysm3 | ||
# | ||
# Uncomment here if installing wheel, and comment out | ||
# line in packages_local.txt | ||
#pysqlite3-wheels | ||
#so3g | ||
# | ||
# Latest tag | ||
https://github.com/simonsobs/sotodlib/archive/master.tar.gz | ||
# | ||
# The mapsims package has hard-coded versions of pysm3 and | ||
# pixell, which un-installs our versions of those packages. | ||
#https://github.com/galsci/mapsims/archive/main.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This script is sourced in the main `soconda.sh` script. | ||
# Any commands placed here will be executed within that shell | ||
# and have access to all environment variables defined there. | ||
# There are 2 variables defined here which control the optional | ||
# creation of a modulefile to load the environment and also | ||
# which create a small script that installs a jupyter kernel | ||
# for the environment into a user's home directory. | ||
|
||
# Install a module file? | ||
install_module=yes | ||
|
||
# Install jupyter kernel setup script? | ||
install_jupyter_setup=yes | ||
|
||
# Add any other shell commands here for this system... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ The install script takes options to specify the location of the base environment | |
to create. It also allows specifying a central location to install the | ||
modulefile: | ||
|
||
$> ./soconda.sh -h | ||
./soconda.sh -h | ||
Usage: ./soconda.sh | ||
[-c <directory in config to use for options>] | ||
[-e <environment, either name or full path>] | ||
|
@@ -25,22 +25,20 @@ clutter. | |
|
||
## Base Conda Environment | ||
|
||
If you already have a conda-forge base environment, then you can skip this | ||
If you already have a conda-forge or micromamba base environment, then you can skip this | ||
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: | ||
to use `libmamba`. To use `libmamba` solver see | ||
[this](https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community) article. | ||
This will greatly speed up the dependency resolution | ||
calculation. | ||
|
||
$> ./tools/bootstrap_base "/opt/conda" | ||
For new installation run following script to install miniforge | ||
|
||
This bootstrap will install a base system with the conda-forge channel set to | ||
the default and using the libmamba solver. You can now source the conda | ||
initialization file and activate this base environment: | ||
./tools/bootstrap_base "$HOME/miniforge3" | ||
|
||
$> source /opt/conda/etc/profile.d/conda.sh | ||
$> conda activate base | ||
This will intall conda to `$HOME/miniforge3` directory. | ||
It will set conda-forge as default channel and use `libmamba` as default solver. | ||
After the installation you need to re-login or start a new terminal to initialize conda. | ||
|
||
After installing an `soconda` environment below, you will not need this step | ||
since it is done by the generated modulefile. | ||
|
@@ -53,34 +51,69 @@ 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 system MPI compiler. | ||
|
||
## Example: Local System | ||
## Install soconda | ||
### Example: Local System | ||
This installation could install `soconda` to your local computer and any cluster. | ||
|
||
Starting from scratch, bootstrap a small conda-forge base environment in `~/conda`: | ||
Clone soconda repo | ||
|
||
$> ./tools/bootstrap_base.sh ~/conda | ||
$> source ~/conda/etc/profile.d/conda.sh | ||
$> conda activate base | ||
git clone [email protected]:simonsobs/soconda.git | ||
cd soconda | ||
|
||
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: | ||
Run the `soconda.sh` script | ||
|
||
$> ./soconda.sh -b ~/conda -m ~/conda/modulefiles | ||
export MAKEFLAGS='-j 4' | ||
bash soconda.sh -e soconda -c default | ||
|
||
Now we can load the module: | ||
This will create a new environment `soconda_xxx.x.x` with version number as suffix | ||
using `default` configuration. [More details on configuration.](#customizing-an-environment) | ||
(The `MAKEFLAGS` doesn't seem to have any effect.) | ||
If you want to specify a conda base directory add `-b "$HOME/miniforge3"` argument to `soconda.sh`. | ||
|
||
$> module use ~/conda/modulefiles | ||
$> module avail | ||
$> module load soconda/XXXXXX | ||
You could find out the name of new created environment with | ||
|
||
## Example: NERSC | ||
conda env list | ||
|
||
Then you can now activate the environment with | ||
|
||
conda activate soconda_xxx.x.x | ||
|
||
|
||
If running on a Linux desktop that uses wayland, you also need to install the `qt-wayland` package | ||
|
||
conda install qt-wayland | ||
|
||
|
||
If running on server, start jupyterlab listening on port `12345` with command | ||
|
||
cd /path/to/project | ||
nohup jupyter-lab --no-browser --port=12345 &> jupyter.log & | ||
|
||
|
||
To list current running jupyter server: | ||
|
||
jupyter server list | ||
|
||
|
||
To connect to jupyterlab running on server, start SSH tunnel from your laptop/desktop: | ||
|
||
ssh -N -L 12345:localhost:12345 server_domain_or_ip | ||
|
||
Then you can connect to jupyterlab with link provided by command `jupyter server list`. | ||
|
||
To stop jupyterlab listenging on port 12345: | ||
|
||
jupyter server stop 12345 | ||
|
||
|
||
### Example: NERSC | ||
|
||
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 | ||
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 | ||
|
@@ -89,29 +122,29 @@ 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: | ||
|
||
$> mkdir -p ~/conda_envs | ||
$> ./soconda.sh -e ~/conda_envs/soconda -m ~/conda_envs/modulefiles | ||
mkdir -p ~/conda_envs | ||
./soconda.sh -e ~/conda_envs/soconda -m ~/conda_envs/modulefiles | ||
|
||
And then load the module: | ||
|
||
$> module use ~/conda_envs/modulefiles | ||
$> module avail | ||
$> module load soconda/XXXXXX | ||
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 | ||
./run_tests.sh | ||
|
||
## Installing a Jupyter Kernel | ||
## Installing a Jupyter Kernel for external Jupyter server | ||
|
||
After loading an soconda module the first time, you can run (once) the included script: | ||
After loading an soconda module or activate socond conda environment the first time, you can run (once) the included script: | ||
|
||
$> soconda_jupyter.sh | ||
soconda_jupyter.sh | ||
|
||
This will install a kernel file so that jupyter knows how to launch a kernel | ||
using this python stack. | ||
This will install a kernel file to `~/.local/share/jupyter/kernels/soconda-xxxxx` so that external jupyter server | ||
knows how to launch a kernel using this python stack. | ||
|
||
## Customizing an Environment | ||
|
||
|
@@ -127,9 +160,15 @@ 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 `<base dir>/envs/<name of | ||
env>` directory. You can optionally delete the modulefile and the versioned pip | ||
running command `conda remove --name envname --all` or `conda remove -p /base_dir/envs/name --all`. | ||
Or directly removing the `<base dir>/envs/<name of env>` directory. | ||
You can optionally delete the modulefile and the versioned pip | ||
local directory in your home directory. | ||
If you installed a jupyter kernel, remove kernel file in `~/.local/share/jupyter/kernels/` | ||
with matching soconda version. | ||
If you have multiple soconda environment and deleted wrong kernel file, you can always | ||
[recreate it](#installing-a-jupyter-kernel). | ||
|
||
|
||
## Advanced Details | ||
|
||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# Pixell Tests | ||
OMP_NUM_THREADS=4 test_pixell.py | ||
#OMP_NUM_THREADS=4 test_pixell.py | ||
|
||
# Serial TOAST Tests | ||
OMP_NUM_THREADS=4 MPI_DISABLED=1 python -c 'import toast.tests; toast.tests.run()' | ||
|
||
# MPI-enabled tests | ||
OMP_NUM_THREADS=2 mpirun -np 4 python -c 'import toast.tests; toast.tests.run()' | ||
OMP_NUM_THREADS=2 mpirun -np 2 python -c 'import toast.tests; toast.tests.run()' |
Oops, something went wrong.