Skip to content

Commit

Permalink
Adjusted macro to properly autovectorize on GCC (tested with 9.4.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzelasko committed Jan 30, 2023
1 parent a8e2029 commit 5c279f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion extensions/reverb_rir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ float inner_product_clang(const vector<float> &buffer_, const vector<float> &rir
float inner_product_gcc(const vector<float> &buffer_, const vector<float> &rir_, int offset) {
const auto SIZE = rir_.size();
float sum = 0.0f;
#pragma GCC ivdep
#pragma omp simd reduction(+:sum)
for (unsigned int i = 0; i < SIZE; ++i) {
sum += buffer_[offset + i] * rir_[i];
}
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def no_cythonize(extensions, **_ignore):
"-Wno-unused-function",
"-Wno-unused-local-typedefs",
])
if not platform.startswith("darwin"):
COMPILE_ARGS.append("-fopenmp")
COMPILE_ARGS.append("-march=native")

if platform.startswith("darwin"):
COMPILE_ARGS.append("-stdlib=libc++")
Expand Down

0 comments on commit 5c279f4

Please sign in to comment.