This repository has been archived by the owner on Feb 9, 2021. It is now read-only.
forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addresses comments in runtime feature discovery API (apache#13964)
* Prototype for runtime feature detection * Includes from diamond to quotes * Add CPU feature and BLAS flavour flags * Add BLAS flavour and CPU SSE and AVX flags * MXNET_USE_LAPACK * Fix C++ linting errors * Expose runtime feature detection in the public C API and in the Python API * Refactor Storage -> FeatureSet * Refine documentation * Add failure case * Fix pylint * Address CR comments * Address CR comments * Address CR * Address CR * Address CR * Address CR * remove old files * Fix unit test * Port CMake blas change from apache#13957 * Fix lint * mxruntime -> libinfo * Fix comments * restore libinfo.py * Rework API for feature detection / libinfo * Refine documentation * Fix lint * Fix lint * Define make_unique only for C++ std < 14 * Add memory include * remove old tests * make_unique fiasco * Fix lint
- Loading branch information
Showing
12 changed files
with
203 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# coding: utf-8 | ||
# pylint: disable=not-an-iterable | ||
|
||
"""runtime querying of compile time features in the native library""" | ||
|
||
import ctypes | ||
from .base import _LIB, check_call | ||
|
||
class LibFeature(ctypes.Structure): | ||
""" | ||
Compile time feature description | ||
""" | ||
_fields_ = [ | ||
("name", ctypes.c_char_p), | ||
("index", ctypes.c_uint32), | ||
("enabled", ctypes.c_bool) | ||
] | ||
|
||
def libinfo_features(): | ||
""" | ||
Check the library for compile-time features. The list of features are maintained in libinfo.h and libinfo.cc | ||
Returns | ||
------- | ||
A list of class LibFeature indicating which features are available and enabled | ||
""" | ||
lib_features = ctypes.POINTER(LibFeature)() | ||
lib_features_size = ctypes.c_size_t() | ||
check_call(_LIB.MXLibInfoFeatures(ctypes.byref(lib_features), ctypes.byref(lib_features_size))) | ||
feature_list = [lib_features[i] for i in range(lib_features_size.value)] | ||
return feature_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.