Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions INSTALLATIONGUIDEMACOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Installation Guide on MacOS

## Download the source code

- Clone the GitHub repository
```
git clone https://github.com/patrick-kidger/signatory.git
```
- The recommended location is obtained by activating your environment and executing
```
python -m site --user-site
```
It is possible, that it must be created first.

## Ensure corresponding `PyTorch` version

- Make sure you have the corresponding `pytorch` version installed. You can look up matching pairs [here](https://signatory.readthedocs.io/en/latest/pages/usage/installation.html#older-versions).

## Prepare clang for installation

- The `setup.py` uses the option `-fopenmp` which is not supported on MAC by default.
- To fix this, install `lvmm` and `libomp` from brew. For this
- Make sure `Homebrew` is installed
- Run
```
brew install lvmm
```
- and
```
brew install libomp
```
- Go to the location of the cloned repository and modify `setup.py`: Change line `36` to
```
extra_compile_args.append('-Xpreprocessor -fopenmp -lomp')
```
- Modify
```
{path-to-repository}/signatory/src/pytorchbind.cpp
```
by removing lines `38-40`, i.e.
```
// #ifndef _OPENMP
// #error OpenMP required
// #endif
```

## Run the installation command
- Run
```
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
```



4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@

if sys.platform.startswith('win'): # windows
extra_compile_args.append('/openmp')
else: # linux or mac
if sys.platform.startswith('Dar'): # MacOS
extra_compile_args.append('-Xpreprocessor -fopenmp -lomp')
else: # linux
extra_compile_args.append('-fopenmp')

ext_modules = [cpp.CppExtension(name='_impl',
Expand Down
6 changes: 1 addition & 5 deletions src/pytorchbind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
#include "tensor_algebra_ops.hpp" // signatory::signature_combine_forward,
// signatory::signature_combine_backward

#ifndef _OPENMP
#error OpenMP required
#endif

PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("signature_to_logsignature_forward",
&signatory::signature_to_logsignature_forward);
Expand Down Expand Up @@ -71,4 +67,4 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
&signatory::signature_combine_forward);
m.def("signature_combine_backward",
&signatory::signature_combine_backward);
}
}