Skip to content

Replace Kaldi mutex with STL mutex #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ivector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OBJFILES = conv-ivector-extractor.o
LIBNAME = kaldi-ivector-conv

ADDLIBS = ${KALDI_DIR}/src/gmm/kaldi-gmm.a ${KALDI_DIR}/src/tree/kaldi-tree.a ${KALDI_DIR}/src/transform/kaldi-transform.a \
${KALDI_DIR}/src/thread/kaldi-thread.a ${KALDI_DIR}/src/matrix/kaldi-matrix.a ${KALDI_DIR}/src/base/kaldi-base.a \
${KALDI_DIR}/src/matrix/kaldi-matrix.a ${KALDI_DIR}/src/base/kaldi-base.a \
${KALDI_DIR}/src/util/kaldi-util.a

include ${KALDI_DIR}/src/makefiles/default_rules.mk
10 changes: 5 additions & 5 deletions src/ivector/conv-ivector-extractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
#define KALDI_IVECTOR_IVECTOR_EXTRACTOR_H_

#include <vector>
#include <mutex>
#include "base/kaldi-common.h"
#include "matrix/matrix-lib.h"
#include "gmm/model-common.h"
#include "gmm/diag-gmm.h"
#include "gmm/full-gmm.h"
#include "itf/options-itf.h"
#include "util/common-utils.h"
#include "thread/kaldi-mutex.h"
#include "hmm/posterior.h"
#include "ivector/ivector-extractor.h"

Expand Down Expand Up @@ -331,7 +331,7 @@ class IvectorConvStats {

/// This mutex guards gamma_, Y_ and R_ (for multi-threaded
/// update)
Mutex subspace_stats_lock_;
std::mutex subspace_stats_lock_;

/// Total occupation count for each Gaussian index (zeroth-order stats)
Vector<double> gamma_;
Expand All @@ -348,7 +348,7 @@ class IvectorConvStats {
Matrix<double> R_;

/// This mutex guards Q_ and G_ (for multi-threaded update)
Mutex weight_stats_lock_;
std::mutex weight_stats_lock_;

/// Q_ is like R_ (with same dimensions), except used for weight estimation;
/// the scatter of ivectors is weighted by the coefficient of the quadratic
Expand All @@ -360,7 +360,7 @@ class IvectorConvStats {
Matrix<double> G_;

/// This mutex guards S_ (for multi-threaded update)
Mutex variance_stats_lock_;
std::mutex variance_stats_lock_;

/// S_{i}, raw second-order stats per Gaussian which we will use to update the
/// variances Sigma_inv_.
Expand All @@ -369,7 +369,7 @@ class IvectorConvStats {

/// This mutex guards num_ivectors_, ivector_sum_ and ivector_scatter_ (for multi-threaded
/// update)
Mutex prior_stats_lock_;
std::mutex prior_stats_lock_;

/// Count of the number of iVectors we trained on. Need for prior re-estimation.
/// (make it double not int64 to more easily support weighting later.)
Expand Down
2 changes: 1 addition & 1 deletion src/ivectorbin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OBJFILES =
TESTFILES =

ADDLIBS = ../ivector/kaldi-ivector-conv.a ${KALDI_DIR}/src/ivector/kaldi-ivector.a ${KALDI_DIR}/src/hmm/kaldi-hmm.a ${KALDI_DIR}/src/gmm/kaldi-gmm.a \
${KALDI_DIR}/src/tree/kaldi-tree.a ${KALDI_DIR}/src/thread/kaldi-thread.a ${KALDI_DIR}/src/matrix/kaldi-matrix.a \
${KALDI_DIR}/src/tree/kaldi-tree.a ${KALDI_DIR}/src/matrix/kaldi-matrix.a \
${KALDI_DIR}/src/util/kaldi-util.a ${KALDI_DIR}/src/base/kaldi-base.a

include ${KALDI_DIR}/src/makefiles/default_rules.mk