diff --git a/.azure_pipeline.yml b/.azure_pipeline.yml index 99d0f84..bd799fe 100644 --- a/.azure_pipeline.yml +++ b/.azure_pipeline.yml @@ -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: diff --git a/threadpoolctl.py b/threadpoolctl.py index cfebcb5..bb868e1 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -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""" @@ -472,6 +493,7 @@ def get_version(self): MKLController, OpenMPController, FlexiBLASController, + AccelerateController, ] # Helpers for the doc and test names @@ -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. @@ -1083,13 +1106,13 @@ 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 @@ -1097,6 +1120,10 @@ def _make_controller_from_path(self, filepath): # 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