Open valgur opened 6 months ago
I'm currently trying to repack libraries from oneMKL installers that are provided by Intel on Windows/Linux. oneMKL seems to be using circular dependencies and conan doesn't support it https://github.com/conan-io/conan/issues/4928 https://github.com/conan-io/conan/issues/6530 https://github.com/conan-io/conan/issues/10935
@Nekto89 Thanks for looking into it! That circular dependencies issue might be a pretty hard blocker for now. :neutral_face:
I started experimenting with a oneMKL recipe (the non-interfaces one) as well, here: https://github.com/valgur/conan-center-index/blob/new/onemkl/recipes/onemkl/all/conanfile.py
Sounds like you have something much more complete in the works. I would gladly collaborate on it, if you can share your current state.
@Nekto89 Thanks for looking into it! That circular dependencies issue might be a pretty hard blocker for now. 😐
I started experimenting with a oneMKL recipe (the non-interfaces one) as well, here: https://github.com/valgur/conan-center-index/blob/new/onemkl/recipes/onemkl/all/conanfile.py
Sounds like you have something much more complete in the works. I would gladly collaborate on it, if you can share your current state.
My version is worse than yours. I need small subset of functionality so my recipe solves only my problem. I didn't find fast way to unpack files from installers so I installed them on my machine before running conan.
conan export-pkg -nr -of "C:\Program Files (x86)\Intel\oneAPI\mkl\2024.1" -pr:b ... -pr:h ... --name onemkl --version 2021.4.0 -s os=Windows -s build_type=Release C:/.../recipes/onemkl/all/conanfile.py
conan export-pkg -nr -of "~/intel/oneapi/mkl/2024.1" -pr:b ... -pr:h ... --name onemkl --version 2021.4.0 "$recipe_dir/conanfile.py"
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import copy
import os
required_conan_version = ">=2.0.17"
class onemklConan(ConanFile):
name = "onemkl"
description = "The fastest and most-used math library for Intel®-based systems."
homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html"
license = "Intel Simplified Software License"
topics = ("intel")
package_type = "static-library"
settings = "os", "arch", "compiler", "build_type"
build_policy = "never"
def layout(self):
pass
def requirements(self):
self.requires("onetbb/2021.9.0")
def package_id(self):
if self.info.settings.os == "Windows":
self.info.settings.build_type = "Debug" if self.info.settings.build_type == "Debug" else "Release"
else:
del self.info.settings.build_type
self.info.requires.unrelated_mode()
del self.info.settings.compiler
def validate(self):
if self.settings.arch != "x86_64":
raise ConanInvalidConfiguration(f"{self.ref} supports only x86_64")
if not self.settings.os in ["Windows", "Linux"]:
raise ConanInvalidConfiguration(f"{self.ref} supports only Windows and Linux")
def source(self):
pass
def generate(self):
VirtualBuildEnv(self)
VirtualRunEnv(self)
def build(self):
pass
def package(self):
lib_suffix = "lib" if self.settings.os == "Windows" else "a"
lib_prefix = "" if self.settings.os == "Windows" else "lib"
debug_suffix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else ""
source_lib_folder = os.path.join(self.build_folder, "lib")
target_lib_folder = os.path.join(self.package_folder, "lib")
copy(self, f"{lib_prefix}mkl_intel_ilp64.{lib_suffix}", source_lib_folder, target_lib_folder)
copy(self, f"{lib_prefix}mkl_core.{lib_suffix}", source_lib_folder, target_lib_folder)
copy(self, f"{lib_prefix}mkl_tbb_thread{debug_suffix}.{lib_suffix}", source_lib_folder, target_lib_folder)
source_include_folder = os.path.join(self.build_folder, "include")
target_include_folder = os.path.join(self.package_folder, "include")
copy(self, "*", source_include_folder, target_include_folder)
source_license_folder = os.path.join(self.build_folder, "share", "doc", "mkl", "licensing")
target_license_folder = os.path.join(self.package_folder, "licenses")
copy(self, "*", source_license_folder, target_license_folder)
#ugly workaround. conan doesn't support circular dependencies
if self.settings.os == "Linux":
os.symlink("libmkl_core.a", os.path.join(self.package_folder, "lib", "libmkl_core2.a"))
os.symlink("libmkl_core.a", os.path.join(self.package_folder, "lib", "libmkl_core3.a"))
os.symlink("libmkl_tbb_thread.a", os.path.join(self.package_folder, "lib", "libmkl_tbb_thread2.a"))
def package_info(self):
debug_suffix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else ""
self.cpp_info.libs = ["mkl_intel_ilp64", "mkl_core", f"mkl_tbb_thread{debug_suffix}"]
if self.settings.os == "Linux":
#ugly workaround. conan doesn't support circular dependencies
self.cpp_info.libs.extend(["mkl_core2", "mkl_tbb_thread2", "mkl_core3"])
self.cpp_info.set_property("cmake_file_name", "MKL")
self.cpp_info.set_property("cmake_target_name", "MKL::MKL")
self.cpp_info.defines.append("MKL_ILP64")
FYI, upstream just dropped Conan
https://github.com/oneapi-src/oneMKL/discussions/267 https://github.com/oneapi-src/oneMKL/commit/8c907b4f8c3906dbb1346b24a408d0d8b0df9e32
But was broken for 3 years anyway: https://github.com/oneapi-src/oneMKL/pull/117
Package Name/Version
oneMKL
Webpage
https://spec.oneapi.io/versions/latest/elements/oneMKL/source/index.html
Source code
https://github.com/oneapi-src/oneMKL
Description of the library/tool
oneMKL would provide an alternative to BLAS and LAPACK currently provided by OpenBLAS, but optimized heavily for Intel CPU-s.