Skip to content

Instantly share code, notes, and snippets.

@sonal-ssj
Forked from pzelasko/install_k2.sh
Created May 25, 2021 05:00
Show Gist options
  • Save sonal-ssj/dc3b0fafc5932cbd4a3b58fe8b22000f to your computer and use it in GitHub Desktop.
Save sonal-ssj/dc3b0fafc5932cbd4a3b58fe8b22000f to your computer and use it in GitHub Desktop.
Steps needed to install K2 from scratch
#!/usr/bin/env bash
# Common steps
conda create -n k2 python=3.8
conda activate k2
conda install -c nvidia cudnn=7.6.5 cudatoolkit=10.2
conda install -c pytorch pytorch
pip install cmake
mkdir build
pushd build
CONDA_ROOT="$(conda config --show root_prefix | cut -f2 -d' ')"
CONDA_ENV_DIR="$CONDA_ROOT/envs/k2"
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_COMPILER=$(which nvcc) \
-DPYTHON_EXECUTABLE=$(which python) \
-DCUDNN_LIBRARY_PATH=$CONDA_ENV_DIR/lib/libcudnn.so \
-DCUDNN_INCLUDE_PATH=$CONDA_ENV_DIR/include/ \
..
make -j24 _k2
popd
# When updating and rebuilding K2, before executing these steps, run:
# rm -rf dist/
scripts/build_pip.sh
pip install dist/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment