Git Product home page Git Product logo

Comments (4)

Nekto89 avatar Nekto89 commented on June 5, 2024

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
conan-io/conan#4928
conan-io/conan#6530
conan-io/conan#10935

from conan-center-index.

valgur avatar valgur commented on June 5, 2024

@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.

from conan-center-index.

Nekto89 avatar Nekto89 commented on June 5, 2024

@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")

from conan-center-index.

Croydon avatar Croydon commented on June 5, 2024

FYI, upstream just dropped Conan

oneapi-src/oneMKL#267
oneapi-src/oneMKL@8c907b4

But was broken for 3 years anyway: oneapi-src/oneMKL#117

from conan-center-index.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.