GitHub Pages is noticeably easier to use than GitLab or
GitLab runners are slow and build quota can run out before month’s end.
Most should start with GitHub Pages for websites of any size.
Create Jekyll website
Minimal Mistakes Jekyll template
is one of numerous quick-loading Jekyll templates.
Forget about AMP, get lightning-fast mobile browsing Google PageSpeed scores with Jekyll and Minimal Mistakes.
This procedure is based on Linux (including Windows Subsystem for Linux).
Now your page should be live at username.github.io.
See Github Pages
for custom domains and advanced configs.
Writing blog posts
Folders under _posts with filenames starting with date appear on the site.
Subfolders under _posts are transparently processed.
This is useful to organize posts by year for example, without affecting URL formatting.
Example filename: _posts/2018/2018-09-23-joes-big-vacation.md
appears to the public with URL: https://username.github.io/joes-big-vacation
Jekyll Format tip
These tips are based on the Minimal Mistakes Jekyll theme
Enable search icon
This enables site-wide
instant search as the user types.
The search icon is at the upper right corner of the toolbar on top of every page/post.
It’s much better/faster than Google-based search of your site!
This instant as-you-type search scales well for sites with thousands of pages.
remove default “layout: post” from migrated posts
This is useful for the default layout: single in _config.yml below.
sed -i '/layout: post/d' *.html
static nav buttons
copy/paste into _config.yml these lines (anywhere in file):
The site is now building as seen with the Pipelines tab of your website project. It takes about 3-4 minutes to install the gems for a Jekyll site, then 2-3 more minutes to complete the build depending on the size of your website. The public URL should be username.gitlab.io.
If a custom domain was purchased, tie to GitLab Pages by:
Project Settings → Pages add TWO new domains
transfer DNS to GitLab
This step can take the website down so do this at low traffic times.
GitLab Pages used with for example Cloudflare works well to provide HTTPS with your custom domain name as per this
With that procedure you can enable SSL “Full (Strict)” security.
Free GitLab accounts have a
for build “pipeline” time.
For a small to moderate size static website it should be enough.
Save quota by canceling pipelines / runs for wasted builds.
For frequently updated, medium sized websites (hundreds or thousands of pages) consider
with GitLab Pages or GitHub Pages.
Private source repo
Both GitLab and GitHub allow the source files (e.g. Markdown) to be private for a public website.
Consider a private website repo, otherwise Google may present search results from Markdown code before the actual webpage.
For larger or active websites use Netlify, or build on laptop or cloud service like Wercker with any static generator such as Hugo and push HTML to GitHub Pages
Useful Jekyll plugins that GitHub doesn’t allow include jekyll-archives (page per category/tag)
The Fitbit app on certain phones with certain devices can sometimes fail to sync.
This might happen a couple times a month.
To workaround this issue, try force stopping the Fitbit app.
This normally shouldn’t lose any data, and reopening the Fitbit app and dragging down should re-sync in a few seconds.
Also, check that Bluetooth is enabled on the Android device.
Force stop Android app
Force stop an Android app by:
Settings → Apps and Notification → Sell all apps → scroll to app name and click → click Force Stop
In general it is not appropriate to assume the default shell is
Using a generic script
use the default shell (which could be one of many shells)
invoke legacy Bourne Shell 1980s compatibility mode of your shell
Either way, a shell script using the general #!/bin/sh may fail on other computers.
To improve shell script robustness, specify a particular shell with the shebang.
Many Linux distros default to shells like:
Similar to Linux, CMake on Windows is installed by extracting the cmake*-win64-x64.zip.zip file
and adding the new …/bin to PATH environment variable.
We use the
Ninja build system with CMake,
which is generally faster on any platform and in particular for Windows solves numerous issues.
Compile programs using CMake
Navigate to the directory containing the file CMakeLists.txt using the Windows Terminal / Command Prompt.
configure the build. This is normally run only once unless making major project changes.
cmake -B build
compile the program. This is the command run each time you make a change to the project code.
cmake --build build
Optionally, install the program with
cmake --install build
On Windows, CMake defaults to Visual Studio and Nmake–the CMAKE_GENERATOR environment variable suggested above overrides CMake defaults.
CMAKE_GENERATOR can also be overridden like:
cmake -G "Visual Studio 16 2019"
sh.exe error with cmake
This error is fixed by upgrading to CMake ≥ 3.17.
sh.exe was found in your PATH, here:
For MinGW make to work correctly sh.exe must NOT be in your path.
Run cmake from a shell that does not have sh.exe in your PATH.
If you want to use a UNIX shell, then use MSYS Makefile
Matlab requires C / C++ / Fortran compilers for numerous operations such as mex, loadlibrary and more.
For Windows, besides Visual Studio,
Matlab supported compilers
include MinGW GNU compilers for Windows for C and C++, or Intel oneAPI compilers for C / C++ / Fortran.
If Matlab doesn’t detect MinGW compiler location, you may get an error like
Error in loadlibrary>getLoadLibraryCompilerConfiguration
Error using mex
No supported compiler was found.
Tell Matlab compiler location
Matlab uses distinct environment variables to communicate the location of specific compiler versions.
Here are a couple examples.
On Windows, Matlab will use Visual Studio and Intel oneAPI compilers.
Tell Matlab the MinGW compiler path via Windows environment variable MW_MINGW_LOC.
On Windows, Fortran needs Intel oneAPI compiler instead.
Find the MinGW compiler location from Terminal using where gcc (Windows) or which gcc.
in Matlab, assuming MinGW is under C:\mingw64\bin (don’t include “bin” below)
Setup MEX C / C++ permanently
mex -setup -vmex -setup -v C++
Intel oneAPI Fortran compiler with Matlab is setup by:
mex -setup Fortran -vmex -setup -v
If the Intel oneAPI compilers are not found:
find the Intel compiler location using where ifort (Windows) or which ifort.
assuming compiler location is at “C:\Program Files (x86)\inteloneapi\compiler\latest\windows\bin\intel64\ifort.exe”
Matlab users can package code projects as toolboxes and/or packages.
The packages format works for ancient versions of Matlab, before even R2006a as well as GNU Octave.
The toolbox format works for Matlab ≥ R2016a and not GNU Octave.
The packages format brings benefits to toolboxes as well.
A key issue with Matlab vs. Python arise from that Matlab users often add many paths for their project.
If any function names clash, there can be unexpected behavior as it’s not immediately clear which function is being used without further investigation of path ordering.
As in Python and other languages, there is considerable benefit for using a package format where the function names are specified in their namespace.
To enable Matlab package format, we explain by example. Suppose a project directory structure is like:
To use these functions, the end users do:
This is where the namespace can have clashes, and with large projects it’s not clear where a function is without further introspection.
To make this project a Matlab / Octave package, change the subdirectories containing .m files to start with a “+” plus symbol:
Then multiple subdirectories can have the same function name without clashing in the Matlab namespace.
Support the function “mem1” is used frequently in another function.
To avoid typing the fully resolved function name each time, use the
Matlab .mltbx toolboxes became available in R2016a.
The Matlab-proprietary toolbox format also allows end users to create their own packages containing code, examples and even graphical Apps.
In effect .mltbx provides metadata and adds the package to the bottom of Matlab path upon installation.
The installation directory is under (system specific)/MathWorks/MATLAB Add-Ons/Toolboxes/packageName.
Whether or not the project uses .mltbx, the namespace of the project is kept cleaner by using a Matlab package layout.
On Windows, the Intel C, C++ and Fortran compilers present Visual Studio-like command line options.
correct version of Visual Studio
must be installed on Windows for Intel compilers to work.
C and C++ use the icl compiler on Windows.
Most users use the Intel oneAPI command prompt.
Alternatively, run “compilervars.bat” script to enable the Intel compilers for each session.
“psxevars.bat” is not appropriate for this setup.
For convenience, make a batch script like %userprofile%\intel.bat containing:
"C:\Program Files (x86)\inteloneapi\compiler\latest\windows\bin\compilervars.bat" intel64
Intel MPI on Windows is only for Intel compiler
Linux Intel MPI,
Windows Intel MPI is only for the Intel C, C++ and Fortran compilers and Visual Studio.
Although not often 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
the user credential in the Windows registry.
select rank – making assumed rank arguments actually useful.
added random_init() to initialize the random generator seed…randomly
Optimization: automatic nested loop exchange with do concurrent
Checks: Actual argument array with too few elements for dummy argument now errors
Polymorphism: initial support for parameterized derived types (simply define kind at initialization)
Coarray: Initial support for teams
(Gfortran 8.2 and 8.3 did not introduce new Fortran features)
std=f2008ts deprecated, do not use as it errors on compiling error stop for Gfortran < 8.
Polymorphism: derived type IO select type etc. fully supported from Fortran 2003.
Fortran 2018: Non-constant stop and error stop codes
Compatibility: -fdec- options help compiling very old non-standard code that was previously only compatible with Intel oneAPI (of DEC heritage).
Fortran 2008: submodule support, useful for large projects to save compilation time and allow powerful use scenarios
Fortran 2003: improved support for deferred-length character.
These are very useful for avoiding bothersome trim() everywhere.
character(256) :: argv
character(:), allocatable:: filename
call get_command_argument(1, argv)
filename = trim(argv)
In this example, filename is now exactly the length required to fit the text.
If the filename (in argv) was “hello.txt” then len(filename) is 9.
That is, len_trim == len with auto-allocated characters (unless subsequently rewritten with a shorter string).
Practical examples are in gitrev.f90 and split_string.f90.
For split_string.f90, note that this is the proper way to avoid assumed-length character functions, which are obsolete as of Fortran 95.
! don't do this!
character(*) function myfun(a)
pure function myfun(a)
character(:), allocatable:: myfun
OpenMP 4.0 fully supported
Fortran 2003: ieee_ intrinsics supported, allowing convenient standard-compliant use of nan, ieee_is_nan, etc.
CMake allows switching parameters based on compiler version.
This is very useful for modern Fortran programs.
Example CMakeLists.txt for Fortran compiler version dependent options.
if(CMAKE_Fortran_COMPILER_IDSTREQUALGNU)# option applying to any language for this compiler
add_compile_options(-mtune=native)# language-specific, note LEADING space
string(APPENDCMAKE_Fortran_FLAGS" -fimplicit-none") if(CMAKE_Fortran_COMPILER_VERSIONVERSION_GREATER_EQUAL8) string(APPENDCMAKE_Fortran_FLAGS" -std=f2018") endif()endif()add_executable(myprogmain.f90)
Non-Fortran 2018 workaround
Here we assume that assert.f90 contains error stop in a procedure that’s called from a pure procedure.
Existing toolchains such as CMake and Meson can immediately use HPC SDK by setting environment variables:
first ensuring the HPC SDK bin/ directory is on PATH.
Nvidia HPC binaries can offer speed improvements over GNU GCC / GFortran, but Intel oneAPI binaries can be significantly faster than Nvidia-compiled binaries for CPU-only workloads.
Unless one specifically needs the GPU features of Nvidia HPC SDK consider GNU or Intel oneAPI that have more modern Fortran features.
Nvidia HPC compilers are currently available for Linux, with language standard support:
Fortran 2003, with some Fortran 2008 including submodule and error stop