Skip to content
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

[WIP] FEA Support Veclib/Accelerate #166

Open
wants to merge 5 commits 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
7 changes: 7 additions & 0 deletions .azure_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ stages:
INSTALL_BLAS: 'flexiblas'
CC_OUTER_LOOP: 'clang'
CC_INNER_LOOP: 'clang'
pylatest_accelerate:
PACKAGER: 'conda-forge'
PYTHON_VERSION: '*'
BLAS: 'accelerate'
CC_OUTER_LOOP: 'clang'
CC_INNER_LOOP: 'clang'
INSTALL_LIBOMP: 'conda-forge'

- stage:
jobs:
Expand Down
41 changes: 34 additions & 7 deletions threadpoolctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,27 @@ def _get_threading_layer(self):
return layer_map[set_threading_layer(-1)]


class AccelerateController(LibController):
"""Controller class for Accelerate"""

user_api = "blas"
internal_api = "accelerate"
filename_prefixes = ["libveclib"]
# check_symbols = ("_veclib",)

def set_additional_attributes(self):
self.remark = "Number of threads cannot be changed at runtime."

def get_num_threads(self):
return "Not available"

def set_num_threads(self, num_threads):
pass

def get_version(self):
return None


class OpenMPController(LibController):
"""Controller class for OpenMP"""

Expand Down Expand Up @@ -472,6 +493,7 @@ def get_version(self):
MKLController,
OpenMPController,
FlexiBLASController,
AccelerateController,
]

# Helpers for the doc and test names
Expand Down Expand Up @@ -1059,6 +1081,7 @@ def _make_controller_from_path(self, filepath):
# `lower` required to take account of OpenMP dll case on Windows
# (vcomp, VCOMP, Vcomp, ...)
filename = os.path.basename(filepath).lower()
# print(filename)

# Loop through supported libraries to find if this filename corresponds
# to a supported one.
Expand All @@ -1083,20 +1106,24 @@ def _make_controller_from_path(self, filepath):
for func in controller_class.check_symbols
):
continue
else:
# We ignore libblas on other platforms than windows because there
# might be a libblas dso comming with openblas for instance that
# can't be used to instantiate a pertinent LibController (many
# symbols are missing) and would create confusion by making a
# duplicate entry in threadpool_info.
continue
# else:
# # We ignore libblas on other platforms than windows because there
# # might be a libblas dso comming with openblas for instance that
# # can't be used to instantiate a pertinent LibController (many
# # symbols are missing) and would create confusion by making a
# # duplicate entry in threadpool_info.
# continue

# filename matches a prefix. Now we check if the library has the symbols we
# are looking for. If none of the symbols exists, it's very likely not the
# expected library (e.g. a library having a common prefix with one of the
# our supported libraries). Otherwise, create and store the library
# controller.
lib_controller = controller_class(filepath=filepath, prefix=prefix)

if prefix == "libblas":
print(f"{hasattr(lib_controller.dynlib, '_veclib') = }")
print(f"{hasattr(lib_controller.dynlib, '_sdot') = }")
if not hasattr(controller_class, "check_symbols") or any(
hasattr(lib_controller.dynlib, func)
for func in controller_class.check_symbols
Expand Down
Loading