Scientific Computing

Use MSVC in GitHub Actions

GitHub Actions using MSVC in the past might have used the msvc-dev-cmd action, but as of this writing it was last updated in 2023 and giving deprecation warnings. An alternative without needing an Action was based on libass project:


    steps:
    # from https://github.com/libass/libass/blob/0.17.5/.github/workflows/meson.yml#L118-L125
    - name: Setup MSVC
        run: |
        $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
        $vsPath = & $vswhere -latest -products * -property installationPath
        if (-not $vsPath) { throw "Could not find a Visual Studio installation" }
        "VS=$vsPath"
        "VS=$vsPath" >> $env:GITHUB_ENV

This works for ARM64 and x64 builds, example

CMake GCC superbuild

This CMake project builds GCC and high level GCC prerequisites such as GMP. This avoids needing to manually download and configure each project. The CMake GCC superbuild assumes fundamental prerequisites such as libc, autotools, make, CMake are present. The 3-stage compiler bootstrap is enabled to help ensure a working, performant GCC.

Alternative: Homebrew GCC pin script.

Raspberry Pi power stability

The Raspberry Pi 5 power management IC PMIC is the Renesas DA9091, a chip specifically designed for the Pi 5. The Raspberry Pi 3B+ and Raspberry Pi 4 PMIC is the MaxLinear MXL7704. Older Raspberry Pi models used custom circuitry or the APX803 instead of a COTS PMIC to handle sequencing of discrete DC power input to the Pi subsystems. It has been noted that damaging the PMIC can make the Raspberry Pi too difficult to repair.

A yellow lightning bolt is GPU-superimposed on the Raspberry Pi display output for low voltage. In general computing platform operation is not guaranteed with voltages out of tolerance. The SD card can become unreadable, the Pi may have random malfunctions, and corrupt data (bad writes) on the SD card. Raspberry Pi 4 and Pi 5 require a minimum 5 Volt 3.0 Amp power supply. Using peripherals can require higher current supply. The cable between the power supply and Raspberry Pi must be of good quality to minimize voltage drop and unstable operation. The USB-C power connector of the Raspberry Pi 4 and Pi 5 is markedly more robust than the micro-USB power connector of legacy Raspberry Pi models.

Raspberry Pi Low voltage alarm

If the DC input voltage falls below 4.65 volts (depending on Raspberry Pi model and firmware), the GPU superimposes a lightning bolt graphic on the display output. This may not be visible on a VNC remote desktop.

yellow lightning bolt

The status of the low voltage alarm (current or past) can be read from the Terminal with the command:

vcgencmd get_throttled

From the man page of vcgencmd:

Returns the throttled state of the system. This is a bit pattern - a bit being set indicates the following meanings:

Bit Meaning
0 Under-voltage detected
1 Arm frequency capped
2 Currently throttled
3 Soft temperature limit active
16 Under-voltage has occurred
17 Arm frequency capping has occurred
18 Throttling has occurred
19 Soft temperature limit has occurred

A value of zero indicates that none of the above conditions is true.

To find if one of these bits has been set, convert the value returned to binary, then number each bit along the top. You can then see which bits are set. For example:

0x50000 = 0101 0000 0000 0000 0000

Adding the bit numbers along the top we get:

19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
 0  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0

From this we can see that bits 18 and 16 are set, indicating that the Pi has previously been throttled due to under-voltage, but is not currently throttled for any reason.

This can be done in Python script:

Example:

python3 check_raspi_throttle.py
throttled: 0x50005
Set throttled bits:
  bit 0: Under-voltage detected
  bit 2: Currently throttled
  bit 16: Under-voltage has occurred
  bit 18: Throttling has occurred

Measure Raspberry DC input voltage / current

The Raspberry Pi 5 added vcgencmd pmic_read_adc to read DC input voltage and the several generated voltages and currents consumed. On older Raspberry Pi models there is no built-in capability to measure the Raspberry Pi DC input voltage without adding an external ADC.

On the older Raspberry Pi (older than Pi 5) it may be possible to read the input voltage binary state (OK or low) from the Terminal, but we have not confirmed this. On the Raspberry Pi 1 B+ and Pi 2 it may be possible to read state of GPIO 35, depending on the hardware and firmware. On the Raspberry Pi 3 in may be possible to read GPU-driven LED status.

Mitigate inadequate power supply

When compiling programs with concerns about excessive power consumption, consider not compiling in parallel. For GNU Make, “make -j1” uses 1 CPU core. For Ninja compilation in parallel is default, so specify “ninja -j1” for one build thread. For meta-build systems limit build parallelism like CMake cmake --build <build-directory> -j1 or Meson meson compile -j1

Related: Measure Raspberry Pi CPU temperature

Clang-cl and Flang Fortran

Visual Studio can install the LLVM Clang compiler including clang-cl, which is LLVM Clang with an MSVC-compatible command-line interface. Clang-cl helps developers use Clang as a replacement for the Microsoft Visual C++ compiler. The Visual Studio 18 2026 release brought along the LLVM Flang Fortran compiler, but Flang with Visual Studio is currently mostly broken due to missing .mod modules. We demonstrate this issue here as other compilers could be similarly broken if incompletely or improperly installed, as might happen on HPC or cloud resources.

