- MSR modification may void your CPU's (or system board's) warranty. Proceed with care. I'm not responsible for any destruction caused by this article.
- MSR address (greatly) differs from CPU to CPU. Check your own CPU's MSR address using Intel's documentation.
- Only tested on Intel i7-8550U (Kaby Lake R).
- This article is translation of this article. If you can understand Korean, I recommend reading that article, not this.
from urllib.parse import urlsplit | |
from tornado import gen | |
from tornado.escape import url_escape | |
from tornado.httputil import url_concat | |
from traitlets import ( | |
Unicode, Integer, Dict, TraitError, List, Bool, Any, | |
Type, Set, Instance, Bytes, Float, | |
observe, default, |
This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).
Matrix multiplication is a mathematical operation that defines the product of
# Reverse-mode automatic differentiation | |
import math | |
# d(-x) = -dx | |
def func_neg(x): | |
return -x, [-1] | |
# d(x + y) = dx + dy | |
def func_add(x, y): |
import operator | |
import inspect | |
import pytest | |
def getattribute(obj, name): | |
return object.__getattribute__(obj, name) | |
def setattribute(obj, name, value): | |
object.__setattr__(obj, name, value) |
import numpy as np | |
def pearson_r(x: np.ndarray, y: np.ndarray) -> np.ndarray: | |
n = len(x) | |
return (n * x @ y - x.sum() * y.sum()) / np.sqrt( | |
(n * (x @ x) - x.sum() ** 2) * (n * (y @ y) - y.sum() ** 2) | |
) | |
def lstsq_1d( |
# Use F1 as modifier | |
unbind C-b | |
set -g prefix F1 | |
bind F1 send-prefix | |
# split panes using h and b | |
bind h split-window -h | |
bind v split-window -v | |
unbind '"' |
#!/usr/bin/python3 | |
# Originally from from Mark Slater 29/11/16 | |
# Modified for per-user name mapping by Mark Colclough, 28 July 2017 | |
# Modified to suppress SystemExit exception by Angus Hollands, 3 Dec 2019 | |
# Install as /usr/lib/cups/backend/safeq | |
# Configure a safeq backend in CUPS (lpinfo -v should show it) | |
# URL/Connection: safeq://localhost (direct) | |
# PPD: Generic PostScript Printer Foomatic/Postscript |
When implementing development environments inside a container, usually I want to:
- Run as non-root inside the container (many tools do not like being run as root).
- Behave as the non-root user executing the container when reading/writing from mounted volumes
There are some additional (small) security benefits from running as non-root inside a container.
The solution to these problems is complicated by the way that different container runtimes behave:
Across the different container runtimes, there is often a flag such as userns=keep-id
that maps the UID:GID of the host to the container. Linux creates users by default with UID 1000, so default non-root users will often map directly to host UID.