Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libtorch #169

Closed
wants to merge 5 commits into from
Closed

Add libtorch #169

wants to merge 5 commits into from

Conversation

PinkySan
Copy link

@PinkySan PinkySan commented Oct 2, 2019

Specify library name and version: lib/1.0

  • I've read the guidelines for contributing.

  • I've followed the PEP8 style guides for Python code in the recipes.

  • I've used the latest Conan client version.

  • I've tried at least one configuration locally with the
    conan-center hook activated.

  • What should be inside the test_package folder?

  • conandata.yml? I am creating the url within the recipe

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2019

CLA assistant check
All committers have signed the CLA.

@conan-center-bot
Copy link
Collaborator

Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue.

@conan-center-bot
Copy link
Collaborator

Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue.

@conan-center-bot
Copy link
Collaborator

Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue.

@PinkySan PinkySan changed the title First version of libtorch recipe Add libtorch Oct 5, 2019
@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' have failed:

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'homepage' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
      • [HOOK - conan-center.py] pre_export(): ERROR: [CONAN CENTER INDEX URL (KB-H027)] The attribute 'url' should point to: https://github.com/conan-io/conan-center-index (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H027)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@uilianries
Copy link
Member

I've checked this recipe and it's complex ... To build it from source, it requires other libraries. I've tried to create a generic version for any version here: uilianries@3b007a8

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' have failed:

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'homepage' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
      • [HOOK - conan-center.py] pre_export(): ERROR: [CONAN CENTER INDEX URL (KB-H027)] The attribute 'url' should point to: https://github.com/conan-io/conan-center-index (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H027)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@SSE4
Copy link
Contributor

SSE4 commented Nov 20, 2019

@uilianries may you create a PR to author's repo with your changes? (+ hook fixes)

@uilianries
Copy link
Member

@SSE4 Niet, but I should.

merge conan-io into my fork
@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' have failed:

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'homepage' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
      • [HOOK - conan-center.py] pre_export(): ERROR: [CONAN CENTER INDEX URL (KB-H027)] The attribute 'url' should point to: https://github.com/conan-io/conan-center-index (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H027)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' have failed:

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'url' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@PinkySan
Copy link
Author

PinkySan commented Dec 6, 2019

There is a way of installing pytorch from sources
https://github.com/pytorch/pytorch#from-source

  • How to install dependent python packages within conanfile.py?
  • Does this include the libtorch packages?

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' have failed:

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'url' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@danimtb
Copy link
Member

danimtb commented Dec 20, 2019

@PinkySan there is no way to install additional dependencies from python. All the resources should be in the recipe.

There are some things missing in this PR, like the test_package recipe and the missing attributes

@PinkySan
Copy link
Author

@PinkySan there is no way to install additional dependencies from python. All the resources should be in the recipe.

There are some things missing in this PR, like the test_package recipe and the missing attributes

Unfortunatly, that is true.
I do not really understand, why they are trying to build the package by their own. Providing the binaries should be enough. (I am having the same difficulties with OpenCV)

@forwardmeasure
Copy link

@PinkySan, for what it's worth, I have put together a Conan recipe to build Libtorch from scratch. It works, but not consistently, often failing on this error:

( "You found a build system error: AVX512F, AVX512DQ, AVX512VL " "is defined (via e.g. -mavx512f, -mavx512dq, and -mavx512vl) " "but CAFFE2_PERF_WITH_AVX512 is not defined.")

You can find the recipe here: https://github.com/forwardmeasure/conan/tree/master/recipes/conan-libtorch

Regards,
Prashanth

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' failed in build 9 (62b282312b6334c4a4799841ea9da8583cb26a90):

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'url' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@bmanga
Copy link
Contributor

bmanga commented Jan 24, 2020

For what it's worth, I also have a WIP implementation of a libtorch recipe that reuses some packages: https://github.com/bmanga/conan-libtorch

@forwardmeasure
Copy link

For what it's worth, I also have a WIP implementation of a libtorch recipe that reuses some packages: https://github.com/bmanga/conan-libtorch

Thanks, Bruno. I got mine working soon after posting. Cheers!

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libtorch/1.2.0' failed in build 10 (62b282312b6334c4a4799841ea9da8583cb26a90):

  • Linux x86_64, Release, gcc 5, libstdc++
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [RECIPE METADATA (KB-H003)] Conanfile doesn't have 'url' attribute. (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H003)
      • [HOOK - conan-center.py] pre_export(): ERROR: [TEST PACKAGE FOLDER (KB-H024)] There is no 'test_package' for this recipe (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H024)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@danimtb
Copy link
Member

