Coder Social home page Coder Social logo

Compiling on windows about hasktorch HOT 2 OPEN

davidbelius avatar davidbelius commented on July 17, 2024
Compiling on windows

from hasktorch.

Comments (2)

davidbelius avatar davidbelius commented on July 17, 2024

Recording my findings here for the benefit of others with the same question:

  • After removing the unix dependency from examples/examples.cabal, "cabal build hasktorch" runs for a pretty long time, but eventually fails with ld complaining about among others -ltorch.
  • One may hope that pointing cabal to libtorch windows binaries using --extra-lib-dirs will fix this, but it did not, as far as I understand because:
  • libtorch binaries are compiled using MSVC and are not "ABI-compatible", which means GHC's c compiler mingw can not link to them (see the "tip" on https://pytorch.org/cppdocs/installing.html).
  • One may hope to compile libtorch from source on windows using mingw, but libtorch does not provide makefiles for mingw. I did not attempt to figure it out myself after reading https://discuss.pytorch.org/t/can-i-build-libtorch-from-source-with-mingw/52632.

So getting hasktorch to compile on windows unfortunately seems like a major undertaking, even with just cpu and without cuda support.

from hasktorch.

junjihashimoto avatar junjihashimoto commented on July 17, 2024

Hi @davidbelius,
I think that when we use MSVC's libtorch, we need to use ghc of MSVC(https://www.reddit.com/r/haskell/comments/n0xcoy/announce_experimental_windows_ghc_8105_binary/), and some patches for some packages.
This repository(https://github.com/awson/ghc-nw) provides the paches.
However, both of them are not maintained.
I recommend to use WSL on windows, although the performance will be worse than native linux. GPU also works.

from hasktorch.

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.