This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using SIMD | |
using BenchmarkTools | |
using Test | |
struct Rot{T} | |
c::T | |
s::T | |
end | |
mul(G::Rot, a, b) = (G.c * a + G.s * b, -G.s * a + G.c * b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Base: getindex, setindex, length, isless | |
struct SortPair{A,B} | |
x::A | |
mapped::B | |
end | |
struct SortCache{A,B,AV,BV} <: AbstractVector{SortPair{A,B}} | |
xs::AV | |
mapped::BV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function concat_and_crop(mx::AbstractArray{T,4}, x::AbstractArray{T,4}) where T | |
w, h = size(x) | |
mw, mh = size(mx) | |
rx = (1:mw) .+ ((w - mw) ÷ 2) | |
ry = (1:mh) .+ ((h - mh) ÷ 2) | |
return cat(x[rx, ry, :, :], mx, dims = 3) | |
end | |
create_model_2d_classes() = Chain( | |
BatchNorm(1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 AS builder | |
SHELL ["/bin/bash", "-c"] | |
WORKDIR /development | |
RUN apt-get update && apt-get install --no-install-recommends -y \ | |
build-essential \ | |
curl \ | |
file \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PrimeMonstrosity | |
const bit_1 = ~(0x01 << 7) | |
const bit_2 = ~(0x01 << 6) | |
const bit_3 = ~(0x01 << 5) | |
const bit_4 = ~(0x01 << 4) | |
const bit_5 = ~(0x01 << 3) | |
const bit_6 = ~(0x01 << 2) | |
const bit_7 = ~(0x01 << 1) | |
const bit_8 = ~(0x01 << 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bluetooth monitor ver 5.50 | |
= Note: Linux version 5.0.0-25-generic (x86_64) 0.401834 | |
= Note: Bluetooth subsystem version 2.22 0.401835 | |
= New Index: 80:C5:F2:F8:D6:54 (Primary,USB,hci0) [hci0] 0.401836 | |
@ MGMT Open: btmon (privileged) version 1.14 {0x0001} 0.401851 | |
= bluetoothd: Bluetooth daemon 5.50 3.341004 | |
@ MGMT Open: bluetoothd (privileged) version 1.14 {0x0002} 3.342105 | |
= bluetoothd: Starting SDP server 3.342212 | |
= bluetoothd: Excluding (cli) wiimote 3.342323 | |
@ MGMT Command: Read Management Version In.. (0x0001) plen 0 {0x0002} 3.343725 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <tuple> | |
using namespace std; | |
// Some instances of events; we're using "public" const data members. | |
struct UsernameChanged { | |
string const username; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Computes y <- alpha * A * x + beta * y for tall and skinny A. | |
// Compile with `nvcc -O3 -o cerfacs cerfacs.cu` | |
// Assumes we have a *large* basis of COLS = 100 columns, you can play with this param | |
// Timing is measured without copies from / to device (copies should not happen in a good impl of arnoldi anyways) | |
// Assumes a fixed number of 256 threads per block. | |
#include <stdio.h> | |
#include <sys/time.h> | |
#define COLS 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is the implementation currently in SparseArrays | |
""" | |
function simple_mul!(y, A, x) | |
@inbounds for i = Base.OneTo(A.n) | |
xi = x[i] | |
for j = A.colptr[i] : A.colptr[i + 1] - 1 | |
y[A.rowval[j]] += A.nzval[j] * xi | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <cmath> | |
// g++ -Wall -O3 -std=c++14 -march=native -fPIC -shared -o givenlib.so micro.cc | |
extern "C" { | |
void fused_horizontal(double * __restrict__ A, int64_t cols, double c1, double s1, double c2, double s2, double c3, double s3, double c4, double s4) | |
{ | |
for (int64_t col = 0; col < cols; ++col, A += 4) | |
{ |