danimtb commented Mar 16, 2020

@PinkySan please address the issues reported above by the bot, otherwise the PR will be closed. Thanks!

@PinkySan
Copy link
Author

I guess this solution works better. Please close this PR

For what it's worth, I also have a WIP implementation of a libtorch recipe that reuses some packages: https://github.com/bmanga/conan-libtorch

@PinkySan PinkySan closed this Mar 16, 2020
@bmanga
Copy link
Contributor

bmanga commented Mar 16, 2020

For what it's worth, I'm planning to cleanup my version and propose a barebone version for inclusion soon-ish. I think it would be good to converge and work on a single attempt (there seem to be at least 4 versions based on this PR alone)

artem-kamyshev pushed a commit to artem-kamyshev/conan-center-index that referenced this pull request Sep 28, 2020
remove gcc4.8, gcc9, windows-debug jobs
@blackliner
Copy link
Contributor

@bmanga any updates on this? I did not find another open PR for libtorch, and as we migrate to conan, we might need it soon. Willing to help out 👍

Comment on lines +9 to +15
settings = {"os": ["Windows","Linux"],
"build_type": ["Debug", "Release", "RelWithDebInfo"],
"compiler": {"gcc": {"version": None,
"libcxx": ["libstdc++", "libstdc++11"]},
"Visual Studio": {"version": None},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url_base = "https://download.pytorch.org/libtorch/"


def getGPU(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def getGPU(self):
def _getGPU(self):

Comment on lines +32 to +40
def getOS(self):
if(self.settings.os == "Windows"):
if(self.settings.build_type == "Debug"):
return "libtorch-win-shared-with-deps-debug-"
return "libtorch-win-shared-with-deps-"
if(self.settings.os == "Linux"):
if(self.settings.compiler.libcxx == "libstdc++11"):
return "libtorch-cxx11-abi-shared-with-deps-"
return "libtorch-shared-with-deps-"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def getOS(self):
if(self.settings.os == "Windows"):
if(self.settings.build_type == "Debug"):
return "libtorch-win-shared-with-deps-debug-"
return "libtorch-win-shared-with-deps-"
if(self.settings.os == "Linux"):
if(self.settings.compiler.libcxx == "libstdc++11"):
return "libtorch-cxx11-abi-shared-with-deps-"
return "libtorch-shared-with-deps-"
def _getOS(self):
if self.settings.os == "Windows":
if self.settings.build_type == "Debug":
return "libtorch-win-shared-with-deps-debug-"
return "libtorch-win-shared-with-deps-"
if self.settings.os == "Linux":
if self.settings.compiler.libcxx == "libstdc++11":
return "libtorch-cxx11-abi-shared-with-deps-"
return "libtorch-shared-with-deps-"

return "libtorch-shared-with-deps-"

def source(self):
url = self.url_base + self.getGPU() + self.getOS() + self.version + ".zip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url = self.url_base + self.getGPU() + self.getOS() + self.version + ".zip"
url = self.url_base + self._getGPU() + self._getOS() + self.version + ".zip"

@SpaceIm
Copy link
Contributor

SpaceIm commented Jan 30, 2021

I'm working on a pytorch recipe, but if someone has a good recipe almost ready for a PR, I'll be happy to help.

@blackliner
Copy link
Contributor

I am living with distributing binaries for now :-/

from conans import ConanFile, tools


class LibtorchConan(ConanFile):
    name = "libtorch"
    settings = "os", "arch"
    url = "https://github.com/pytorch/pytorch"
    description = "An open source machine learning framework that accelerates the path from research prototyping to production deployment."
    license = "All rights reserved."
    topics = ("computer-vision", "meta-data")

    def build(self):
        tools.get(**self.conan_data["binaries"][self.version][str(self.settings.arch)])

    def package(self):
        self.copy("*", src=self.name)

    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)

conandata.yml:

binaries:
  1.4.0:
    x86_64:
      url: https://download.pytorch.org/libtorch/cu101/libtorch-cxx11-abi-shared-with-deps-1.4.0.zip
      sha256: f214bfde532877aa5d4e0803e51a28fa8edd97b6a44b6615f75a70352b6b542e

@PinkySan
Copy link
Author

@blackliner That is the same idea, i had at the beginning of this PR. I guess that is the best solution

@blackliner
Copy link
Contributor

blackliner commented Feb 17, 2021

Yes, I guess some things are not meant to be built from scratch :D

I forgot to mention, to use my previous recipe, you need to use the cmake_paths generator in your root recipe and include the created file:

if(EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake")
  include("${CMAKE_BINARY_DIR}/conan_paths.cmake")
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet