Scientific Computing

GitHub Actions Windows MSYS2 MS-MPI

On Windows the most commonly used MPI libraries are MS-MPI and Intel MPI. MSYS2 is a popular choice to use GCC, Clang and many other developer tools from the Windows Command Prompt, PowerShell or the MSYS Terminal itself.

Continuous Integration for Windows MPI applications on GitHub Actions is accomplished as in fortran-mpi-examples

Set inter-step environment variables using GitHub Actions environment files.

GNU Octave without readline

Upon a generic Homebrew brew upgrade command, GNU readline that is required by the GNU Octave package was upgraded from 8.2 to 8.3. This made GNU Octave unusable by not being able to type in GUI or non-GUI modes. A workaround for non-GUI mode only is to disable interactive console input like:

octave --no-line-editing

Readline 8.3 has a known bug with a patch expected to be included in a future release. For now, package maintainers can either use Readline older than 8.3, or patch Readline 8.3 to fix the bug that affects several programs beyond GNU Octave.

GNU Octave for continuous integration

Matlab CI is often a better choice than Octave below.


Cross-platform developers run into numerous compatibility issues. Rather than wait for frustrated users to report such a bug, use continuous integration.

Here are CI templates using GNU Octave tests of .m code. Octave oruntests() is incompatible with the advanced functionality of Matlab runtests(),

GitHub Actions: “.github/workflows/ci.yml”:

name: ci

on:
  push:
    paths:
    - "**.m"
    - ".github/workflows/ci.yml"

jobs:

  linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout

    - run: |
        sudo apt update
        sudo apt install --no-install-recommends octave

    - run: octave --eval "test_myfuncs"
      working-directory: tests

  windows:
    runs-on: windows-2025
    steps:
    - uses: actions/checkout
    - run: winget install GNU.Octave --disable-interactivity --accept-source-agreements --accept-package-agreements

    - run: octave --eval "test_myfuncs"
      working-directory: tests

GitHub Actions winget install

WinGet can be used on Windows GitHub Actions runners where a Windows program needs to be installed. In this example, environment variable FFMPEG_ROOT tells Python where to find the ffmpeg.exe program. One could more generally append to the GITHUB_PATH environment variable.


jobs:
  windows:
    runs-on: windows-2025

    steps:

    - name: install prereqs (Windows)
      if: runner.os == 'Windows'
      run: winget install ffmpeg --disable-interactivity --accept-source-agreements --accept-package-agreements

    - name: FFMPEG_ROOT Windows
      if: runner.os == 'Windows'
      run: echo "FFMPEG_ROOT=$env:LOCALAPPDATA/Microsoft/WinGet/Links/" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

    - name: PyTest
      run: pytest
import functools
import shutil
import os


@functools.cache
def get_exe(name: str) -> str:

    for p in (os.environ.get("FFMPEG_ROOT"), None):
        if exe := shutil.which(name, path=p):
            return exe

    raise FileNotFoundError(name)

Install latest GNU Octave

GNU Octave offers the syntax of Matlab in an open-source software suite. Octave binaries are readily installed:

  • macOS: brew install octave
  • Windows: winget install GNU.Octave
  • Linux: Flatpak

For Linux, Flatpak may already be installed by the Linux distro. The flathub repo is added by:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Disable Installed Addons in MATLAB

Matlab Addons have commercial and no-cost toolboxes that can be installed into Matlab. When testing project code, it is often useful to disable an addon to ensure that the project code works as expected in diverse Matlab toolbox-enabled environments.

Check Matlab packages installed:

addons = matlab.addons.installedAddons;

disp(addons)

To disable an addon, you can use the matlab.addons.disable function. Here is an example of how to disable a specific addon by its ID. For example for “Parallel Computing Toolbox”:

matlab.addons.disable("Parallel Computing Toolbox")

Check logical status of the addon:

matlab.addons.isAddonEnabled("Parallel Computing Toolbox")

Alert boxes in Hugo site generator

If alert boxes (like “note”, “warning”) are not built into a site’s Hugo theme, they can be added with a bit of CSS and partial template.

Edit / add to the Hugo site as in this Gist to enable alert boxes.

Prefer IPv4 for conda on Windows

Windows users generally should not disable IPv6. Upon network upgrades or working in a new location with IPv6, network operations that previously worked may fail. An example of this is “conda install” or “conda update” commands that hang or fail with a timeout error. While curl has an option “-4” or “–ipv4” to force IPv4 connections only, the “conda” command does not have a “force IPv4” option currently. Windows can be set to prioritize IPv4 over IPv6, which can help with conda operations and other network operations. Reprioritizing IPv4 over IPv6 is vastly preferable to disabling IPv6, as it allows for compatibility with IPv6 networks.

Check existing IPv6 settings with the command:

netsh interface ipv6 show prefixpolicies

ℹ️ Note

If there are only one or zero prefix policy entries, then IPv6 is likely not configured correctly. The rest of this procedure would not help as Windows will go to factory defaults and ignore the IPv4 preference. Fix the IPv6 configuration first, then proceed with the steps below.

Set the prefix policy for IPv4 to have a higher priority than IPv6 by running the following command in an elevated PowerShell or Command Prompt:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4

Check that the IPv6 prefix policy has been set correctly by running:

netsh interface ipv6 show prefixpolicies

Then execute the “conda install” or “conda update” command again.


To restore the default Windows settings of IPv6 having priority over IPv4:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 35 4

Matlab arguments validation

Matlab function arguments validation syntax is generally recommended over validateattributes() and inputParser(). Function arguments validation specification coerces the input and/or output variables to the class declaration given if possible, and errors otherwise.

  • Default values are easily specified, which required such verbose syntax before.
  • only a single class can be specified
  • recall the .empty method of most Matlab classes e.g. datetime.empty() that allows initializing an empty array.

Matlab argument validation syntax coerces class at runtime.

GNU Octave compatibility

Currently GNU Octave does not enable function arguments validation syntax, but it is possible to use the function albeit with warnings like:

“function arguments validation blocks are not supported; INCORRECT RESULTS ARE POSSIBLE”

To elide the verbose warnings to allow for self-tests or quick use, do in Octave like:

warning('off', 'all')

% whatever code you want to run that uses the Matlab arguments validation syntax
oruntests .

% restore warnings
warning('on', 'all')

There are requests for Octave to assign a warning ID so that only this warning can be silenced, but it is not implemented as of this writing. Thus all warnings are silenced, which is not recommended in production code. However, for self-tests or quick use, it could be acceptable.

Intel oneAPI on GitHub Actions

Intel oneAPI is a useful, performant compiler for CI with the C, C++, and Fortran languages. oneAPI compilers give useful debugging output at build and run time. If having trouble determining the oneAPI APT package name, examine the APT repo Packages file on the developer computer like:

curl -O https://apt.repos.intel.com/oneapi/dists/all/main/binary-amd64/Packages.gz

gunzip Packages.gz

less Packages

This examples oneAPI GitHub Actions workflow works for C, C++, and Fortran.