kaldi-asr / kaldi

kaldi-asr/kaldi is the official location of the Kaldi project.
http://kaldi-asr.org
Other
14.18k stars 5.32k forks source link

Add support for AMD GPUs using HIP/ROCm #4882

Closed sfantao closed 11 months ago

sfantao commented 11 months ago

Add support in KALDI for AMD GPUs by hipifying the existing CUDA implementation.

The implementation comprises the following:

ROCm builds can be completed with (assuming existing python environment with requirements), e.g.:

cd <kaldi source>/src
./configure \
    --shared \
    --debug-level=0 \
    --use-cuda=no \
    --with-cudadecoder \
    --use-rocm \
    --rocm-targets="gfx90a" \
    --mkl-root="$MKL_ROOT"

make -j clean depend
make V=1 VERBOSE=1 \
  EXTRA_CXXFLAGS="-g -ggdb -O3 -DNDEBUG -Wno-unused-variable -Wno-unused-but-set-variable" \
  EXTRA_ROCM_FLAGS="-g -ggdb -O3 -DDEBUG -Wno-unused-variable -Wno-unused-but-set-variable" \
  EXTRA_LDFLAGS="" -j 

This PR was tested successfully on AMD MI250x and NVIDIA A100 hardware.

danpovey commented 11 months ago

Thanks a lot for this! Sicne the tests run, I'll merge and if users have problems we can address them at that time.