|
23 | 23 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 | 24 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | 25 |
|
| 26 | +# pylint: disable=no-member |
26 | 27 |
|
27 | | -import mkl |
28 | 28 | import re |
29 | 29 |
|
| 30 | +import mkl |
| 31 | + |
30 | 32 |
|
31 | 33 | def enable_best_instructions_set(): |
32 | | - for instructions_set in ['avx512', 'avx2', 'avx', 'sse4_2']: |
33 | | - if mkl.enable_instructions(instructions_set) == 'success': |
| 34 | + for instructions_set in ["avx512", "avx2", "avx", "sse4_2"]: |
| 35 | + if mkl.enable_instructions(instructions_set) == "success": |
34 | 36 | result = instructions_set |
35 | 37 | break |
36 | 38 | else: |
37 | | - result = 'error' |
| 39 | + result = "error" |
38 | 40 |
|
39 | 41 | return result |
40 | 42 |
|
41 | 43 |
|
42 | 44 | def is_max_supported_instructions_set(instructions_set): |
43 | 45 | result = False |
44 | | - if re.search(instructions_set.replace('4_2', '4.2'), mkl.get_version()['Processor'].decode(), re.IGNORECASE): |
| 46 | + if re.search( |
| 47 | + instructions_set.replace("4_2", "4.2"), |
| 48 | + mkl.get_version()["Processor"].decode(), |
| 49 | + re.IGNORECASE, |
| 50 | + ): |
45 | 51 | result = True |
46 | 52 |
|
47 | 53 | return result |
48 | 54 |
|
49 | 55 |
|
50 | | -if __name__ == '__main__': |
| 56 | +if __name__ == "__main__": |
51 | 57 | time_begin = mkl.dsecnd() |
52 | 58 | print(mkl.get_version_string()) |
53 | 59 |
|
54 | 60 | instructions_set = enable_best_instructions_set() |
55 | | - print('Enable snstructions set: ' + str(instructions_set)) |
| 61 | + print("Enable snstructions set: " + str(instructions_set)) |
56 | 62 |
|
57 | 63 | is_max = is_max_supported_instructions_set(instructions_set) |
58 | | - print('Is the best supported instructions set: ' + str(is_max)) |
| 64 | + print("Is the best supported instructions set: " + str(is_max)) |
59 | 65 |
|
60 | 66 | time_end = mkl.dsecnd() |
61 | | - print('Execution time: ' + str(time_end - time_begin)) |
| 67 | + print("Execution time: " + str(time_end - time_begin)) |
0 commit comments