|
| 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 | +``` |
0 commit comments