Skip to content

Instantly share code, notes, and snippets.

@karenyyng
Last active October 30, 2017 20:45
Show Gist options
  • Save karenyyng/692025f1cc8ec753cd44a6cc9f78db6a to your computer and use it in GitHub Desktop.
Save karenyyng/692025f1cc8ec753cd44a6cc9f78db6a to your computer and use it in GitHub Desktop.
load_conda.sh
if [[ -z $CONDA_ENV ]]; then
echo "CONDA_ENV is not defined. Quitting installation script."
exit 1
fi
if [[ $NERSC_HOST == "cori"* ]]; then
DIR=/global/common/cori/software/python/3.5-anaconda
module load python/3.5-anaconda
echo 'On Cori: echo finish loading python/3.5-anaconda'
module load craype-hugepages2M
echo 'On Cori: loading craype-hugepages2M'
module load h5py-parallel
echo 'On Cori: loading h5py-parallel'
fi
export CONDA=$ENV_DIR/py${PY_VERSION}_envs/${CONDA_ENV}/bin/conda
cp $HOME/.condarc_$CONDA_ENV $HOME/.condarc
echo "Activating conda environment at $ENV_DIR/py${PY_VERSION}_envs/$CONDA_ENV using"
echo "source ${ENV_DIR}/py${PY_VERSION}_envs/${CONDA_ENV}/bin/activate $CONDA_ENV"
source ${ENV_DIR}/py${PY_VERSION}_envs/${CONDA_ENV}/bin/activate $CONDA_ENV
# echo "Using some recommended settings that may not be the best for your use case"
# # # https://software.intel.com/en-us/node/522691
# # # https://software.intel.com/en-us/mkl-macos-developer-guide-mkl-dynamic
export NUM_OF_THREADS=$(grep 'model name' /proc/cpuinfo | wc -l)
if [[ $(grep 'model name' /proc/cpuinfo ) == *'Xeon Phi'* ]]; then
export KMP_AFFINITY=granularity=fine,compact
export MKL_DYNAMIC=false
export HPL_LARGEPAGE=1
export KMP_BLOCKTIME=800
export OMP_NUM_THREADS=$(( $NUM_OF_THREADS / 4 ))
export MKL_NUM_THREADS=$(( $NUM_OF_THREADS / 4 ))
export KMP_HW_SUBSET=${OMP_NUM_THREADS}c,1t # or use 64c,2t
# export MKL_VERBOSE=1
# export MKL_FFT_VERBOSE=1
else
export KMP_BLOCKTIME=800
export OMP_NUM_THREADS=$(( $NUM_OF_THREADS / 4 ))
export MKL_NUM_THREADS=$(( $NUM_OF_THREADS / 4 ))
fi
echo "Setting KMP_BLOCKTIME = $KMP_BLOCKTIME"
echo "Setting KMP_AFFINITY = $KMP_AFFINITY"
echo "Setting MKL_DYNAMIC = $MKL_DYNAMIC"
echo "Setting HPL_LARGEPAGE= $HPL_LARGEPAGE"
echo "Setting OMP_NUM_THREADS=$OMP_NUM_THREADS"
echo "Setting MKL_NUM_THREADS=$MKL_NUM_THREADS"
echo "Setting KMP_HW_SUBSET=$KMP_HW_SUBSET"
echo "Setting MKL_VERBOSE=$MKL_VERBOSE"
echo "Setting MKL_FFT_VERBOSE=$MKL_FFT_VERBOSE"
echo "Setting HUGETLB_DEFAULT_PAGE_SIZE=$HUGETLB_DEFAULT_PAGE_SIZE"
echo "Setting PE_HUGEPAGES_PKGCONFIG_VARIABLES=$PE_HUGEPAGES_PKGCONFIG_VARIABLES"
echo "PE_HUGEPAGES_TEXT_SEGMENT=$PE_HUGEPAGES_TEXT_SEGMENT"
echo "PE_HUGEPAGES_TEXT_SEGMENT=$PE_HUGEPAGES_TEXT_SEGMENT"
echo "PE_HUGEPAGES_PAGE_SIZE=$PE_HUGEPAGES_PAGE_SIZE"
echo "HUGETLB_MORECORE_HEAPBASE=$HUGETLB_MORECORE_HEAPBASE"
echo "HUGETLB_MORECORE=$HUGETLB_MORECORE"
echo "HUGETLB_ELFMAP=$HUGETLB_ELFMAP"
echo "HUGETLB_FORCE_ELFMAP=$HUGETLB_FORCE_ELFMAP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment