Skip to content

Commit

Permalink
(conan-io#12705) OpenBlas: Add arch target option
Browse files Browse the repository at this point in the history
  • Loading branch information
aborzunov committed Oct 14, 2022
1 parent 399efd2 commit b34dc8b
Showing 1 changed file with 145 additions and 0 deletions.
145 changes: 145 additions & 0 deletions recipes/openblas/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,141 @@

required_conan_version = ">=1.43.0"

# Copypasting here content of OpenBlas/TargetList.txt
# https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
# https://github.com/xianyi/OpenBLAS#normal-compile
openblas_target_list = [
"native", # We rely on architecture detection in OpenBlas cmake scripts

# 1.X86/X86_64
# a)Intel CPU:
"P2",
"KATMAI",
"COPPERMINE",
"NORTHWOOD",
"PRESCOTT",
"BANIAS",
"YONAH",
"CORE2",
"PENRYN",
"DUNNINGTON",
"NEHALEM",
"SANDYBRIDGE",
"HASWELL",
"SKYLAKEX",
"ATOM",
"COOPERLAKE",
"SAPPHIRERAPIDS",

# b)AMD CPU:
"ATHLON",
"OPTERON",
"OPTERON_SSE3",
"BARCELONA",
"SHANGHAI",
"ISTANBUL",
"BOBCAT",
"BULLDOZER",
"PILEDRIVER",
"STEAMROLLER",
"EXCAVATOR",
"ZEN",

# c)VIA CPU:
"SSE_GENERIC",
"VIAC3",
"NANO",

# 2.Power CPU:
"POWER4",
"POWER5",
"POWER6",
"POWER7",
"POWER8",
"POWER9",
"POWER10",
"PPCG4",
"PPC970",
"PPC970MP",
"PPC440",
"PPC440FP2",
"CELL",

# 3.MIPS CPU:
"P5600",
"MIPS1004K",
"MIPS24K",

# 4.MIPS64 CPU:
"MIPS64_GENERIC",
"SICORTEX",
"LOONGSON3A",
"LOONGSON3B",
"I6400",
"P6600",
"I6500",

# 5.IA64 CPU:
"ITANIUM2",

# 6.SPARC CPU:
"SPARC",
"SPARCV7",

# 7.ARM CPU:
"CORTEXA15",
"CORTEXA9",
"ARMV7",
"ARMV6",
"ARMV5",

# 8.ARM 64-bit CPU:
"ARMV8",
"CORTEXA53",
"CORTEXA57",
"CORTEXA72",
"CORTEXA73",
"CORTEXA510",
"CORTEXA710",
"CORTEXX1",
"CORTEXX2",
"NEOVERSEN1",
"NEOVERSEV1",
"NEOVERSEN2",
"CORTEXA55",
"EMAG8180",
"FALKOR",
"THUNDERX",
"THUNDERX2T99",
"TSV110",
"THUNDERX3T110",
"VORTEX",
"A64FX",
"ARMV8SVE",
"FT2000",

# 9.System Z:
"ZARCH_GENERIC",
"Z13",
"Z14",

# 10.RISC-V 64:
"RISCV64_GENERIC",
"C910V",

# 11.LOONGARCH64:
"LOONGSONGENERIC",
"LOONGSON3R5",
"LOONGSON2K1000",

# 12. Elbrus E2000:
"E2K",

# 13. Alpha
"EV4",
"EV5",
"EV6",
]

class OpenblasConan(ConanFile):
name = "openblas"
Expand All @@ -20,13 +155,15 @@ class OpenblasConan(ConanFile):
"build_lapack": [True, False],
"use_thread": [True, False],
"dynamic_arch": [True, False],
"target": openblas_target_list,
}
default_options = {
"shared": False,
"fPIC": True,
"build_lapack": False,
"use_thread": True,
"dynamic_arch": False,
"target": "native",
}
generators = "cmake"
short_paths = True
Expand Down Expand Up @@ -72,6 +209,14 @@ def _configure_cmake(self):
cmake.definitions["DYNAMIC_ARCH"] = self.options.dynamic_arch
cmake.definitions["USE_THREAD"] = self.options.use_thread

if self.options.target != "native":
cmake.definitions["TARGET"] = self.options.target
self.output.info(
f"Setting target arch to {self.options.target} and "
"passing this as value to TARGET variable of openblas cmake. "
"For more information, check out "
"https://github.com/xianyi/OpenBLAS#normal-compile")

# Required for safe concurrent calls to OpenBLAS routines
cmake.definitions["USE_LOCKING"] = not self.options.use_thread

Expand Down

0 comments on commit b34dc8b

Please sign in to comment.