Skip to content

Commit

Permalink
pragma omp simd: WeightMatrix::MatrixDotVector()
Browse files Browse the repository at this point in the history
  • Loading branch information
rfschtkt committed Jun 7, 2017
1 parent 3b095f4 commit d364585
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lstm/weightmatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,14 @@ void WeightMatrix::MatrixDotVector(const inT8* u, double* v) const {
for (int i = 0; i < num_out; ++i) {
const inT8* Wi = wi_[i];
int total = 0;
#if _OPENMP < 201307 // before OpenMP 4.0 try something else first
if (SIMDDetect::IsSSEAvailable()) {
total = IntDotProductSSE(u, Wi, num_in);
} else {
}
else
#endif
{
#pragma omp simd reduction(+:total) // ignored before OpenMP 4.0
for (int j = 0; j < num_in; ++j) total += Wi[j] * u[j];
}
// Add in the bias and correct for integer values.
Expand Down

0 comments on commit d364585

Please sign in to comment.