MATLAB
Host MATLAB Online in ICE Connect EKC. Run code on multiple Nvidia GPUs in parallel.
Requires a MATLAB license.
Installation
Install the app through Rancher.
Supported Docker images
This Helm chart can be used with MathWorks Docker images
mathworks/matlab:
Provides an Ubuntu-based image with an installation of MATLAB.
mathworks/matlab-deep-learning:
Also adds additional toolboxes:
- Deep Learning Toolbox
- Image Processing Toolbox
- Parallel Computing Toolbox
- More
Configure
Additional products and services
Before deploying MATLAB from Rancher, additional toolboxes can be installed from MathWorks Products and Services, such as Financial Toolbox
and Optimization Toolbox
.
Simulink
is not supported by MATLAB Online.
SSH settings
MATLAB Online requires SSH access to the host machine. Add your SSH public key from e.g. ~/.ssh/id_rsa.pub
.
Resources
Requested CPU (required): The minimum number of CPU cores to request for the Jupyter server, in milli-CPU units (m). The default is 1000m
, which is equivalent to one CPU core. More cores will be available freely depending on the server load, with a maximum of 64 cores.
Memory limit (required): The maximum amount of memory to request, in Gibibytes (Gi).
Storage size (required): The amount of persistent storage to request, in Gibibytes (Gi). The storage volume will be mounted in the /home/matlab
.
Attach GPU (optional): If you want to use an Nvidia GPU, enable this option. Select the GPU type and the number of GPUs to request.
Environment variables
Read more about the environment variables in the MATLAB documentation for the Docker container.
Access
The login portal of MATLAB Online opens the application up for anyone to access from a browser, so SSH port forwarding must be used (instead of ingress).
SSH port forward
In Rancher, look up the NodePort at Endpoint using Protocol: TCP
Log in as user matlab
or root
, and port forward the MATLAB web interface from port 8888
:
Open http://localhost:9999 in your web browser.
Web interface
Log in using your MathWorks account, and access the application
Usage
Default packages
No toolboxes or packages are installed in mathworks/matlab.
This lists the default toolboxes in mathworks/matlab-deep-learning
>> matlab.addons.installedAddons
Name Version Enabled Identifier
_________________________________________ _______ _______ __________
"Signal Processing Toolbox" "9.1" true "SG"
"Computer Vision Toolbox" "10.3" true "VP"
"Deep Learning Toolbox" "14.5" true "NN"
"Statistics and Machine Learning Toolbox" "12.4" true "ST"
"Image Processing Toolbox" "11.6" true "IP"
"MATLAB Coder" "5.5" true "ME"
"GPU Coder" "2.4" true "GC"
"Parallel Computing Toolbox" "7.7" true "DM"
"Text Analytics Toolbox" "1.9" true "TA"
Default support packages
>> matlabshared.supportpkg.getInstalled
Name Version Base Product
----------------------------------------------------------- ------- ---------------------
Deep Learning Toolbox Model for AlexNet Network 22.2.0 Deep Learning Toolbox
Deep Learning Toolbox Importer for Caffe Models 22.2.0
Deep Learning Toolbox Model for GoogLeNet Network 22.2.0 Deep Learning Toolbox
GPU Coder Interface for Deep Learning Libraries 22.2.0
Deep Learning Toolbox Model for Inception-ResNet-v2 Network 22.2.0 Deep Learning Toolbox
Deep Learning Toolbox Model for Inception-v3 Network 22.2.0 Deep Learning Toolbox
Deep Learning Toolbox Converter for TensorFlow models 22.2.0
MATLAB Coder Interface for Deep Learning Libraries 22.2.0
Deep Learning Toolbox Converter for ONNX Model Format 22.2.0
Deep Learning Toolbox Model for ResNet-101 Network 22.2.0 Deep Learning Toolbox
Deep Learning Toolbox Model for ResNet-18 Network 22.2.0 Deep Learning Toolbox
Deep Learning Toolbox Model for ResNet-50 Network 22.2.0 Deep Learning Toolbox
Install packages at runtime
Add-on Explorer
is not supported on MATLAB Online.
Packages from MATLAB File Exchange can be installed using the MATLAB Command Window
openExample('deeplearning_shared/CodeGenerationForDeepLearningNetworksExample')
net = mobilenetv2();
Error using mobilenetv2
mobilenetv2 requires the Deep Learning Toolbox Model for MobileNet-v2 Network support
package for the pretrained weights.
To install this support package, use the Add-On Explorer. To obtain the untrained
layers, use mobilenetv2('Weights','none'), which does not require the support package.
Open the Deep Learning Toolbox Model for MobileNet-v2 Network, right-click Download, and Copy Link.
websave('mobilenetv2.mlpkginstall', 'https://se.mathworks.com/matlabcentral/.../packages/mlpkginstall')
open("mobilenetv2.mlpkginstall")
Continue with the example
Verify GPU Environment
Use the MATLAB Command Window to verify the GPU Code Generation Environment
gpuEnvObj = coder.gpuEnvConfig;
gpuEnvObj.BasicCodegen = 1;
gpuEnvObj.BasicCodeexec = 1;
gpuEnvObj.DeepLibTarget = 'tensorrt';
gpuEnvObj.DeepCodeexec = 1;
gpuEnvObj.DeepCodegen = 1;
results = coder.checkGpuInstall(gpuEnvObj)
The output should be
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED
TensorRT Environment : PASSED
Host Compiler : PASSED
Basic Code Generation : PASSED
Basic Code Execution : PASSED
Deep Learning (TensorRT) Code Generation: PASSED
Deep Learning (TensorRT) Code Execution: PASSED
results =
struct with fields:
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 1
hostcompiler: 1
basiccodegen: 1
basiccodeexec: 1
deepcodegen: 1
deepcodeexec: 1
tensorrtdatatype: 1
profiling: 0
Examples
Examples are available under /opt/matlab/R2022b/examples/
GPU Code Generation: The Mandelbrot Set
openExample('gpucoder/GPUCodeGenerationTheMandelbrotSetExample')
run("GPUCodeGenerationTheMandelbrotSetExample.m")
Run MATLAB Functions on Multiple GPUs
Read more
Create a custom MATLAB image: https://github.com/mathworks-ref-arch/matlab-dockerfile
The web browser interface is provided by matlab-proxy