Skip to content

R session aborted when using R torch + MKL libraries #1467

Description

@tmaryhuard

Environment

  • R version 4.5.3
  • torch version: 0.16.3
    • OS: Windows 11 x64
  • BLAS used: Intel MKL replacing default Rblas.dll/Rlapack.dll

Description

Replacing R's default Rblas.dll and Rlapack.dll with an optimized BLAS (Intel MKL) causes R session to abort when performing
basic torch operations. I run a R torch code twice, once with the by-default libraries and once with the MKL surrogates. Whenever I use the surrogates I get R session abortions when using simple operations like torch_exp on a scalar torch_tensor (a real scalar, not a NA or character or whatever). I cannot reproduce the error easily as when I just open an R session and run
library(torch)
x <- torch_tensor(1.0)
torch_exp(x)
it does work...

Notes

I'm not skilled at all in torch/blas implementation so I cannot explain what happens. I (very naively) asked to an AI, answer: "The likely cause is BLAS
symbol interposition: libtorch embeds its own BLAS internally but exports those symbols with default visibility, allowing the system
BLAS loaded by R to override them at runtime."

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions