Loading deploy_anaconda.sh +42 −33 Original line number Diff line number Diff line Loading @@ -6,34 +6,34 @@ # Overview # ======== # There are several key considerations to running your own python interpereter # There are several key considerations to running your own python interpreter # (like anaconda) in a virtualenv on Titan: # # * All environment module changes must be made while no python venvs are # active. # * OLCF provided python environment modules (python_*) CANNOT be used with # your own self-installed python iterperator. Make sure none are in your # your own self-installed python interpretor. Make sure none are in your # environment. If you need one we provide, it must be installed in your venv # (see mpi4py below). # * Pre-compiled binaries should be avoided for packages that use dependencies # provided by OLCF environment modules # * The cray compiler wrapper needs to be used (instead of the raw system GCC # * The Cray compiler wrapper needs to be used (instead of the raw system GCC # compiler) when building packages with exotic link dependencies with # OLCF-provided environment modules. # * Compiled code that will be executed in-part on the batch nodes must be # built targetting them, even if the code may also be run on the compute # built targeting them, even if the code may also be run on the compute # nodes. # This script is written to explain what it is doing at each step in light of # the above considerations. Feel free to edit any part of it to suite your # needs. Once configured, this script should produce and actrivate a consistent # needs. Once configured, this script should produce and activate a consistent # python runtime environment when sourced. # Basic setup # =========== # Point me to where you want anaconda intalled. # Point me to where you want anaconda installed. # I recommend "/ccs/proj/<PROJID>/opt/anaconda/titan-gnu" which labels the host # and programming environment, is readable on the compute nodes, and is not # purged. Loading @@ -59,10 +59,6 @@ module load cray-hdf5-parallel cudatoolkit # Deploy Anaconda # =============== # On M.P.Belhorn's preferred shell (zsh), the anaconda 'activate' script doesn't # work without being in the anaconda binary directory. It assumes we have an # up-to-date zsh. This is to recall the CWD from which this script was sourced. _LAST_CWD="$PWD" # Install anaconda as needed if [ ! -d "${ANACONDA_PATH}" ]; then Loading @@ -78,70 +74,83 @@ if [ ! -d "${ANACONDA_PATH}" ]; then fi # Add Anconda to the PATH # Add Anaconda to the PATH # ======================= # We want to use ONLY the anaconda distro we # We cannot block Python from finding things in your $HOME/.local space, but be # We want to use ONLY the anaconda distro we installed to $ANACONDA_PATH. We # cannot block Python from finding modules in your $HOME/.local space, but be # careful that items there may have been installed/built against other # interperetors and in the context of other environments. Try to avoid using # packages installed there unless they are simple, v2.6-compatible packages # written purely in python. # interpretors and in the context of other environments because $HOME is shared # on all OLCF resources. Try to avoid using packages installed there unless they # are simple, v2.6-compatible packages written purely in python. export PATH="${ANACONDA_PATH}/bin:$PATH" # Wipe the PYTHONPATH so it is not contaminated with packages installed for use # with OLCF-provided python iterpereters. # with OLCF-provided python interpretors. export PYTHONPATH='' # Activate the venv # ================= # Install the venv # ================ # Strictly speaking, this isn't necessary since we just went through the work of # installing our own interperator but it is good practice and prevents some # clashes with OLCF provided python packages/interperators. # installing our own interpretor but it is good practice and prevents some # clashes with OLCF provided python packages/interpreters. # On M.P.Belhorn's preferred shell (zsh), the anaconda 'activate' script doesn't # work without being in the anaconda binary directory (it assumes we are using # an up-to-date zsh). This is to recall the CWD from which we started. _LAST_CWD="$PWD" cd "$ANACONDA_PATH/bin" # If this is the first time this script has been called, # then create the venv... if [ ! -d "../envs/myenv" ]; then # Configure compiler wrapper to target batch node so compiled code will run on # both batch and compute nodes. Switch back to craype-interlagos when building # code that will only be run on the compute nodes for optimal performance. if [ ! -d "${ANACONDA_PATH}/envs/${VENV_NAME}" ]; then # Configure compiler wrapper to target the batch nodes so compiled code will # run on both batch and compute nodes. Switch back to craype-interlagos when # building code that will only be run on the compute nodes for optimal # performance. module unload craype-interlagos module load craype-istanbul # Use the latest and greatest! conda update conda # This may need some work. "accelerate" uses CUDA, but conda is notoriously # bad for using pre-compiled binaries that "just work" on most systems. # Unfortunately, things that "just work" often don't in exotic environments. # More unfortunately, Continuum Analytics don't feel it is necessary to # document ways to guide `conda install` to use outside dependencies as `pip` # does so we can ensure `accelerate` is using our provided `cudatoolkit`... conda install accelerate # Create the venv conda create -n $VENV_NAME python=2.7 numpy accelerate conda create -n "${VENV_NAME}" python=2.7 numpy accelerate # Activate it source activate $VENV_NAME source activate "${VENV_NAME}" # Manually install core packages without relying on precompiled binaries from # Manually install core packages without relying on pre-compiled binaries from # conda that would use, for instance, openmpi instead of Cray MPICH. pip install --upgrade pip CC=cc pip install -v --no-binary :all: mpi4py # H5py needs some configure options to use MPI. Worst case scenerio, some # pacakges will need to be built without pip. # H5py needs some configure options to use MPI. Worst case scenario, some # packages will need to be built without pip. HDF5_DIR="${CRAY_HDF5_DIR}/${PE_ENV}/${GNU_VERSION%.*}" CC=cc HDF5_MPI="ON" HDF5_DIR="${HDF5_DIR}" pip install -v --no-binary :all: h5py source deactivate $VENV_NAME # Reconfigure the compiler wrapper for the compute nodes. Remember, all # environment module changes must happen *without* an active python venv. source deactivate "${VENV_NAME}" module unload craype-istanbul module load craype-interlagos fi # Activate the venv. source activate $VENV_NAME source activate "${VENV_NAME}" # End where we began. cd "$_LAST_CWD cd "${_LAST_CWD}" Loading
deploy_anaconda.sh +42 −33 Original line number Diff line number Diff line Loading @@ -6,34 +6,34 @@ # Overview # ======== # There are several key considerations to running your own python interpereter # There are several key considerations to running your own python interpreter # (like anaconda) in a virtualenv on Titan: # # * All environment module changes must be made while no python venvs are # active. # * OLCF provided python environment modules (python_*) CANNOT be used with # your own self-installed python iterperator. Make sure none are in your # your own self-installed python interpretor. Make sure none are in your # environment. If you need one we provide, it must be installed in your venv # (see mpi4py below). # * Pre-compiled binaries should be avoided for packages that use dependencies # provided by OLCF environment modules # * The cray compiler wrapper needs to be used (instead of the raw system GCC # * The Cray compiler wrapper needs to be used (instead of the raw system GCC # compiler) when building packages with exotic link dependencies with # OLCF-provided environment modules. # * Compiled code that will be executed in-part on the batch nodes must be # built targetting them, even if the code may also be run on the compute # built targeting them, even if the code may also be run on the compute # nodes. # This script is written to explain what it is doing at each step in light of # the above considerations. Feel free to edit any part of it to suite your # needs. Once configured, this script should produce and actrivate a consistent # needs. Once configured, this script should produce and activate a consistent # python runtime environment when sourced. # Basic setup # =========== # Point me to where you want anaconda intalled. # Point me to where you want anaconda installed. # I recommend "/ccs/proj/<PROJID>/opt/anaconda/titan-gnu" which labels the host # and programming environment, is readable on the compute nodes, and is not # purged. Loading @@ -59,10 +59,6 @@ module load cray-hdf5-parallel cudatoolkit # Deploy Anaconda # =============== # On M.P.Belhorn's preferred shell (zsh), the anaconda 'activate' script doesn't # work without being in the anaconda binary directory. It assumes we have an # up-to-date zsh. This is to recall the CWD from which this script was sourced. _LAST_CWD="$PWD" # Install anaconda as needed if [ ! -d "${ANACONDA_PATH}" ]; then Loading @@ -78,70 +74,83 @@ if [ ! -d "${ANACONDA_PATH}" ]; then fi # Add Anconda to the PATH # Add Anaconda to the PATH # ======================= # We want to use ONLY the anaconda distro we # We cannot block Python from finding things in your $HOME/.local space, but be # We want to use ONLY the anaconda distro we installed to $ANACONDA_PATH. We # cannot block Python from finding modules in your $HOME/.local space, but be # careful that items there may have been installed/built against other # interperetors and in the context of other environments. Try to avoid using # packages installed there unless they are simple, v2.6-compatible packages # written purely in python. # interpretors and in the context of other environments because $HOME is shared # on all OLCF resources. Try to avoid using packages installed there unless they # are simple, v2.6-compatible packages written purely in python. export PATH="${ANACONDA_PATH}/bin:$PATH" # Wipe the PYTHONPATH so it is not contaminated with packages installed for use # with OLCF-provided python iterpereters. # with OLCF-provided python interpretors. export PYTHONPATH='' # Activate the venv # ================= # Install the venv # ================ # Strictly speaking, this isn't necessary since we just went through the work of # installing our own interperator but it is good practice and prevents some # clashes with OLCF provided python packages/interperators. # installing our own interpretor but it is good practice and prevents some # clashes with OLCF provided python packages/interpreters. # On M.P.Belhorn's preferred shell (zsh), the anaconda 'activate' script doesn't # work without being in the anaconda binary directory (it assumes we are using # an up-to-date zsh). This is to recall the CWD from which we started. _LAST_CWD="$PWD" cd "$ANACONDA_PATH/bin" # If this is the first time this script has been called, # then create the venv... if [ ! -d "../envs/myenv" ]; then # Configure compiler wrapper to target batch node so compiled code will run on # both batch and compute nodes. Switch back to craype-interlagos when building # code that will only be run on the compute nodes for optimal performance. if [ ! -d "${ANACONDA_PATH}/envs/${VENV_NAME}" ]; then # Configure compiler wrapper to target the batch nodes so compiled code will # run on both batch and compute nodes. Switch back to craype-interlagos when # building code that will only be run on the compute nodes for optimal # performance. module unload craype-interlagos module load craype-istanbul # Use the latest and greatest! conda update conda # This may need some work. "accelerate" uses CUDA, but conda is notoriously # bad for using pre-compiled binaries that "just work" on most systems. # Unfortunately, things that "just work" often don't in exotic environments. # More unfortunately, Continuum Analytics don't feel it is necessary to # document ways to guide `conda install` to use outside dependencies as `pip` # does so we can ensure `accelerate` is using our provided `cudatoolkit`... conda install accelerate # Create the venv conda create -n $VENV_NAME python=2.7 numpy accelerate conda create -n "${VENV_NAME}" python=2.7 numpy accelerate # Activate it source activate $VENV_NAME source activate "${VENV_NAME}" # Manually install core packages without relying on precompiled binaries from # Manually install core packages without relying on pre-compiled binaries from # conda that would use, for instance, openmpi instead of Cray MPICH. pip install --upgrade pip CC=cc pip install -v --no-binary :all: mpi4py # H5py needs some configure options to use MPI. Worst case scenerio, some # pacakges will need to be built without pip. # H5py needs some configure options to use MPI. Worst case scenario, some # packages will need to be built without pip. HDF5_DIR="${CRAY_HDF5_DIR}/${PE_ENV}/${GNU_VERSION%.*}" CC=cc HDF5_MPI="ON" HDF5_DIR="${HDF5_DIR}" pip install -v --no-binary :all: h5py source deactivate $VENV_NAME # Reconfigure the compiler wrapper for the compute nodes. Remember, all # environment module changes must happen *without* an active python venv. source deactivate "${VENV_NAME}" module unload craype-istanbul module load craype-interlagos fi # Activate the venv. source activate $VENV_NAME source activate "${VENV_NAME}" # End where we began. cd "$_LAST_CWD cd "${_LAST_CWD}"