Skip to content

Instantly share code, notes, and snippets.

View ptheywood's full-sized avatar

Peter Heywood ptheywood

View GitHub Profile
@ptheywood
ptheywood / CUB-1.5.0-CUDA-11.6.log
Created January 18, 2022 10:43
GitHub Actions Runner log for CUB 1.5.0 Windows.h error, with CUB 1.5.0 and CUDA 11.6 https://github.com/ptheywood/cub-1.15-windows.h-demo/runs/4851931940?check_suite_focus=true
2022-01-18T10:35:37.2325348Z Found online and idle hosted runner in the current repository's organization account that matches the required labels: 'windows-2019'
2022-01-18T10:35:37.3729653Z Waiting for a Hosted runner in the 'organization' to pick this job...
2022-01-18T10:35:37.9295304Z Job is waiting for a hosted runner to come online.
2022-01-18T10:35:44.3060532Z Job is about to start running on the hosted runner: GitHub Actions 12 (hosted)
2022-01-18T10:35:48.2924904Z Current runner version: '2.286.0'
2022-01-18T10:35:48.2953129Z ##[group]Operating System
2022-01-18T10:35:48.2953683Z Microsoft Windows Server 2019
2022-01-18T10:35:48.2953983Z 10.0.17763
2022-01-18T10:35:48.2954228Z Datacenter
2022-01-18T10:35:48.2954526Z ##[endgroup]
@ptheywood
ptheywood / fix-nm-fortisslvpn-21.04.md
Last active December 8, 2021 11:40
Probably partial instructions for fixing network-manager-fortisslvpn peer dns on ubuntu 21.04

Fortisslvpn in ubuntu 21.04 (and some earlier versions) does not peer dns correctly since a fortivpn update changed a default parameter. The ubuntu package has not been patched in 2+ years.

The best way to fix this so far, is to manually build a patched .deb to install. These instructions are crude and may be missing dependencies.

@todo - It would be better to alter the package version info so it is newer than that provided by apt repos to avoid needing to hold the package back

  1. Modify /etc/apt/sources.list, uncommenting the line deb-src http://gb.archive.ubuntu.com/ubuntu/ hirsute universe or equivalent
  2. sudo apt-get update
  3. Make and change to a temporary directory. mkdir -p /tmp/fortisslvpn && cd /tmp/fortisslvpn
@ptheywood
ptheywood / cat-and-scale-pdfs.shq
Created July 30, 2019 14:31
Combine 2 PDFS of (potentially) different scales
#! /bin/bash
A="a.pdf"
B="b.pdf"
DATE=$(date '+%Y-%m-%d')
OUTFILE="combined-$DATE.pdf"
# Get the page size from each pdf A and B
@ptheywood
ptheywood / compress-pdf.py
Created July 1, 2019 12:20
Ghostcript compressionutility of PDF through python.
#!/usr/bin/python3
"""
Python script to compress PDF files using ghostscript.
@author Peter Heywood
"""
import os
import subprocess
import argparse

Regular expression to validate 1-4 comma separated c++ decimal values

([+-]?((([1-9][0-9]*|0))|((([0-9]+[eE][+-]?[0-9]+)|((([0-9]+\.)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))[Ff]?)))(([ ]*,[ ]*)[+-]?(([1-9][0-9]*)|((([0-9]+[eE][+-]?[0-9]+)|((([0-9]+\.)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))[Ff]?))){0,3}

For regex engines othern than XSD schema, wrap with ^...$ to match the full string

i.e.

# Fixing Nvidia 4.18+ Profiling on Ubuntu 19.04
1. Set module parmeter
```
echo 'options nvidia "NVreg_RestrictProfilingToAdminUsers=0"' | sudo tee -a /etc/modprobe.d/nvidia.conf
```
2. Rebuild intramfs.
@ptheywood
ptheywood / selectCUDADevices.sh
Last active June 19, 2020 10:06
Select the cuda device which is being least-utilised. in a system.
#! /bin/bash
# As of 2020-06-19 this is no longer required for University of Sheffield HPC systems usign SGE (Iceberg or ShARC).
# The SGE GPU allocation process has been improved to limit the devices available.
# If you request one Device, your session can now only see one device, instead of all available.
# Outputs the number of GPUs requested by an SGE job.
function getSGERequestedGPUCount {
export PATH="$SGE_ROOT/bin/lx-amd64/:$PATH"
function activate_cuda(){
if [ $# -ne 1 ] ; then
echo "Usage: active_cuda <version>"
echo " i.e. activate_cuda 8.0"
else
CUDA_VER=$1
CUDA_SRC="/usr/local/cuda-$CUDA_VER"
CUDA_DST="/usr/local/cuda"
if [ -d "$CUDA_SRC" ]; then
echo "Activating CUDA $CUDA_VER intalled at $CUDA_SRC"

FLAME GPU

http://www.flamegpu.com

Current version: 1.5.0 for CUDA 8.0

FLAME GPU (Flexible Large-scale Agent Modelling Environment for Graphics Processing Units) is @todo high level description.

Documentation