Skip to content

Commit

Permalink
Merge pull request #81 from LSSTDESC/integration
Browse files Browse the repository at this point in the history
Merge Integration updates into Main
  • Loading branch information
heather999 authored Jan 13, 2023
2 parents 3e197ca + ea03099 commit 4f4761c
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 6 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ARG LSST_GROUP=lsst
USER lsst

WORKDIR $LSST_STACK_DIR

RUN echo "Environment: \n" && env | sort && \
curl -LO https://ls.st/lsstinstall && \
bash ./lsstinstall ${LSST_TAG:+"-X"} $LSST_TAG && \
Expand All @@ -41,7 +41,7 @@ RUN echo "Environment: \n" && env | sort && \
mkdir -p /tmp/gh && \
cd /tmp/gh && \
git clone https://github.com/LSSTDESC/td_env && \
cd td_env && \
cd td_env && \
git checkout $GH_SHA

USER root
Expand All @@ -52,11 +52,12 @@ RUN cd /tmp/gh/td_env && \
USER lsst
RUN cd /tmp/gh/td_env/conda && \
bash /tmp/gh/td_env/docker/update-docker.sh w_2022_10 && \
bash post-conda-build.sh && \
echo "source $LSST_STACK_DIR/loadLSST.bash" >> ~/.bashrc && \
echo "setup lsst_distrib" >> ~/.bashrc && \
rm -Rf /tmp/gh


ENV HDF5_USE_FILE_LOCKING FALSE
ENV PYTHONSTARTUP ''

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Defines, builds and installs a conda environment including the LSST Science Pipe
## Current Stable Release
https://github.com/LSSTDESC/td_env/releases/latest

## Running cosmosis + firecrown
Cosmosis is available in the td_env integration builds. Users are encouraged to try this out.

The default `setup_td_int.sh` will prepare the environment by settting $CSL_DIR, $FIRECROWN_DIR, $FIRECROWN_SITE_PACKAGES variables which points to the current integration build directory. Currently the default setup does NOT entirely complete the cosmosis set up and does not run `source cosmosis-configure`. However, this can be enabled by doing: `source setup_td_int.sh -c`.

To run a test of cosmosis + firecrown after doing `source setup_td_int.sh` please try: `cosmosis $FIRECROWN_DIR/examples/des_y1_3x2pt/des_y1_3x2pt.ini`

## To Request Additional Packages, Report Problems, or Submit Questions
Please [open an issue](https://github.com/LSSTDESC/td_env/issues) on this repository.

Expand Down
13 changes: 13 additions & 0 deletions conda/build-nersc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fi

mkdir -p $curBuildDir
cp conda/packlist.txt $curBuildDir
cp conda/post-conda-build.sh $curBuildDir
cp conda/piplist.txt $curBuildDir
cp nersc/setup_td_env.sh $curBuildDir
cp nersc/sitecustomize.py $curBuildDir
Expand Down Expand Up @@ -79,6 +80,18 @@ cd resspect
python setup.py install
cd ..

# Grab firecrown source so we have the examples subdirectory
firecrown_ver=$(conda list firecrown | grep firecrown|tr -s " " | cut -d " " -f 2)
echo $firecrown_ver
curl -LO https://github.com/LSSTDESC/firecrown/archive/refs/tags/v$firecrown_ver.tar.gz
tar xvzf v$firecrown_ver.tar.gz
# Set up a common directory name without version info to set FIRECROWN_DIR more easily
ln -s firecrown-$firecrown_ver firecrown

# Additional build steps
bash ./post-conda-build.sh


python -m compileall $curBuildDir

# Hard-coding this for now for building at NERSC
Expand Down
3 changes: 2 additions & 1 deletion conda/packlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ celerite
cmdstan
cmdstanpy
coloredlogs
cosmosis>=2.2.2
cosmosis-build-standard-library>=1.2
emcee
extinction
f90nml
Expand All @@ -27,4 +29,3 @@ multiprocess>=0.70.8
nestcheck
pymultinest
pyxdg

10 changes: 10 additions & 0 deletions conda/post-conda-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Project- or dependency-specific setup commands to be
# run after a conda installation, for example to download
# additional data files


# Download and build the CosmoSIS standard library
# in a directory under the CosmoSIS python directory
cosmosis-build-standard-library -i
3 changes: 3 additions & 0 deletions docker/update-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ conda clean -y -a
# Import of ligo.em_bright to cause associated data files to be downloaded into the image
# python -c "import ligo.em_bright"

# Additional build steps
bash ./post-conda-build.sh

conda env export --no-builds > /opt/lsst/software/stack/td_env-image-nobuildinfo.yml
conda env export > /opt/lsst/software/stack/td_env-image.yml

Expand Down
5 changes: 5 additions & 0 deletions nersc/setup_td_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ else
source $DESC_LSST_INSTALL_DIR/loadLSST.zsh
fi
setup lsst_distrib

# For cosmosis and firecrown. Should try to find a better way to set these
export CSL_DIR=$CONDA_PREFIX/lib/python3.8/site-packages/cosmosis/cosmosis-standard-library
export FIRECROWN_SITE_PACKAGES=$CONDA_PREFIX/lib/python3.8/site-packages
export FIRECROWN_DIR=$DESC_LSST_INSTALL_DIR/firecrown
11 changes: 10 additions & 1 deletion nersc/setup_td_int.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SCRIPT=${BASH_SOURCE[0]}
usage() { # Function: Print a help message.
echo -e \\n"Help documentation for ${BOLD}${SCRIPT}"\\n
echo "Command line switches are optional. The following switches are recognized."
echo "-c --Setup cosmosis."
echo "-k --Setup the env without doing module purge."
echo "-n --Setup the env without the LSST Sci Pipelines."
echo "-s --Setup the env for shifter."
Expand All @@ -28,9 +29,10 @@ usage() { # Function: Print a help message.
# -h help
# -n Do not setup the LSST Sci Pipelines
#while getopts e:n: flag
while getopts "hkns" flag
while getopts "chkns" flag
do
case "${flag}" in
c) cosmosis=1;;
h) usage;;
k) keepenv=1;;
n) nolsst=1;;
Expand Down Expand Up @@ -120,6 +122,13 @@ case $NERSC_HOST in
export SNANA_SCRATCH="/global/cscratch1/sd/kessler"
;;
esac


if [[ "$cosmosis" ]];
then
source cosmosis-configure
fi

export SNANA_LSST_SIM="$SNANA_SCRATCH/SNANA_LSST_SIM"

export SCRATCH_SIMDIR="$SNANA_LSST_SIM"
Expand Down

0 comments on commit 4f4761c

Please sign in to comment.