diff --git a/Dockerfile b/Dockerfile index e604efd..940b35a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ @@ -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 @@ -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 '' diff --git a/README.md b/README.md index bf9bac5..005b9cb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/conda/build-nersc.sh b/conda/build-nersc.sh index 205e668..bf94213 100755 --- a/conda/build-nersc.sh +++ b/conda/build-nersc.sh @@ -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 @@ -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 diff --git a/conda/packlist.txt b/conda/packlist.txt index 4adb851..5cf26dc 100644 --- a/conda/packlist.txt +++ b/conda/packlist.txt @@ -3,6 +3,8 @@ celerite cmdstan cmdstanpy coloredlogs +cosmosis>=2.2.2 +cosmosis-build-standard-library>=1.2 emcee extinction f90nml @@ -27,4 +29,3 @@ multiprocess>=0.70.8 nestcheck pymultinest pyxdg - diff --git a/conda/post-conda-build.sh b/conda/post-conda-build.sh new file mode 100644 index 0000000..c726413 --- /dev/null +++ b/conda/post-conda-build.sh @@ -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 diff --git a/docker/update-docker.sh b/docker/update-docker.sh index a8b6006..c1c0934 100644 --- a/docker/update-docker.sh +++ b/docker/update-docker.sh @@ -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 diff --git a/nersc/setup_td_env.sh b/nersc/setup_td_env.sh index 1587736..7203e35 100755 --- a/nersc/setup_td_env.sh +++ b/nersc/setup_td_env.sh @@ -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 diff --git a/nersc/setup_td_int.sh b/nersc/setup_td_int.sh index 4bea50c..8f851cd 100644 --- a/nersc/setup_td_int.sh +++ b/nersc/setup_td_int.sh @@ -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." @@ -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;; @@ -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"