Skip to content

Commit d25aad9

Browse files
committed
Compiling via mcc command, updates in readme
1 parent fda79d9 commit d25aad9

1 file changed

Lines changed: 36 additions & 19 deletions

File tree

kilosort3-compiled/README.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
This documentation is intended to show how to create a Docker image with Matlab compiled implementation of Kilosort3 sorter. The main goal of this project is to avoid the requirement of Matlab Licenses and also abstract the installation and setup steps to run kilosort
44

5-
There are three main steps for generating a functional kilosort3-compiled docker image:
5+
There are four main steps to generate a functional kilosort3-compiled docker image:
66

7-
1. Compile kilosort3 as Standalone Application
8-
2. Create a (base) docker image with Matlab Runtime and the compiled application from step 1
9-
3. Extend the docker image from step 2 for improvements and fixes
7+
1. Kilosort Setup
8+
2. Compile Kilosort3 as Standalone Application
9+
3. Create a (base) docker image with Matlab Runtime and the compiled application from step 2
10+
4. Extend the docker image from step 3 for improvements and fixes
1011

1112
## Requirements
1213
- Packaging a MATLAB Docker image is supported on Linux only
1314
- Docker
1415
- Matlab
1516
- NVIDIA GPU and CUDA capabilities
16-
- [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit): required to run a docker with GPU capabilities
1717

1818
### Matlab Requirements
1919
- MATLAB Compiler
@@ -23,7 +23,7 @@ There are three main steps for generating a functional kilosort3-compiled docker
2323

2424
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.
2525

26-
## Compiling Kilosort as Matlab's Standalone Application
26+
## Kilosort Setup
2727
- Git clone or Download kilosort [source code](https://github.com/MouseLand/Kilosort)
2828
- Open Matlab
2929
- Compile Kilosort mexfiles:
@@ -32,27 +32,42 @@ Licenses for Matlab and toolboxes are needed only for compiling ironclust as Sta
3232
```
3333
>> mexGPUall
3434
```
35+
36+
## Compiling Kilosort as Matlab's Standalone Application
3537
- Set Matlab's workspace folder to `/path/to/spikeinterface-dockerfiles/kilosort3-compiled/matlab_files`
36-
- Open Matlab's `Application Compiler` (located in `APPS` Tab)
37-
- Click on `+` sign in Add Main File, Select `ks3_compiled.m` and Click `Open`
38-
- In the section `Files required for your application to run`:
39-
- Click on `+` sign button, Select `utils` folder and click `Open`
40-
- Click on `+` sign button again, Select the folder of the cloned `Kilosort` project and click `Open`
41-
- On Application Compiler window, Click on `Package`, Save the `ks3_compiled.prj` file and wait for Matlab to Compile the project. A folder (named `ks3_compiled` by default) with compiled files will be generated.
42-
- Close `Package` and `Application Compiler` windows
38+
- Run `mcc` command with `utils` folder and kilosort path:
39+
```
40+
>> mcc -m ks3_compiled.m -a utils -a <git-cloned-path>/Kilosort
41+
```
4342
4443
## Generating Base Docker Image
45-
- In Matlab console run:
44+
- To generate the base docker image (called `ks3-matlab-base`) with compiled application, run the following command in Matlab console:
4645
```
47-
>> compiler.package.docker('ks3_compiled/for_testing/ks3_compiled', 'ks3_compiled/for_testing/requiredMCRProducts.txt', 'ImageName', 'ks3-matlab-base')
46+
>> compiler.package.docker('ks3_compiled', 'requiredMCRProducts.txt', 'ImageName', 'ks3-matlab-base')
4847
```
4948
50-
This command will create an image called `ks3-matlab-base` to be used in the next step
51-
52-
## Extending Base Image/Creating final image
49+
- [Optional] Files generated by Matlab Compiler can be deleted:
50+
- In your terminal, go to the folder for this project:
51+
```
52+
$ cd /path/to/spikeinterface-dockerfiles/kilosort3-compiled
53+
```
54+
- Run `rm` command:
55+
```
56+
$ rm -r \
57+
matlab_files/includedSupportPackages.txt \
58+
matlab_files/ks3-matlab-basedocker/ \
59+
matlab_files/ks3_compiled \
60+
matlab_files/mccExcludedFiles.log \
61+
matlab_files/readme.txt \
62+
matlab_files/requiredMCRProducts.txt \
63+
matlab_files/run_ks3_compiled.sh \
64+
matlab_files/unresolvedSymbols.txt \
65+
```
66+
67+
## Extending Base Image and creating final image
5368
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run kilosort3:
5469
55-
- In your terminal, go to the current folder:
70+
- In your terminal, go to the folder for this project:
5671
```
5772
$ cd /path/to/spikeinterface-dockerfiles/kilosort3-compiled
5873
```
@@ -65,6 +80,8 @@ $ source build.sh
6580
6681
## Running a container
6782
83+
- [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
84+
6885
The base syntax to run dockerized kilosort is:
6986
7087
```

0 commit comments

Comments
 (0)