Skip to content

Trouble loading TorchSharp Linux CUDA into F# Interactive #345

@dsyme

Description

@dsyme

@gbaydin spotted problems with dynamic loading TorchSharp for Linux + CUDA into F# Interactive. This will also hit .NET Notebooks

  1. If there is a #I include-path directive that includes LibTorchSharp and libtorch-cpu-* CPU binaries then they will be preferred and the CUDA load will fail

  2. The TorchSharp native component loader for F#/.NET Interactive has an explicit version number wired into it for matching libtorch packages to look for, this version number hasn't been updated and we should pick it up from the TorchProperties build instead of hard-wiring it into the source

    const string libtorchPackageVersion = "1.9.0.7";

  3. The diagnostic given when a libtorch CPU backend is loaded during CUDA initialization could be much more detailed. Currently it fails with "System.InvalidOperationException: Torch device type CUDA did not initialise on the current machine.". Instead it could add that a CPU libtorch was loaded, give the location of the native DLLs loaded etc.

We think these together will solve the problem

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions