Skype on Linux beta capabilities

Skype for Linux

Skype for Linux has feature-parity with Windows & Mac.

Download Skype Beta for Linux and install:

gdebi skypeforlinux-64-insider.deb

Skype for Linux features

Skype for Linux, Windows and Mac have the same featureset, including:

featurein Skype for Linux
group videoyes
group text chatyes
group audioyes
share Linux screen/view others screenyes
auto answeryes
call landline/mobile phonesyes

HTML5 client

An alternative to installing the full desktop/mobile Skype program is simply browsing to https://web.skype.com.

Reference

Skype Linux Microsoft forum

Convert animated GIF to PNG stack

Convert animated GIF to PNG stack using ImageMagick by:

convert in.gif out_%04.png

where 04 is governed by the number of images in the GIF–04 accommodates up to 10000 images.

Notes

GIFs are not a great format for science image data, because the palette is compressed to 8-bit (256 colors). For plotting reduced data, GIFs can be fine.

Windows native Meld diff

Git users often use Meld to resolve differences, three-way or two-way, graphically. Meld is also easily used with Git from Windows.

  1. Download/install Meld for Windows.
  2. Download/install Git for Windows.

type at Command Prompt:

git config --global diff.tool meld
git config --global merge.tool meld

git config --global mergetool.meld.path "C:\\Program Files (x86)\\meld\\Meld.exe"

OR add to ~/.gitconfig:

[diff]
	tool = meld
[merge]
	tool = meld
[mergetool "meld"]
	path = "C:\\Program Files (x86)\\meld\\Meld.exe"

Notes

  • Do not use %PROGRAMFILES(X86)% as this doesn’t work from PowerShell.

Intel MPI on Windows

Compiling with Intel compilers on Windows is a distinctive task from MacOS or Linux. The Intel C, C++ and Fortran compilers masquerade as Visual Studio compilers, especially in their command line options. The correct version of Visual Studio must be installed on Windows for Intel compilers to work. For the Intel Fortran compiler on Windows, the build options one normally uses for Intel Fortran on MacOS and Linux do not work, and even error out the compiler. For C and C++, one must use the icl compiler (there is no icc or icpc on Windows) as if it were MSVC. That can be perplexing at first for those not coming from the MSVC world. The scientific computing world and most software engineering tasks not originating in the Microsoft domain use GCC-like compilers, which have completely different sets of compiler options.

Prereqs

You must have the Intel Parallel Studio with Cluster options installed for C/C++ and Fortran. Additionally, you must have the Intel MPI library installed to get the compiler wrappers necessary for most uses. CMake and Meson may not recognize Intel MPI without the Intel MPI compiler wrapppers. Then you will have the Intel MPI compiler wrappers.

Loading Intel compiler environment

It’s important that you load the compilervars.bat script to enable the Intel compilers for each session and NOT the psxevars.bat. For convenience, make a batch script like %userprofile%\intel.bat containing:

