Skip to content

Commit

Permalink
Merge pull request #40 from hgb-bin-proteomics/macos
Browse files Browse the repository at this point in the history
add support for macos
  • Loading branch information
michabirklbauer authored Apr 15, 2024
2 parents 0e79e57 + 7da02b6 commit aa41476
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build for macOS

on:
workflow_dispatch:

jobs:
Build-for-macOS:
runs-on: macos-14
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Copy and unzip eigen
run: |
cp eigen-3.4.0.zip VectorSearch
cd VectorSearch
unzip eigen-3.4.0.zip
- name: Build VectorSearch.dll dynamic library
run: |
cd VectorSearch
g++-13 -Wl,-ld_classic -shared -I eigen-3.4.0 -fPIC -fopenmp -O3 -o VectorSearch.dll dllmainUnix.cpp
cp VectorSearch.dll ..
- name: Install NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6'
- name: Build DataLoader
run: |
cd DataLoader
dotnet publish DataLoader.csproj --runtime osx-arm64 --self-contained --configuration Release
- name: Copy VectorSearch.dll to Release
run: |
cp VectorSearch.dll DataLoader/bin/Release/net6.0/osx-arm64
- name: Zip Release
run: |
cd DataLoader/bin/
zip -r Release.zip Release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-macos-arm64-cpu-only
path: DataLoader/bin/Release.zip
36 changes: 36 additions & 0 deletions macos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Compilation on macOS (macOS 14 on M-Series Macs)

## Installing dependencies

The following dependencies are required for compilation:
- Xcode Command Line Tools: `xcode-select --install`
- [Homebrew](https://brew.sh/): `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
- gcc / g++: `brew install gcc`
- .NET 6.0: [Install .NET on macOS](https://learn.microsoft.com/en-us/dotnet/core/install/macos)

## Building the matrix multiplication backend (C++)

To build the C++ library used for matrix multiplication the following steps are
required:
- Navigate to the `VectorSearch` directory: `cd VectorSearch`
- Build the DLL: `g++-13 -shared -I eigen-3.4.0 -fPIC -fopenmp -O3 -o VectorSearch.dll dllmainUnix.cpp`
- In case you get an error from the linker, you might want to try this instead: `g++-13 -Wl,-ld_classic -shared -I eigen-3.4.0 -fPIC -fopenmp -O3 -o VectorSearch.dll dllmainUnix.cpp`

## Building the prototype testing suite (C#)

To build the C# testing application the following steps need to be carried out:
- Navigate to the `DataLoader` directory: `cd DataLoader`
- Build the executable: `dotnet publish DataLoader.csproj --runtime osx-arm64 --self-contained --configuration Release`

## Running the executable

- Copy `VectorSearch.dll` to the build directory of `DataLoader`.
- Run the executable. For example with `./DataLoader EigenSIntB 10000`.
- Note that we only supply the compiled binaries for CPU-based search. GPU-based search is not available because Macs don't support Nvidia GPUs!

# Running the executable without building / compiling yourself

We provide compiled binaries in `DataLoaderExecutable/macos-arm` and in the
`Releases` tab. Please again note that we only supply the compiled binaries for
CPU-based search. Running the compiled binaries requires [.NET 6.0](https://learn.microsoft.com/en-us/dotnet/core/install/macos)
and [g++](#Installing-dependencies).

0 comments on commit aa41476

Please sign in to comment.