Skip to content

Instantly share code, notes, and snippets.

@saurabh-kataria
Forked from pzelasko/install_k2.sh
Created November 17, 2021 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurabh-kataria/650496c4d550190c8683a93e4161b28e to your computer and use it in GitHub Desktop.
Save saurabh-kataria/650496c4d550190c8683a93e4161b28e 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 torchaudio
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