C:\"Program Files (x86)"\IntelSWTools\parallel_studio_xe_2019\compilers_and_libraries_2019\windows\bin\compilervars.bat intel64`

set FC=ifort
set CC=icl
set CXX=icl

MPI

Another distinctive feature of using MPI on Windows is that a username and password are required, even on a simple standalone laptop. Good security practices may include creating a separate unprivileged user account that is only used for MPI jobs. If this is suitable for your security environment, run MPI jobs in that other user account by from Command Prompt:

runas /user:mympiusername cmd

This opens a new Command Prompt window. The environment variables are not passed to this new windows, so you may need to run Intel compilervars.bat again.

You can register the user credential into the Windows registry, if appropriate for your environment. If doing so, we would again urge to consider using a separate user account that’s only used for MPI runs.

If you don’t sign in, errors will be like:

Unable to manage jobs using credentials with a blank password. Please enter another account.

Intel MPI on Windows is only for Intel compiler

Unlike for Linux Intel MPI that may be used with:

  • GNU gcc and gfortran out of the box
  • PGI via $MKLROOT/../mpi/binding/intel-mpi-binding-kit.tar.gz

Windows Intel MPI is only for the Intel Fortran compiler and no other Fortran compiler at this time. For C/C++, WIndows Intel MPI supports Visual Studio and the Intel compilers only.

MPI 2008

Intel 19 MPI does not support use mpi_f08 the Fortran 2008 bindings. To keep compatibility with Intel MPI on Windows, at this time one would consider the legacy Fortran MPI interface:

use mpi

call mpi_init(ierr)

call mpi_finalize(ierr)

end program

The Fortran 77 include mpif.h should not be used in current Fortran programs as it breaks the fundamental Fortran 90 paradigm of modularity.

Softlink / Symbolic link in Windows NTFS

Softlinks are useful in any operating system to shorten long, complicated path names like C:/user/foo/data to just C:/data

Windows Command Prom

mklink LINK TARGET

For directories add the /d option

mklink /d LINK TARGET

Example

The default GNU Make filename in MinGW is mingw32-make.exe, but we’d rather type make:

cd C:\mingw\mingw64\bin

mklink make.exe mingw32-make.exe

Powershell

Powershell’s symlink creation syntax is more verbose:

New-Item -ItemType SymbolicLink -Path "Link" -Target "Target"

Example

cd C:\mingw\mingw64\bin

New-Item -ItemType SymbolicLink -Path "make.exe " -Target "mingw32-make.exe"

Notes

ln -s /media/myusbdrive/data ~/data

Notice that the order of target arguments are reversed between Windows and Linux.

Fix Spyder IDE not visible

Spyder IDE is a complex but usually stable Python program. When something goes wrong with Spyder, often the symptom is it simply won’t appear, maybe you’ll just get the splash logo. To totally reset Spyder (erasing all user preferences for Spyder), type in Terminal / Command Prompt:

spyder --reset

Normally, that fixes Spyder.

To diagnose further, start Spyder from Terminal instead of OS Start menu, it might give some hints.

CUDA, cuDNN and NCCL for Anaconda Python

In 2017, Anaconda Accelerate was discontinued. The GPU CUDA, cuDNN and NCCL functionality are accessed in a Numpy-like way from CuPy. CuPy also allows use of the GPU is a more low-level fashion as well.

Before starting GPU work in any programming language realize these general caveats:

  • I/O heavy workloads may make realizing GPU benefits more difficult
  • Consumer GPUs (GeForce) can be > 10x slower than workstation class (Tesla, Quadro)

Prereqs

You must have a discrete Nvidia GPU in your laptop or desktop. Check for existence of an Nvidia GPU in your computer by:

Linux

lspci | grep -i nvidia

a blank response means an Nvidia GPU is not detected.

Windows

dxdiag

Look under the “render” tab to see if an Nvidia GPU exists.

Install

  1. Determine the Compute Capability of your model GPU and install the correct CUDA Toolkit version.
  2. CuPy is installed distinctly depending on the CUDA Toolkit version installed on your computer.
  3. reboot or import cupy will fail with errors like:

AttributeError: type object ‘cupy.core.core.Indexer’ has no attribute ‘reduce_cython

Check CuPy

CuPy syntax is very similar to Numpy. There are a large set of CuPy functions relevant to many engineering and scientific computing tasks.

import cupy

dev = cupy.cuda.Device()
print('Compute Capability', dev.compute_capability)
print('GPU Memory', dev.mem_info)

The should return like:

Compute Capability 75

If you get error like

cupy.cuda.runtime.CUDARuntimeError: cudaErrorInsufficientDriver: CUDA driver version is insufficient for CUDA runtime version

This means the CUDA Toolkit version is expecting a newer Nvidia driver. The Nvidia driver can be updated via your standard Nvidia update program that was installed from the factory. “Table 1” of the CUDA Toolkit release notes gives the CUDA Toolkit required Driver Versions.

Examples

Notes

Alternatives to CuPy include Numba.cuda, which is a lower-level C-like CUDA interface from Python.

CUDA for Julia is provided in JuliaGPU.

Code cells in Python IDE

A code cell in popular Python IDEs including PyCharm and Spyder is created by line starting with # %%. This “code cell” is analogous to IPython code cells and Matlab code sections.

You will see like

import math

# %% user data
x = 3
y = 4
# %% main loop
for i in range(5):
    x += y

The code cells allow running sections of code in an IDE without the need to constantly set/unset breakpoints in the IDE. They also catch the eye of developers to delineate logical blocks of code in the algorithm.

We encourage the use of code cell syntax, even if you don’t use them in the IDE directly, as the IDE will highlight sections of code to visibly delineate these separate parts of the algorithm.

Install PGI free Fortran compiler

Related: Install Flang LLVM Fortran compiler


The PGI Community Edition compilers are a set of no-cost, non-open-source, high performance compilers for:

  • C pgcc
  • C++ pgc++
  • Fortran pgfortran including CUDA Fortran support.

Like Flang, PGI supports significant portions of modern Fortran 2008 / 2018 syntax.

Install

Download and install PGI Community Edition:

  • Linux / Mac: ~/.local/pgi sudo not required, but must be on symbolic-link-aware drive (not ExFAT)
  • Windows: d:\PGI (can be on any drive, including ExFAT). Requires Visual Studio as well.

This is over 2 GB download. You don’t need to install CUDA support unless you have and want to use a CUDA-capable GPU.

Linux / Mac

add to ~/.bashrc:

export PATH="$PATH:$HOME/.local/pgi/linux86-64/2019/bin/"

or whichever directory you find with

find $HOME/.local/pgi -name pgfortran

Open a new terminal to use PGI pgfortran pgcc pgc++

Windows

add to PATH (ensure pgfortran.exe is there):

d:\PGI\win64\2019\bin

Usage

Sadly, PGI 19.7 deprecated PGI debugger. PGI Java-based pgdbg graphical debugger was for Fortran, C and C++ and was in the no-cost Community Edition as well. The program to be debugged needs compile options -g -O0 to provide maximum debugging information.

Example with hello.f90:

  1. pgfortran -g hello.f90
  2. pgdbg a.out opened the graphical Fortran debugger.

If you don’t see code in the upper left of the graphical PGI debugger for your program, be sure you compiled the executable with -g -O0 options.

CMake

CMake ≥ 3.10 distinguishes between PGI and Flang compilers. Set compiler-specific options in CMakeLists.txt for various Fortran compilers like:

cmake_minimum_required (VERSION 3.10)
project(myproj Fortran)

if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
  if(WIN32)
    add_compile_options(/stand:f18 /warn:declarations)
  else()
    add_compile_options(-stand f18 -warn declarations)
  endif()
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) # gfortran
  add_compile_options(-fstd=f2018 -fimplicit-none)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
  add_compile_options(-Mdclchk)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Flang) # cmake >= 3.10

endif()

and then clear out your build directory and select the PGI compilers with

FC=pgfortran CC=pgcc CXX=pgc++ cmake ..

Meson

Meson ≥ 0.50 supports PGI and Flang compilers.

project('demo','fortran')

fc = meson.get_compiler('fortran')
if fc.get_id() == 'pgi'
  message('PGI compiler')
elif fc.get_id() == 'flang'
  message('Flang compiler')
endif

Aspell for Windows

The native Windows Aspell program was quite broken last time I tried it. Instead, use Aspell in Windows Command Prompt via Windows Subsystem for Linux.

Setup

From WSL Terminal:

apt install aspell

In Windows, create a file say in %userprofile%/scripts/aspell.bat and add %userprofile%/scripts to your Windows PATH.

file aspell.bat contains:

@echo off

bash -c "aspell check %1"

Usage

From Windows Command Prompt:

aspell myfile.txt

or

aspell path/to/myfile.txt

don’t use backslash \ in paths, only forward slash /