Skip to content

Commit

Permalink
Use NEON and SSE2 without checking on platforms supporting it by default
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Feb 20, 2024
1 parent 87b0f90 commit d83af9f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 8 additions & 10 deletions pyfastani/_sequtils/sequtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ static const X86Features features = GetX86Info().features;
using namespace cpu_features;
static const ArmFeatures features = GetArmInfo().features;
#endif
#ifdef __aarch64__
#include "cpuinfo_aarch64.h"
using namespace cpu_features;
static const Aarch64Features features = GetAarch64Info().features;
#endif

extern "C" {
// --- Fast copy with uppercase --------------------------------------------
Expand Down Expand Up @@ -49,17 +44,20 @@ extern "C" {
#endif
#ifdef __aarch64__
#ifdef NEON_BUILD_SUPPORTED
if (features.neon)
return neon_copy_upper(dst, src, len);
else
return neon_copy_upper(dst, src, len);
#endif
#endif
#if defined(__x86__) || defined(__x86_64__)
#ifdef __x86__
#ifdef SSE2_BUILD_SUPPORTED
if (features.sse2)
return sse2_copy_upper(dst, src, len); // fast copying plus upper.
return sse2_copy_upper(dst, src, len);
else
#endif
#endif
#ifdef __x86_64__
#ifdef SSE2_BUILD_SUPPORTED
return sse2_copy_upper(dst, src, len);
#endif
#endif
return default_copy_upper(dst, src, len);
}
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ classifier =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Medical Science Apps.
Typing :: Typed
project_urls =
Documentation = https://pyfastani.readthedocs.io/en/stable/
Bug Tracker = https://github.com/althonos/pyfastani/issues
Changelog = https://github.com/althonos/pyfastani/blob/master/CHANGELOG.md
Coverage = https://codecov.io/gh/althonos/pyfastani/
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ def _check_getid(self):
flags = ["-Werror=implicit-function-declaration"]

try:
self.mkpath(self.build_temp)
objects = self.compiler.compile([testfile], extra_postargs=flags)
except CompileError:
_eprint("no")
Expand Down Expand Up @@ -426,6 +425,11 @@ def build_extensions(self):
# remove universal compilation flags for OSX
if PLATFORM_SYSTEM == "Darwin":
_patch_osx_compiler(self.compiler)

# check if `PyInterpreterState_GetID` is available
if self._check_getid():
self.compiler.define_macro("HAS_PYINTERPRETERSTATE_GETID", 1)

# build the extensions as normal
_build_ext.build_extensions(self)

Expand All @@ -443,10 +447,6 @@ def build_extension(self, ext):
else:
ext.define_macros.append(("CYTHON_WITHOUT_ASSERTIONS", 1))

# check if `PyInterpreterState_GetID` is available
if self._check_getid():
ext.define_macros.append(("HAS_PYINTERPRETERSTATE_GETID", 1))

# C++ OS-specific options
if ext.language == "c++":
# make sure to build with C++11
Expand Down

0 comments on commit d83af9f

Please sign in to comment.