Skip to content

Commit 1fe8166

Browse files
authored
Merge pull request #15 from Tauffer-Consulting/main
Add matlab compiled ironclust
2 parents 27528e8 + 9fc1cb5 commit 1fe8166

4 files changed

Lines changed: 111 additions & 0 deletions

File tree

ironclust-compiled/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ironclust-matlab-base
2+
3+
RUN chmod 755 /usr/bin/mlrtapp/p_ironclust
4+
ENV PATH="/usr/bin/mlrtapp:${PATH}"
5+
6+
RUN apt-get update -y
7+
RUN apt-get install software-properties-common -y
8+
RUN add-apt-repository ppa:deadsnakes/ppa -y
9+
RUN apt-get install git python3.8 python3.8-dev -y
10+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
11+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
12+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
13+
RUN apt-get install python3-pip -y
14+
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
15+
RUN pip install -U pip
16+

ironclust-compiled/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Ironclust Docker Image
2+
3+
This documentation is intended to show how to create a Docker image with Matlab compiled implementation of Ironclust sorter. The main goal of this project is to avoid the requirement of Matlab Licenses in order to run ironclust.
4+
5+
There are three main steps for generating a functional ironclust docker image:
6+
1. Compile Ironclust as Matlab's Standalone Application
7+
2. Create a (base) docker image with Matlab Runtime and the compiled application from step 1
8+
3. Extend the docker image from step 2 for improvements and fixes
9+
10+
## Requirements
11+
- Packaging a MATLAB Docker image is supported on Linux only
12+
- Docker
13+
- Matlab
14+
15+
### Matlab Requirements
16+
- JSONLab toolbox
17+
- MATLAB Compiler
18+
- Statistics and Machine Learning Toolbox
19+
- Signal Processing Toolbox
20+
- Image Processing Toolbox
21+
22+
Licenses for Matlab and toolboxes are needed only for compiling ironclust as Standalone Application and to generate the base Docker image. After this process, no license will be required, either to extend the base image or to run the sorter.
23+
24+
## Compiling Ironclust as Matlab's Standalone Application
25+
- Git clone or Download ironclust [source code](https://github.com/flatironinstitute/ironclust.git)
26+
- Open Matlab
27+
- Set Matlab's workspace folder to: `<git-cloned-path>/ironclust/matlab`
28+
- In Matlab console run:
29+
```
30+
>> mcc -m p_ironclust.m -a <git-cloned-path>/ironclust/matlab/*.* -a <git-cloned-path>/ironclust/matlab/prb -a <git-cloned-path>/ironclust/matlab/prb_json
31+
```
32+
33+
## Generating Base Docker Image
34+
- To generate the base docker image (called `ironclust-matlab-base`) with the compiled application, run the following command in Matlab console:
35+
```
36+
>> compiler.package.docker('p_ironclust', 'requiredMCRProducts.txt', 'ImageName', 'ironclust-matlab-base')
37+
```
38+
39+
- [Optional] Files generated by Matlab Compiler can be deleted:
40+
- In your terminal, go to the folder for this project:
41+
```
42+
$ cd <git-cloned-path>/ironclust/
43+
```
44+
- Run `rm` command:
45+
```
46+
$ rm -r \
47+
matlab/includedSupportPackages.txt \
48+
matlab/ironclust-matlab-basedocker \
49+
matlab/mccExcludedFiles.log \
50+
matlab/p_ironclust \
51+
matlab/readme.txt \
52+
matlab/requiredMCRProducts.txt \
53+
matlab/run_p_ironclust.sh \
54+
matlab/unresolvedSymbols.txt
55+
```
56+
57+
58+
## Extending Base Image/Creating final image
59+
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run ironclust:
60+
61+
- In your terminal, go to the folder for this project:
62+
```
63+
$ cd /path/to/spikeinterface-dockerfiles/ironclust-compiled
64+
```
65+
66+
- Run build script:
67+
```
68+
$ source build.sh
69+
```
70+
71+
72+
## Running a container
73+
74+
- [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit) is required to run a docker with GPU capabilities
75+
76+
The base syntax to run dockerized ironclust is:
77+
78+
```
79+
docker run -v <host-data-folder>:<docker-data-folder> -it spikeinterface/ironclust p_ironclust [ARGS]
80+
```
81+
82+
Notice that a volume has to be binded to a folder were your data locally is stored
83+
84+
Sample run:
85+
```
86+
docker run -v /home/user/data:/opt/data -it spikeinterface/ironclust p_ironclust /opt/data/tmp /opt/data/raw.mda /opt/data/geom.csv '' '' /opt/data/tmp/firing.mda /opt/data/argfile.txt
87+
```

ironclust-compiled/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker build -t spikeinterface/ironclust-compiled-base:5.9.8 .
4+

ironclust-compiled/push.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker push spikeinterface/ironclust-compiled-base:5.9.8
4+

0 commit comments

Comments
 (0)