Skip to content

Commit

Permalink
Bug fixes to manage BLAS/OpenMP library linkage across platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
shz9 committed Apr 5, 2024
1 parent fcbd806 commit eaf5876
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def no_cythonize(cy_extensions, **_ignore):
["viprs/model/vi/e_step_cpp.pyx"],
language="c++",
include_dirs=[np.get_include()] + blas_include,
extra_link_args=[[], ['-lcblas']][len(blas_include) > 0],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] + blas_macros,
extra_compile_args=["-O3"])
]
Expand Down
8 changes: 6 additions & 2 deletions viprs/model/vi/e_step.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ dot(T* x, U* y, int size) {
T s = 0.;

#ifdef _OPENMP
#pragma omp simd
#ifndef _WIN32
#pragma omp simd
#endif
#endif
for (int i = 0; i < size; ++i) {
s += x[i]*static_cast<T>(y[i]);
Expand Down Expand Up @@ -162,7 +164,9 @@ axpy(T* x, U* y, T alpha, int size) {
*/

#ifdef _OPENMP
#pragma omp simd
#ifndef _WIN32
#pragma omp simd
#endif
#endif
for (int i = 0; i < size; ++i) {
x[i] += static_cast<T>(y[i]) * alpha;
Expand Down

0 comments on commit eaf5876

Please sign in to comment.