Continuous Integration services run user-defined self-checks on code on each “git push”.
GitHub Actions is often the best place to start with CI.
CI is one part of the
DevOps lifecycle.
These services have quotas even for public Git repos:
Microsoft Surface computers are generally a good device to consider for education, work and personal computing.
Microsoft has published a
firmware update lifecycle schedule
for all Surface devices.
While one would assume after four years or so of firmware updates the bugs would mostly be worked out,
there is the possibility of an unpatched firmware vulnerability as has happened across OEMs.
IPython “confirm on exit” is not always desired.
To disable confirm on exit, from Terminal (not in Python) type:
ipython profile create
This will print out the locate of the IPython config file, which is like “~/.ipython/profile_default/ipython_config.py”.
Open this file in a text editor, and uncomment the line:
c.TerminalInteractiveShell.confirm_exit = False
Upon restarting IPython, the usual Ctrl+D
immediately exits without confirmation.
GitHub Actions
is among the best no-cost CI and is relatively easy to use.
Here are a couple example GitHub Actions templates we use across many projects.
Each workflow is stored in the project under directory “.github/workflows”.
For clarity, usually we use a filename like “.github/workflows/ci.yml”.
This Python template tests on Linux, macOS and Windows.
Always enclose version numbers in quotes to avoid YAML interpretation issues.
The optional “Unix FC var” step is an example of setting an environment variable dynamically–here for a Fortran compiler.
The Matlab
-batch command line option
makes running Matlab code from the command line more reliable.
However, Matlab is not really designed to be used extensively by end users this way.
Matlab does not have a command-line parser like many other languages (scripted and compiled) do.
Python has the
argparse
module that we generally find sufficient.
In Fortran, using the get_command_argument() with select case can make a straightforward command line parser without resorting to external packages.
Perhaps a reason for Matlab not having these features is the startup time of Matlab.
While Python can complete a small program in 100 ms from the shell, Matlab takes 10-30 seconds or so depending on the number of toolboxes and the speed of the computer.
GNU Octave starts up nearly as quickly as Python when
Octave toolboxes are not auto-loaded.
It would be nice if Matlab someday will make an actual command-line interface with fast startup time.
Many CI services use Ubuntu Linux images.
The default Linux / Ubuntu version is typically an older version.
It can be convenient to switch CI jobs to a newer Linux version to get more recent libraries.
Here are examples of switching Linux version for a few popular CI services.
GitHub Actionsdefault Ubuntu version
is controlled with .github/workflows/*.yml file(s).
Code profiling and micro-benchmarks can be useful to discover hot spots in code that might be targets for improving efficiency and overall execution time.
Matlab has long had an effective
profiler
built in from the factory.
Commercial and free software often prioritized quality and correctness over speed as part of a good quality software product.
There are cases where the Matlab factory functions are simply not optimized due to development time constraints.
Yair Altman has expertise with the undocumented scripts inside Matlab that many Matlab users rely on. He has written a three-part series on profiling and optimizing Matlab factory code, which I find to be worthwhile reading even for general Matlab code optimization.
Homebrew
is a popular framework for quickly installing development tools on macOS, including Gfortran.
macOS cloud services such as MacInCloud may say they provide Homebrew, but you may not be able to install packages without a sudo/admin account.
To install Homebrew without sudo/admin in the user home directory for cloud or physical hardware, follow these steps:
If one truly doesn’t have sudo / admin access as typical with a managed (less-expensive) cloud macOS plan, and if Xcode is not the appropriate version, GCC may compile from source, which can take tens of minutes.
This may occur when doing
Running compiled M-scripts using Matlab Compiler
deploytool
may result in warning messages about tbb.dll.
Updating the Threaded Building Blocks library may help.
Also consider updating the Matlab version if applicable.
Download and install latest
Intel oneTBB.
If using a command prompt, make oneTBB available by command
tbbvars.
Recompile with Matlab deploytool.
Where “files” is set appropriately for the project.
Making a per-project files is strongly recommended to ensure files aren’t missed in the type check.
One can make a system-wide ~/.mypy.ini, that is overridden by the per-project pyproject.toml.