Debian Codegraph @

brian2/codegen/get_cpu_flags.py

raw
1 """
2 This script is used to ask for the CPU flags on Windows. We use this instead of
3 importing the cpuinfo package, because recent versions of py-cpuinfo use the
4 multiprocessing module, and any import of cpuinfo that is not within a
5 `if __name__ == '__main__':` block will lead to the script being executed twice.
6
7 The CPU flags are printed to stdout encoded as JSON.
8 """
9
10 import json
11
12 if __name__ == "__main__":
13 import cpuinfo
14
15 flags = cpuinfo.get_cpu_info()["flags"]
16 print(json.dumps(flags))