Skip to content

Instantly share code, notes, and snippets.

using LinearAlgebra, LoopVectorization, Test
function f1(M, G, J, H, A, B, ϕ)
for mm = 1:M
tempmatr = A \ (
reshape(
permutedims(
ϕ[:, 2:G, :, M + 2 - mm],
[2 1 3]),
G - 1, :)
using TensorOperations, BenchmarkTools
n = 20
Γ1 = rand(n, n, n);
Γ2 = rand(n, n, n);
f(Γ1, Γ2) = @tensor Γ[α, β, i, k] := Γ1[α, i, j] * Γ2[β, j, k]
function g(Γ1, Γ2)
n = size(Γ1, 1)
Γ = zeros(n, n, n, n)
### A Pluto.jl notebook ###
# v0.12.3
using Markdown
using InteractiveUtils
# ╔═╡ 99c1b230-0c05-11eb-2419-e33927196b61
md"""
``
### A Pluto.jl notebook ###
# v0.11.12
using Markdown
using InteractiveUtils
# ╔═╡ 40bb63d0-fd13-11ea-1996-6f1098e73e8f
using ModelingToolkit, NLsolve, RuntimeGeneratedFunctions, BenchmarkTools
# ╔═╡ ada7d960-fcff-11ea-3cf8-fddbf108a841
# start Julia with the JULIA_NUM_THREADS environment variable set appropriately
using QuadGK, Roots, ProgressMeter
brent(f::F, a, b) where {F} = find_zero(f, (a, b), Roots.Brent())
@fastmath function Φ(r,σ)
return (2/15*σ.^9*(1/(r-1)^9-1/(r+1)^9-9/8/r*(1/(r-1)^8-1/(r+1)^8))-
σ.^3*(1/(r-1)^3-1/(r+1)^3-3/2/r*(1/(r-1)^2-1/(r+1)^2)))
end
@stillyslalom
stillyslalom / avxryzen2.txt
Created August 4, 2020 02:04
LoopVectorization Ryzen2 benchmarks
julia> include("driver.jl")
WARNING: redefining constant COLORS
WARNING: redefining constant COLOR_MAP64
logdet(LowerTriangular(A)) benchmark results:
┌──────┬─────────────────────┬─────────────────────┬─────────────────────┬─────────────────────┬─────────────────────┬─────────────────────┬─────────────────────┐
│ Size │ LoopVectorization │ Julia │ Clang │ GFortran │ icc │ ifort │ LinearAlgebra │
├──────┼─────────────────────┼─────────────────────┼─────────────────────┼─────────────────────┼─────────────────────┼─────────────────────┼─────────────────────┤
│ 256 │ 0.355850622406639 │ 0.12190476190476192 │ 0.2115702479338843 │ 0.33668934240362813 │ 0.1532934131736527 │ 0.1532934131736527 │ 0.15609756097560976 │
│ 252 │ 0.36979591836734704 │ 0.1272727272727273 │ 0.21000000000000005 │ 0.3348837209302326 │ 0.15365853658536588 │ 0.15272727272727274 │ 0.15849056603773587 │
│ 250 │ 0.3869606003752346 │ 0.12626262626262627 │ 0.20
@stillyslalom
stillyslalom / readcine.jl
Last active October 10, 2018 18:32
Grayscale cine file reader
using ImageCore: N0f8, N4f12, Gray
using ProgressMeter: @showprogress
using DataStructures: OrderedDict
function cineheader(fname)
h = OrderedDict()
open(fname) do f
# Check magic number
read(f, UInt16) == UInt(18755) || error(basename(fname), " is not a .cine file")
using Plots
function test_push(n)
A = [1]
tic()
for i = 1:n
push!(A,1)
end
toc()
end
@stillyslalom
stillyslalom / test.jl
Last active November 15, 2015 06:20
Meshgrid vs. array broadcasting
using Plots
meshgrid(x,y) = (repmat(x',length(y),1),repmat(y,1,length(x)))
function test_meshgrid(n)
n = Int(n)
x = linspace(0,2pi,n); y = x
ret = zeros(n,n)
tic()
X, Y = meshgrid(x,y)