Skip to content

Commit 0420a3d

Browse files
committed
Updated docs for compiled kilosorts
1 parent b224593 commit 0420a3d

5 files changed

Lines changed: 251 additions & 69 deletions

File tree

kilosort_no_license/README.md

Lines changed: 19 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
# Kilosort3 Docker Image
1+
# Kilosort Compiled Docker Images
22

3-
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
4-
5-
There are four main steps to generate a functional kilosort3-compiled docker image:
6-
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
3+
This documentation is intended to show how to create a Docker image with Matlab compiled implementation of Kilosort 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
114

125
## Requirements
136
- Packaging a MATLAB Docker image is supported on Linux only
@@ -21,78 +14,35 @@ There are four main steps to generate a functional kilosort3-compiled docker ima
2114
- Signal Processing Toolbox
2215
- Statistics and Machine Learning Toolbox
2316

24-
Licenses for Matlab and toolboxes are needed only for compiling kilosort 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.
25-
26-
## Kilosort Setup
27-
- Git clone or Download kilosort [source code](https://github.com/MouseLand/Kilosort)
28-
- Open Matlab
29-
- Compile Kilosort mexfiles:
30-
- Set Matlab's workspace folder to `<git-cloned-path>/Kilosort/CUDA`
31-
- In Matlab console run:
32-
```matlab
33-
>> mexGPUall
34-
```
35-
36-
## Compiling Kilosort as Matlab's Standalone Application
37-
- Set Matlab's workspace folder to `/path/to/spikeinterface-dockerfiles/kilosort3-compiled/matlab_files`
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-
```
42-
43-
## Generating Base Docker Image
44-
- To generate the base docker image (called `ks3-matlab-base`) with the compiled application, run the following command in Matlab console:
45-
```matlab
46-
>> compiler.package.docker('ks3_compiled', 'requiredMCRProducts.txt', 'ImageName', 'ks3-matlab-base')
47-
```
48-
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-
```
17+
## Creating Docker Image
6618

67-
## Extending Base Image and creating final image
68-
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run kilosort3:
19+
There are four main steps to generate a functional kilosort-compiled docker image:
6920

70-
- In your terminal, go to the folder for this project:
71-
```
72-
$ cd /path/to/spikeinterface-dockerfiles/kilosort3-compiled
73-
```
21+
1. Kilosort Setup
22+
2. Compile Kilosort as Standalone Application
23+
3. Create a (base) docker image with Matlab Runtime and the compiled application from step 2
24+
4. Extend the docker image from step 3 for improvements and fixes
7425

75-
- Run build script:
76-
```
77-
$ source build.sh
78-
```
26+
Detailed descriptions for each step are documented in `README.md` for each supported kilosort version folder (`kilosort-compiled`, `kilosort2-compiled` and so on)
7927

28+
Licenses for Matlab and toolboxes are needed only for compiling kilosort 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.
8029

8130
## Running a container
8231

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
32+
After generating kilosort-compiled image, [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
8433

8534
The base syntax to run dockerized kilosort is:
8635

36+
```bash
37+
docker run -v <host-data-folder>:<docker-data-folder> <image>:<tag> <ks_command> [ARGS]
8738
```
88-
docker run -v <host-data-folder>:<docker-data-folder> -it spikeinterface/kilosort3-compiled-base:0.1.0 ks3_compiled [ARGS]
89-
```
90-
91-
Notice that a volume has to be binded to a folder were all the data to run kilosort3 are stored
92-
93-
Currently the only ARG option is the folder where the data are stored (\<docker-data-folder\>)
39+
- A volume has to be binded to a folder were all the data to run kilosort are stored
40+
- `<image>`: Image name given by `build.sh` script
41+
- `<tag>`: Image Tag given by `build.sh` script
42+
- `<ks_command>`: Depends on kilosort version, options are `ks_compiled`, `ks2_compiled`, `ks2_5_compiled` or `ks3_compiled`
43+
- `[ARGS]`: Currently the only ARG option is the folder where the data are stored (\<docker-data-folder\>)
9444

95-
This kilosort3 compiled version assumes that there are also two `.mat` files in this data folder:
45+
This kilosort compiled version assumes that there are also two `.mat` files in this data folder:
9646
1. `ops.mat`: Configurations (options) data
9747
2. `chanMap.mat`: ChannelMap data
9848

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Generating Compiled Kilosort Docker Image
2+
3+
## 1. Kilosort Setup
4+
- Git clone or Download Kilosort [source code](https://github.com/cortex-lab/KiloSort)
5+
- Open Matlab
6+
- Compile Kilosort mexfiles:
7+
- Set Matlab's workspace folder to `<git-cloned-path>/KiloSort/CUDA`
8+
- In Matlab console run:
9+
```matlab
10+
>> mexGPUall
11+
```
12+
13+
## 2. Compiling Kilosort as Matlab's Standalone Application
14+
- Set Matlab's workspace folder to `/path/to/spikeinterface-dockerfiles/kilosort_no_license`
15+
- Run `mcc` command with `utils` folder and kilosort path:
16+
```matlab
17+
>> mcc -m kilosort-compiled/ks_compiled.m -a utils -a <git-cloned-path>/KiloSort
18+
```
19+
20+
## 3. Generating Base Docker Image
21+
- To generate the base docker image (called `ks-matlab-base`) with the compiled application, run the following command in Matlab console:
22+
```matlab
23+
>> compiler.package.docker('ks_compiled', 'requiredMCRProducts.txt', 'ImageName', 'ks-matlab-base')
24+
```
25+
26+
- [Optional] Files generated by Matlab Compiler can be deleted:
27+
- In your terminal, go to the `kilosort_no_license` folder in this project:
28+
```bash
29+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license
30+
```
31+
- Run `rm` command:
32+
```bash
33+
$ rm -r \
34+
includedSupportPackages.txt \
35+
ks-matlab-basedocker/ \
36+
ks_compiled \
37+
mccExcludedFiles.log \
38+
readme.txt \
39+
requiredMCRProducts.txt \
40+
run_ks_compiled.sh \
41+
unresolvedSymbols.txt
42+
```
43+
44+
## 4. Extending Base Image and creating final image
45+
46+
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run kilosort:
47+
48+
- In your terminal, go to the folder for this project:
49+
```bash
50+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license/kilosort-compiled
51+
```
52+
53+
- Run build script:
54+
```bash
55+
$ source build.sh
56+
```
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Generating Compiled Kilosort2 Docker Image
2+
3+
## 1. Kilosort Setup
4+
- Git clone or Download Kilosort [source code](https://github.com/MouseLand/Kilosort)
5+
- Git checkout to the correct version:
6+
```bash
7+
$ git checkout tags/v2.0
8+
```
9+
- Open Matlab
10+
- Compile Kilosort mexfiles:
11+
- Set Matlab's workspace folder to `<git-cloned-path>/Kilosort/CUDA`
12+
- In Matlab console run:
13+
```matlab
14+
>> mexGPUall
15+
```
16+
17+
## 2. Compiling Kilosort as Matlab's Standalone Application
18+
- Set Matlab's workspace folder to `/path/to/spikeinterface-dockerfiles/kilosort_no_license`
19+
- Run `mcc` command with `utils` folder and kilosort path:
20+
```matlab
21+
>> mcc -m kilosort2-compiled/ks2_compiled.m -a utils -a <git-cloned-path>/Kilosort
22+
```
23+
24+
## 3. Generating Base Docker Image
25+
- To generate the base docker image (called `ks2-matlab-base`) with the compiled application, run the following command in Matlab console:
26+
```matlab
27+
>> compiler.package.docker('ks2_compiled', 'requiredMCRProducts.txt', 'ImageName', 'ks2-matlab-base')
28+
```
29+
30+
- [Optional] Files generated by Matlab Compiler can be deleted:
31+
- In your terminal, go to the `kilosort_no_license` folder in this project:
32+
```bash
33+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license
34+
```
35+
- Run `rm` command:
36+
```bash
37+
$ rm -r \
38+
includedSupportPackages.txt \
39+
ks2-matlab-basedocker/ \
40+
ks2_compiled \
41+
mccExcludedFiles.log \
42+
readme.txt \
43+
requiredMCRProducts.txt \
44+
run_ks2_compiled.sh \
45+
unresolvedSymbols.txt
46+
```
47+
48+
## 4. Extending Base Image and creating final image
49+
50+
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run kilosort2:
51+
52+
- In your terminal, go to the folder for this project:
53+
```bash
54+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license/kilosort2-compiled
55+
```
56+
57+
- Run build script:
58+
```bash
59+
$ source build.sh
60+
```
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Generating Compiled Kilosort2_5 Docker Image
2+
3+
## 1. Kilosort Setup
4+
- Git clone or Download Kilosort [source code](https://github.com/MouseLand/Kilosort)
5+
- Git checkout to the correct version:
6+
```bash
7+
$ git checkout tags/v2.5
8+
```
9+
- Open Matlab
10+
- Compile Kilosort mexfiles:
11+
- Set Matlab's workspace folder to `<git-cloned-path>/Kilosort/CUDA`
12+
- In Matlab console run:
13+
```matlab
14+
>> mexGPUall
15+
```
16+
17+
## 2. Compiling Kilosort as Matlab's Standalone Application
18+
- Set Matlab's workspace folder to `/path/to/spikeinterface-dockerfiles/kilosort_no_license`
19+
- Run `mcc` command with `utils` folder and kilosort path:
20+
```matlab
21+
>> mcc -m kilosort2_5-compiled/ks2_5_compiled.m -a utils -a <git-cloned-path>/Kilosort
22+
```
23+
24+
## 3. Generating Base Docker Image
25+
- To generate the base docker image (called `ks2_5-matlab-base`) with the compiled application, run the following command in Matlab console:
26+
```matlab
27+
>> compiler.package.docker('ks2_5_compiled', 'requiredMCRProducts.txt', 'ImageName', 'ks2_5-matlab-base')
28+
```
29+
30+
- [Optional] Files generated by Matlab Compiler can be deleted:
31+
- In your terminal, go to the `kilosort_no_license` folder in this project:
32+
```bash
33+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license
34+
```
35+
- Run `rm` command:
36+
```bash
37+
$ rm -r \
38+
includedSupportPackages.txt \
39+
ks2_5-matlab-basedocker/ \
40+
ks2_5_compiled \
41+
mccExcludedFiles.log \
42+
readme.txt \
43+
requiredMCRProducts.txt \
44+
run_ks2_5_compiled.sh \
45+
unresolvedSymbols.txt
46+
```
47+
48+
## 4. Extending Base Image and creating final image
49+
50+
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run kilosort2_5:
51+
52+
- In your terminal, go to the folder for this project:
53+
```bash
54+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license/kilosort2_5-compiled
55+
```
56+
57+
- Run build script:
58+
```bash
59+
$ source build.sh
60+
```
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Generating Compiled Kilosort3 Docker Image
2+
3+
## 1. Kilosort Setup
4+
- Git clone or Download Kilosort [source code](https://github.com/MouseLand/Kilosort)
5+
- Open Matlab
6+
- Compile Kilosort mexfiles:
7+
- Set Matlab's workspace folder to `<git-cloned-path>/Kilosort/CUDA`
8+
- In Matlab console run:
9+
```matlab
10+
>> mexGPUall
11+
```
12+
13+
## 2. Compiling Kilosort as Matlab's Standalone Application
14+
- Set Matlab's workspace folder to `/path/to/spikeinterface-dockerfiles/kilosort_no_license`
15+
- Run `mcc` command with `utils` folder and kilosort path:
16+
```matlab
17+
>> mcc -m kilosort3-compiled/ks3_compiled.m -a utils -a <git-cloned-path>/Kilosort
18+
```
19+
20+
## 3. Generating Base Docker Image
21+
- To generate the base docker image (called `ks3-matlab-base`) with the compiled application, run the following command in Matlab console:
22+
```matlab
23+
>> compiler.package.docker('ks3_compiled', 'requiredMCRProducts.txt', 'ImageName', 'ks3-matlab-base')
24+
```
25+
26+
- [Optional] Files generated by Matlab Compiler can be deleted:
27+
- In your terminal, go to the `kilosort_no_license` folder in this project:
28+
```bash
29+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license
30+
```
31+
- Run `rm` command:
32+
```bash
33+
$ rm -r \
34+
includedSupportPackages.txt \
35+
ks3-matlab-basedocker/ \
36+
ks3_compiled \
37+
mccExcludedFiles.log \
38+
readme.txt \
39+
requiredMCRProducts.txt \
40+
run_ks3_compiled.sh \
41+
unresolvedSymbols.txt
42+
```
43+
44+
## 4. Extending Base Image and creating final image
45+
46+
The Dockerfile in this folder applies some fixes and updates to the base image generated automatically by Matlab in order to properly run kilosort3:
47+
48+
- In your terminal, go to the folder for this project:
49+
```bash
50+
$ cd /path/to/spikeinterface-dockerfiles/kilosort_no_license/kilosort3-compiled
51+
```
52+
53+
- Run build script:
54+
```bash
55+
$ source build.sh
56+
```

0 commit comments

Comments
 (0)