def configure_clang(cpu, buildid, compiler, system_host_compiler, restrict_errors): version = get_output(compiler + " -dM -E - ") version = dict( map(lambda x: (x[1], " ".join(x[2:])), [line.split() for line in version])) major = int(version["__clang_major__"]) minor = int(version["__clang_minor__"]) minor2 = int(version["__clang_patchlevel__"]) print("Detected clang version: " + str(major) + " " + str(minor) + " " + str(minor2)) if major < 3 or (major == 3 and minor < 3): print( "Error: Clang Compiler version less then 3.3 is not supported, please update your compiler!" ) sys.exit(1) cxxflags = "-std=c++11 -ggdb -fcolor-diagnostics -m64 -Wall -Wextra -Wshadow -Wundef -Wshorten-64-to-32 -Wconversion -Wstrict-aliasing=2 -Wunknown-pragmas -Wundef -Wuninitialized -Wswitch -Wunused-label -Woverloaded-shift-op-parentheses -Wempty-body -Wheader-guard -Wimplicit-fallthrough -Wloop-analysis -Wheader-hygiene -Wpedantic -stdlib=libc++" if restrict_errors: cxxflags += " -Wfatal-errors" if major > 3 or (major == 3 and minor > 6): cxxflags += " -Wrange-loop-analysis -Wobjc-circular-container" if major > 3 or (major == 3 and minor >= 9): cxxflags += " -Wcomma" if major >= 5: cxxflags += " -Wcast-qual -Wunused-lambda-capture -Wstrict-prototypes" if major >= 6: cxxflags += " -Wtautological-compare" if major >= 7: cxxflags += " -Woverloaded-virtual -Wnon-virtual-dtor" if major >= 8: cxxflags += " -Wextra-semi-stmt -Wextra-semi" if major >= 10: cxxflags += " -Wtautological-overlap-compare -Wtautological-bitwise-compare -Wmisleading-indentation -Wsizeof-array-div -Wsizeof-pointer-div -Wxor-used-as-pow -Wfinal-dtor-non-final-class" if major >= 11: cxxflags += " -Wpointer-to-int-cast" if system_host_compiler: cxxflags += " --gcc-toolchain=" + system_host_compiler if "ccache" in buildid: cxxflags += " -Qunused-arguments" if "debug" in buildid or "noop" in buildid: if major < 4: cxxflags += " -O0" else: cxxflags += " -Og" if major >= 5: cxxflags += " -fsanitize=pointer-overflow -fsanitize=nullability" if major >= 7: cxxflags += " -fsanitize=implicit-conversion" cxxflags += " -ftemplate-backtrace-limit=0 -fdiagnostics-show-template-tree -fdiagnostics-show-category=name -fno-omit-frame-pointer -fno-optimize-sibling-calls" if platform.system() != "Darwin": cxxflags += " -fsanitize=undefined" # darwin clang does not like sanitize=undefined if "mpi" not in buildid and "cuda" not in buildid and "valgrind" not in buildid and "xcode" not in buildid: cxxflags += " -fsanitize=address" #" -fsanitize=memory" #-fsanitize=address-full elif "opt" in buildid or "fast" in buildid: if major >= 7: cxxflags += " -funroll-loops" if "lto" in buildid: cxxflags += " -flto" if "opt" in buildid: cxxflags += " -O3" elif "fast" in buildid: if major == 3 and minor < 7: cxxflags += " -O3" else: # work around for https://llvm.org/bugs/show_bug.cgi?id=13745 - math.h/math-finite-h broken in gcc 4.6 (host compiler of ubuntu 12.04) cxxflags += " -Ofast -D__extern_always_inline='extern __always_inline' -ffp-model=fast" if cpu == "unknown": cxxflags += " -march=native" print( "Warning: cpu type not detected, using -march=native instead.") # INTEL elif cpu == "i486": cxxflags += " -march=i486" elif cpu == "pentium": cxxflags += " -march=pentium" elif cpu == "pentiumpro": cxxflags += " -march=pentiumpro" elif cpu == "pentium2": cxxflags += " -march=pentium2" elif cpu == "pentium3": cxxflags += " -march=pentium3" elif cpu == "pentiumm": cxxflags += " -march=pentium-m" elif cpu == "pentium4m": cxxflags += " -march=pentium4m" elif cpu == "coresolo": cxxflags += " -march=prescott" elif cpu == "coreduo": cxxflags += " -march=core2" elif cpu == "penryn": cxxflags += " -march=core2" elif cpu == "nehalem": cxxflags += " -march=corei7" elif cpu == "westmere": cxxflags += " -march=corei7" elif cpu == "sandybridge": cxxflags += " -march=corei7-avx" elif cpu == "ivybridge": cxxflags += " -march=corei7-avx" elif cpu == "haswell": cxxflags += " -march=core-avx2" elif cpu == "broadwell": cxxflags += " -march=core-avx2" elif cpu == "skylake": cxxflags += " -march=core-avx2" elif cpu == "skylake-sp": cxxflags += " -march=core-avx2" elif cpu == "cascadelake": cxxflags += " -march=core-avx2" elif cpu == "coffee-lake": cxxflags += " -march=core-avx2" elif cpu == "kaby-lake": cxxflags += " -march=core-avx2" elif cpu == "itanium": cxxflags += " -march=itanium" elif cpu == "pentium4": cxxflags += " -march=pentium4m" elif cpu == "nocona": cxxflags += " -march=nocona" elif cpu == "itanium2": cxxflags += " -march=itanium2" # AMD elif cpu == "amd486": cxxflags += " -m32" elif cpu == "k5": cxxflags += " -m32" elif cpu == "k6": cxxflags += " -m32 -march=k6" elif cpu == "athlon": cxxflags += " -m32 -march=athlon" elif cpu == "athlonxp": cxxflags += " -m32 -march=athlon-xp" elif cpu == "opteron": cxxflags += " -m64 -march=k8" elif cpu == "athlon64": cxxflags += " -m64 -march=k8" elif cpu == "opteronx2": cxxflags += " -m64 -march=k8-sse3" elif cpu == "turionx2": cxxflags += " -m64 -march=k8-sse3" elif cpu == "turionx2": cxxflags += " -m64 -march=barcelona" elif cpu == "barcelona": cxxflags += " -m64 -march=barcelona" elif cpu == "shanghai": cxxflags += " -m64 -march=barcelona" elif cpu == "istanbul": cxxflags += " -m64 -march=barcelona" elif cpu == "magnycours": cxxflags += " -m64 -march=barcelona" elif cpu == "zen": cxxflags += " -m64 -march=znver1" elif cpu == "zen2": cxxflags += " -m64 -march=znver2" #ARM elif cpu == "cortexa53": cxxflags += " -march=a53" elif cpu == "armv8": cxxflags += " -m64 -march=v8.2a" else: cxxflags += " -march=native" print( "Warning: Detected cpu type not supported by configure_clang.py, using -march=native instead." ) return cxxflags
def configure_icc(cpu, buildid, compiler, system_host_compiler, restrict_errors): version = get_output(compiler + " -dM -E - ") version = dict( map(lambda x: (x[1], " ".join(x[2:])), [line.split() for line in version])) major = int(version["__INTEL_COMPILER"][0:2]) minor = int(version["__INTEL_COMPILER"][-2:]) minor2 = int(version["__INTEL_COMPILER_UPDATE"]) print("Detected icc version: " + str(major) + " " + str(minor) + " " + str(minor2)) if major < 15: print( "Error: Intel Compiler version less then 15 is not supported, please update your compiler!" ) sys.exit(1) cxxflags = "-std=c++11 -g -Wall -Wextra -Wcheck -Wdeprecated -Wnon-virtual-dtor -Wpointer-arith -Wreturn-type -Wshadow -Wp64 -Wshorten-64-to-32 -Wuninitialized -diag-disable 2304,2305" if restrict_errors: cxxflags += " -diag-error-limit1" if system_host_compiler: cxxflags += " -gcc-name=" + system_host_compiler # do not use stone old clang libc++ from apple with icc14, hopefully any gcc headers are present if platform.system() == "Darwin" and major == 14: cxxflags += " -no-use-clang-env" if "debug" in buildid or "noop" in buildid: cxxflags += " -O0 -debug all -ftrapuv" elif "opt" in buildid or "fast" in buildid: cxxflags += " -no-prec-div -diag-disable 11074,11076,25463,25464 -diag-disable openmp" if "lto" in buildid: cxxflags += " -ipo -diag-disable 11000,11001,11006" else: cxxflags += " -ip" if "opt" in buildid: cxxflags += " -O3" elif "fast" in buildid: cxxflags += " -Ofast" if cpu == "unknown": # generate code for every simd unit, existing so far cxxflags += " -axCORE-AVX512" print( "Warning: cpu type not detected, using generic vectorisation support instead." ) # INTEL elif cpu == "i486": pass elif cpu == "pentium": cxxflags += " -mia32" elif cpu == "pentiumpro": cxxflags += " -mia32" elif cpu == "pentium2": cxxflags += " -mia32" elif cpu == "pentium3": cxxflags += " -mia32" elif cpu == "pentiumm": cxxflags += " -xsse2" elif cpu == "pentiu4m": cxxflags += " -xsse2" elif cpu == "coresolo": cxxflags += " -xsse2" elif cpu == "coreduo": cxxflags += " -xsse3" elif cpu == "penryn": cxxflags += " -xsse4.1" elif cpu == "nehalem": cxxflags += " -xsse4.2" elif cpu == "westmere": cxxflags += " -xsse4.2" elif cpu == "sandybridge": cxxflags += " -xAVX" elif cpu == "ivybridge": cxxflags += " -xCORE-AVX-I" elif cpu == "haswell": cxxflags += " -xCORE-AVX2" elif cpu == "broadwell": cxxflags += " -xCORE-AVX2" elif cpu == "knightslanding": cxxflags += " -xMIC-AVX512" elif cpu == "skylake": cxxflags += " -xCORE-AVX2" elif cpu == "skylake-sp": cxxflags += " -xCORE-AVX512" elif cpu == "cascadelake": cxxflags += " -xCORE-AVX512" elif cpu == "coffee-lake": cxxflags += " -xCORE-AVX2" elif cpu == "kaby-lake": cxxflags += " -xCORE-AVX2" elif cpu == "itanium": # no setting necessary, the itanium version of the intel compiler # sets everything automatically pass elif cpu == "pentium4": cxxflags += " -xsse2" elif cpu == "nocona": cxxflags += " -xsse3" elif cpu == "itanium": # no setting necessary, the itanium version of the intel compiler # sets everything automatically pass # AMD elif cpu == "amd486": cxxflags += " -mia32" elif cpu == "k5": cxxflags += " -mia32" elif cpu == "k6": cxxflags += " -mia32" elif cpu == "athlon": cxxflags += " -mia32" elif cpu == "athlonxp": cxxflags += " -mia32" elif cpu == "opteron": cxxflags += " -msse2" elif cpu == "athlon64": cxxflags += " -msse2" elif cpu == "opteronx2": cxxflags += " -msse3" elif cpu == "turionx2": cxxflags += " -msse3" elif cpu == "barcelona": cxxflags += " -msse3" elif cpu == "shanghai": cxxflags += " -msse3" elif cpu == "istanbul": cxxflags += " -msse3" elif cpu == "magnycours": cxxflags += " -msse3" elif cpu == "zen": cxxflags += " -march=core-avx2" # not really supported by intel elif cpu == "zen2": cxxflags += " -march=core-avx2" # not really supported by intel else: print( "Warning: Detected cpu type not supported by configure_icc.py, using generic vectorisation support instead" ) # generate code for every simd unit, existing so far cxxflags += " -axCORE-AVX512" return cxxflags
def configure_gcc(cpu, buildid, compiler, restrict_errors): version = get_output(compiler + " -dM -E - ") version = dict(map(lambda x : (x[1], " ".join(x[2:])), [line.split() for line in version])) major = int(version["__GNUC__"]) minor = int(version["__GNUC_MINOR__"]) minor2 = int(version["__GNUC_PATCHLEVEL__"]) print ("Detected gcc version: " + str(major) + " " + str(minor) + " " + str(minor2)) if major < 4 or (major == 4 and minor < 8): print ("Error: GNU Compiler version less then 4.8 is not supported, please update your compiler or choose another one!") sys.exit(1) cmake_flags = "" cxxflags = "-std=c++11 -ggdb -Wall -Wextra -Wundef -Wshadow -Woverloaded-virtual -Wuninitialized -Wvla -Wlogical-op -Wdouble-promotion -Wformat=2 -Wnonnull" if restrict_errors: cxxflags += " -Wfatal-errors" if (major == 4 and minor >= 9) or major > 4: cxxflags += " -fdiagnostics-color=always" if major >= 5: cxxflags += " -Wswitch-bool -Wsizeof-array-argument -Wbool-compare -Wsuggest-override -Wnon-virtual-dtor -Wdelete-non-virtual-dtor" #cxxflags += " -Wsuggest-final-types -Wsuggest-final-methods" if major >= 6: cxxflags += " -Wshift-negative-value -Wduplicated-cond" #cxxflags += " -Wnull-dereference" #produces too much false positives if major >= 7: cxxflags += " -Wduplicated-branches -Wrestrict -Wdangling-else -Wnonnull -Wrestrict -Walloc-zero -Wparentheses" if "coverage" in buildid: cxxflags += " -fprofile-arcs -ftest-coverage" # For 'quadmath', we need to enable extended numeric literals, as otherwise the g++ will # not recognise the 'q' suffix for __float128 constants when compiling with --std=c++11 starting from gcc version 4.8. if "quadmath" in buildid: cxxflags += " -fext-numeric-literals" else: cxxflags += " -Wpedantic" # gcc up to 6 creates floating point code that lets the navstoke app diverge, if using avx support if (major <= 6) and (cpu == "sandybridge" or cpu == "ivybridge"): cpu="westmere" if "debug" in buildid or "noop" in buildid: if "debug" in buildid: cxxflags += " -Og " if "noop" in buildid: cxxflags += " -O0 " cxxflags += " -fdiagnostics-show-option -fno-omit-frame-pointer" #do not use stl debug libs under darwin, as these are as buggy as everything else in macos #do not use stl debug libs with cuda, the unified memory system blows big holes into the memory if platform.system() != "Darwin" and not "cuda" in buildid: cxxflags += " -D_GLIBCXX_DEBUG" cxxflags += " -lpthread -ldl" if (major >= 4 and minor >= 9) or major > 4: cxxflags += " -fsanitize=undefined" if major >= 5: cxxflags += " -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=bounds" cxxflags += " -fsanitize=alignment -fsanitize=object-size -fsanitize=vptr" if major >= 6: cxxflags += " -fsanitize=bounds-strict" if major >= 6 and major != 9 and not "mpi" in buildid and not "cuda" in buildid and not "valgrind" in buildid: cxxflags += " -fsanitize=address" if major >= 9: cxxflags += " -lrt" elif "opt" in buildid or "fast" in buildid: cxxflags += " -funsafe-loop-optimizations" if "lto" in buildid: cxxflags += " -flto" #use gcc provided binutils for lto cmake_flags += " -DCMAKE_RANLIB:PATH=" + find_exe("gcc-ranlib") cmake_flags += " -DCMAKE_AR:PATH=" + find_exe("gcc-ar") if major >= 5 and "x86_64" in platform.machine(): cxxflags +=" -malign-data=cacheline" if "opt" in buildid: cxxflags += " -O3" elif "fast" in buildid: cxxflags += " -Ofast" if cpu == "unknown": cxxflags += " -march=native" print ("Warning: cpu type not detected, using -march=native instead.") # INTEL elif cpu == "i486": cxxflags += " -march=i486 -m32" elif cpu == "pentium": cxxflags += " -march=pentium -m32" elif cpu == "pentiumpro": cxxflags += " -march=pentiumpro -m32" elif cpu == "pentium2": cxxflags += " -march=pentium2 -m32" elif cpu == "pentium3": cxxflags += " -march=pentium3 -m32" elif cpu == "pentiumm": cxxflags += " -march=pentium-m -m32" elif cpu == "pentium4m": cxxflags += " -march=pentium4m -m32" elif cpu == "coresolo": cxxflags += " -march=prescott -msse2" elif cpu == "coreduo": cxxflags += " -march=core2 -m64" elif cpu == "penryn": cxxflags += " -march=core2 -msse4.1 -m64" elif cpu == "nehalem": cxxflags += " -march=corei7 -m64" elif cpu == "westmere": cxxflags += " -march=corei7 -msse4.2 -m64" elif cpu == "sandybridge": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=corei7-avx -mavx -m64" elif cpu == "ivybridge": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=corei7-avx -mavx -m64" elif cpu == "haswell": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=haswell -m64" elif cpu == "broadwell": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=broadwell -m64" elif cpu == "skylake": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=skylake -m64" elif cpu == "skylake-sp": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=skylake-avx512 -m64" elif cpu == "kaby-lake": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=skylake -m64" #no special kabylake support, yet elif cpu == "coffee-lake": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=skylake -m64" elif cpu == "cascadelake": if platform.system() == "Darwin": cxxflags += " -march=corei7 -msse4 -msse4.1 -msse4.2 -m64" else: cxxflags += " -march=cascadelake -m64" elif cpu == "itanium": cxxflags += " -march=itanium" elif cpu == "pentium4": cxxflags += " -march=pentium4m -m64" elif cpu == "nocona": cxxflags += " -march=nocona -m64" elif cpu == "itanium2": cxxflags += " -march=itanium2" elif cpu == "knightslanding": if (major == 5 and minor >= 2) or (major > 5): cxxflags += " -march=knl" else: print ("Warning: Your gcc compiler is too old for knightslanding support!") # AMD elif cpu == "amd486": cxxflags += " -m32" elif cpu == "k5": cxxflags += " -m32" elif cpu == "k6": cxxflags += " -m32 -march=k6" elif cpu == "athlon": cxxflags += " -m32 -march=athlon" elif cpu == "athlonxp": cxxflags += " -m32 -march=athlon-xp" elif cpu == "opteron": cxxflags += " -m64 -march=k8" elif cpu == "athlon64": cxxflags += " -m64 -march=k8" elif cpu == "opteronx2": cxxflags += " -m64 -march=k8-sse3" elif cpu == "turionx2": cxxflags += " -m64 -march=k8-sse3" elif cpu == "turionx2": cxxflags += " -m64 -march=barcelona" elif cpu == "barcelona": cxxflags += " -m64 -march=barcelona" elif cpu == "shanghai": cxxflags += " -m64 -march=barcelona" elif cpu == "istanbul": cxxflags += " -m64 -march=barcelona" elif cpu == "magnycours": cxxflags += " -m64 -march=barcelona" #gcc O3 is broken on magnycours cxxflags = cxxflags.replace("O3", "O2") elif cpu == "zen": cxxflags += " -m64 -march=znver1" elif cpu == "zen2": cxxflags += " -m64 -march=znver2" #ARM elif cpu == "cortexa15": # https://community.arm.com/groups/tools/blog/2013/04/15/arm-cortex-a-processors-and-gcc-command-lines cxxflags += " -ffast-math -funsafe-math-optimizations -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard -mthumb" elif cpu == "cortexa53": cxxflags += " -ffast-math -funsafe-math-optimizations -mcpu=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -mthumb" elif cpu == "armv8": cxxflags += " -ffast-math -funsafe-math-optimizations -march=armv8-a -mcpu=cortex-a57" #POWER elif cpu == "power7": cxxflags += " -mcpu=a2 -fpermissive" else: cxxflags += " -march=native" print ("Warning: Detected cpu type not supported by configure_gcc.py, using -march=native instead.") return cxxflags, cmake_flags
def detect_cpu(): cputype = "unknown" # detect arm architecture if "arm" in platform.machine() or "aarch64" in platform.machine(): if platform.system() == "Linux": d = {} f = open("/proc/cpuinfo") input = f.read() lines = input.split("\n") for line in lines: values = line.split("\t: ") if len(values) == 2: d[values[0].strip()] = values[1].strip() else: values = line.split(":") if len(values) == 2: d[values[0].strip()] = values[1].strip() cpu_architecture = d["CPU architecture"] cpu_implementer = d["CPU implementer"] cpu_part = d["CPU part"] # ARM if cpu_implementer == "0x41": if cpu_part == "0xc07": cputype = "cortexa7" elif cpu_part == "0xc0f": cputype = "cortexa15" elif cpu_part == "0xd03": cputype = "cortexa53" if cpu_implementer == "0x4e": if cpu_part == "0x004": cputype = "armv8" else: print("detect_cpu: operating system not supported") return cputype return cputype # detect power architecture if "ppc64" in platform.machine(): if platform.system() == "Linux": d = {} f = open("/proc/cpuinfo") input = f.read() lines = input.split("\n") for line in lines: values = line.split("\t: ") if len(values) == 2: d[values[0].strip()] = values[1].strip() else: values = line.split(":") if len(values) == 2: d[values[0].strip()] = values[1].strip() cpu_name = d["cpu"] # PowerPC if "POWER7" in cpu_name: cputype = "power7" else: print("detect_cpu: operating system not supported") return cputype return cputype #no special arch detected, assume x86 from now # read int cpu information if platform.system() == "Linux": d = {} f = open("/proc/cpuinfo") input = f.read() lines = input.split("\n") for line in lines: items = line.split() if items[0] == "vendor_id": vendor_id = items[2] if items[0] == "cpu" and items[1] == "family": cpu_family = int(items[3]) if items[0] == "model" and items[1] != "name": model = int(items[2]) if items[0] == "stepping": stepping = int(items[2]) #assume that all three fields have been found in this order and abort, cause we now all we need break elif platform.system() == "Darwin": # vendor_id vendor_id = get_output("sysctl -A machdep.cpu.vendor") vendor_id = vendor_id[0] vendor_id = vendor_id.split(":") vendor_id = vendor_id[1].strip() # cpu_family cpu_family = get_output("sysctl -A machdep.cpu.family") cpu_family = cpu_family[0] cpu_family = cpu_family.split(":") cpu_family = int(cpu_family[1].strip()) # model model = get_output("sysctl -A machdep.cpu.model") model = model[0] model = model.split(":") model = int(model[1].strip()) elif platform.system() == "Windows": line = platform.processor() values = line.split(" ") vendor_id = values[7] cpu_family = int(values[2]) model = int(values[4]) elif platform.system() == "FreeBSD": if not is_found("cpuid"): print( "detect_cpu: you need to install the package 'cpuid' to enable feat for cpu detection." ) return cputype lines = get_output("cpuid") cpu_family = "" model = "" for line in lines: if "Vendor ID:" in line: vendor_id = line.split('"')[1] if "Family" in line and cpu_family == "": cpu_family = int(line.split(" ")[1]) if "Model" in line and model == "": model = int(line.split(" ")[1]) else: print("detect_cpu: operating system not supported") return cputype #map cpu information to cpu string # INTEL if vendor_id == "GenuineIntel": if cpu_family == 4: cputype = "i486" elif cpu_family == 5: cputype = "pentium" elif cpu_family == 6: if model < 2: cputype = "pentiumpro" elif model < 7: cputype = "pentium2" elif model < 9: cputype = "pentium3" elif model == 9: cputype = "pentiumm" elif model < 12: cputype = "pentium3" elif model == 13: cputype = "pentiumm" elif model == 14: cputype = "coresolo" elif model == 15: cputype = "coreduo" elif model == 23: cputype = "penryn" elif model == 26: cputype = "nehalem" elif model == 37: cputype = "westmere" elif model == 42: cputype = "sandybridge" elif model == 44: cputype = "westmere" elif model == 45: cputype = "sandybridge" elif model == 58: cputype = "ivybridge" elif model == 60: cputype = "haswell" elif model == 62: cputype = "ivybridge" elif model == 63: cputype = "haswell" elif model == 69: cputype = "haswell" elif model == 79: cputype = "broadwell" elif model == 85 and stepping < 5: cputype = "skylake-sp" elif model == 85 and stepping >= 5: cputype = "cascadelake" elif model == 87: cputype = "knightslanding" elif model == 94: cputype = "skylake" elif model == 158: cputype = "coffee-lake" elif model == 142: cputype = "kaby-lake" elif cpu_family == 7: cputype = "itanium" elif cpu_family == 15: if model == 2: cputype = "pentium4m" elif model < 3: cputype = "pentium4" elif model < 5: cputype = "nocona" elif cpu_family == 32: cputype = "itanium2" #AMD if vendor_id == "AuthenticAMD": if cpu_family == 4: cputype = "amd486" elif cpu_family == 5: if model < 6: cputype = "k5" else: cputype = "k6" elif cpu_family == 6: if model < 6: cputype = "athlon" else: cputype = "athlonxp" elif cpu_family == 15: if model in [5, 33, 37]: cputype = "opteron" elif model in [35, 43, 75, 107]: cputype = "athlon64x2" elif model in [65, 67]: cputype = "opteronx2" elif model in [72, 104]: cputype = "turionx2" else: cputype = "athlon64" elif cpu_family == 16: if model == 2: cputype = "barcelona" elif model == 4: cputype = "shanghai" elif model in [5, 6]: cputype = "athlonII" elif model == 8: cputype = "istanbul" elif model == 9: cputype = "magnycours" elif model == 10: cputype = "phenomII" elif cpu_family == 17: if model == 3: cputype = "athlon64x2" elif cpu_family == 23: if model == 1: cputype = "zen" elif model == 49: cputype = "zen2" # TODO insert sparc support here once it has been implemented properly if "unknown" in cputype: print("Warning: cputype unknown - vendor_id: " + vendor_id + ", cpu_family: " + str(cpu_family) + ", model: " + str(model)) return cputype