Open peastman opened 1 year ago
I want to add that I think it would be very nice if we could have a mac build of the nnops so testing could be done locally instead of spawn a Linux EC2 instance.
There is this variable from cpp_extension that we could use:
import torch
from torch.utils.cpp_extension import LIB_EXT
import os
lib_path = os.path.join(os.path.dirname(__file__), 'libNNPOpsPyTorch' + LIB_EXT)
torch.ops.load_library(lib_path)
You also need to vary whether the name starts with "lib". It does on Linux and Mac, but not on Windows.
Linux: libNNPOpsPyTorch.so Mac: libNNPOpsPyTorch.dylib Windows: NNPOpsPyTorch.dll
I'm trying to build NNPOps on a Mac. It builds correctly, but when I try to
import NNPOps
it fails with this error:The problem comes from this line:
https://github.com/openmm/NNPOps/blob/054d487d9fec8f98a111bc30ec6d3ec1ce423356/src/pytorch/__init__.py#L7
On Macs, shared libraries have the extension
.dylib
rather than.so
. It also won't work on Windows where they have the extension.dll
.