This is a testbed for system identification and forecasting of dynamical systems using the Hankel Alternative View of Koopman (HAVOK) algorithm and Sparse Identification of Nonlinear Dynamics (SINDy). This code is based on the work by Brunton & Kutz (2022) and Yang et. al. (2022).
GPU: Some matrix calculations within this algorithm can be optimized for GPU usage. However, allocating GPU memory is sometimes slower than performing computations on the CPU (if the dataset is small enough). Implement an algorithm that enables GPU compute when data surpasses some threshold. Functions for allocating/retrieving/operating on GPU variables are:
A = gpuArray(A) [main memory to gpu memory]
A = rand(1000,'gpuArray') [directly to gpu memory]
A = gpuArray.rand(1000)
A = gather(A) [return from gpu memory to ram]
arrayfun(fun,A) [applies the function "fun" to each element of the gpuArray "A"]
[note: NVIDIA cards bottleneck double precision performance; single-precision is much much faster]
Multi-CPU: For expensive but decoupled operations, use multi-CPU instead. Note: A lot of core functions in MATLAB are already parallelized, such as:
Matrix products
Element-wise (Hadamand) matrix products
Singular Value Decomposition
2D convolution
Optimization toolbox
for-loops with certain properties
multi-cpu calculations are made using a parallel pool (set of workers), whose properties can be adjusted with "parpool"
To enable parallel computing in for-loops, use parfor. This loop cannot include dependencies. Variables in this context include:
Loop variable - used for indexing
Sliced variable - Array segment used in different parts of the loop (can be cells or arrays, but not inside a structure)
Broadcast variable - External variable called to within the loop, but not changed
Reduction variable - Accumulates regardless of loop iteration (this variable has to be associative)
Temporary variable - Temporary variable only created/used in the loop and then discarded
CPU: Some operations, like nonlinear or linearly coupled system solving with ODE45 or fsolve, are not parallelizable, or require custom code.
GPU: Some matrix calculations within this algorithm can be optimized for GPU usage. However, allocating GPU memory is sometimes slower than performing computations on the CPU (if the dataset is small enough). Implement an algorithm that enables GPU compute when data surpasses some threshold. Functions for allocating/retrieving/operating on GPU variables are:
Multi-CPU: For expensive but decoupled operations, use multi-CPU instead. Note: A lot of core functions in MATLAB are already parallelized, such as:
To enable parallel computing in for-loops, use parfor. This loop cannot include dependencies. Variables in this context include:
CPU: Some operations, like nonlinear or linearly coupled system solving with ODE45 or fsolve, are not parallelizable, or require custom code.