program test
use, intrinsic :: iso_fortran_env
end program

The MSYS2 flang works with that program, but the Visual Studio 2026 Flang does not, as it cannot find the “iso_fortran_env.mod” module.

Compilers like NVHPC and LLVMFlang have actual files like “iso_fortran_env.mod” installed with the compiler. Gfortran and Intel Fortran don’t have a physical file corresponding to these intrinsic Fortran modules. In part since Flang itself isn’t yet working in Visual Studio 2026, CMake isn’t able to recognize the Flang compiler with the ClangCL toolset.

cmake -B build -G "Visual Studio 18 2026" -T ClangCL -DCMAKE_Fortran_COMPILER=flang

results in errors about devenv and “unknown” Fortran compiler. Once Flang is fixed within Visual Studio, hopefully CMake will add support for the Flang compiler with the ClangCL toolset, as this would save users the effort of installing Intel oneAPI if they only want Visual Studio with Fortran.

VNC advantages over X-Forwarding

VNC advantages over X-forwarding include a faster, more responsive whole desktop vs. individual applications. Bandwidth compression means VNC can consume kB/sec instead of X-forwarding that may be up to MB/sec. Upon disconnect and reconnect, the VNC desktop can still be there as it was, whereas single application X-forwarding loses the application state.

To use VNC to HPC, usually the VNC is tunneled over SSH for security, as traditional VNC is not encrypted. The VNC server is already running on the HPC (or started by the user per HPC system documentation), and the user runs a VNC client on their local machine to connect to the VNC server on the HPC. For user workstations, the user might setup a VNC server. Numerous open-source or no-cost VNC clients are available including TigerVNC.

  • Windows: winget install --id TigerVNC.TigerVNC -e
  • macOS: brew install --cask tigervnc
  • Linux: apt install tigervnc-viewer or dnf install tigervnc

Then connect the SSH tunnel for VNC and run the VNC client to connect to the VNC server on the HPC or remote computer.

Intel MPI on Windows

The Windows Intel oneAPI compilers present Visual Studio-like command line options. Intel oneAPI toolkit includes the Intel MPI library, which provides “mpiexec” needed to run MPI programs and MPI compiler wrappers.

While Windows MPI users might find using WSL for MPI more convenient and performant, even using Intel compilers in WSL, some users may prefer native Windows MPI with Intel oneAPI.

The Intel oneAPI command prompt environment can be used or use a script to enable oneAPI in PowerShell.

Intel MPI has"mpiicx", “mpiicpx” and “mpiifx” compiler wrappers.

Intel MPI on Windows is only for Intel oneAPI compiler and Visual Studio.

Expert options

Although usually not needed, a separate username can be used for Windows Intel MPI jobs by from Command Prompt:

runas /user:username cmd

Environment variables are not passed to the new window, so it may be necessary to run Intel compilervars.bat again. It’s possible to register the user credential in the Windows registry.

BZip2 1.1 development archived

It appears that on about July 8, 2026 the BZip2 1.1 development repository was archived with the message:

BZip2/libbz2 is a program and library for lossless, block-sorting data compression. This fork for v1.1+ development is has been archived due to lack of interest, and because there are better options available through the Rust ecosystem.

and further discussion. This Gitlab repo was linked from the original SourceWare BZip2 page.

List all GitHub public repositories for a user

A simple one-liner method to list all the public repositories for a GitHub user using the GitHub API and curl is below.

Note that as shown, without giving an API token, the query will be rate limited. The JSON array will be empty if the user profile is private or if the user has no public repositories:

GitHub:

curl -s -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2026-03-10" https://api.github.com/users/USERNAME/repos
USERNAME
replace with the GitHub username of interest.

GitLab:

curl -s https://gitlab.com/api/v4/users/USERNAME/projects

Fortran compiler standard enforce

Fortran compilers typically have options for enforcing Fortran standards. The compilers raise additional warnings or errors for code that is not deemed compliant. Fortran standard options can make false warnings, so we generally do not enable standards checking for user defaults. However, we do enforce implicit none as a quality measure.

It’s also important to use implicit none so that each variable must be assigned beforehand. We recommend the Fortran 2018 statement:

implicit none (type, external)

which requires explicitly defined procedure interfaces as well.

type
the traditional implicit none default
external
new for Fortran 2018, requires explicit interface for external procedures.

GCC Gfortran -std=f2018 enforces Fortran 2018 standard. Consider these Gfortran options:

gfortran -fimplicit-none

LLVM Flang similarly uses -std=f2018 and similar, as well as:

flang -fimplicit-none

Intel oneAPI -stand:f18 enforces Fortran 2018 standard. Consider these options that also enforce implicit none:

ifx -warn:declarations

Cray Fortran compiler enforces implicit none via option:

ftn -eI

note that’s a capital “I” not a lowercase “ell”.

Nvidia HPC Fortran compiler enforces implicit none via:

nvfortran -Mdclchk

NAG Fortran has -f2018 Fortran 2018 flag. Enforce implicit none by:

nagfor -u

CMake logic to enforce these standards:

if(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-eI>")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LLVMFlang")
  add_compile_options(-Wall "$<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none>")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-warn:declarations>")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-Mdclchk>")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
  add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-u>")
endif()