julia --project=. -e "using Pkg; pkg"add RadeonProRender#sd/moah GeometryBasics [email protected]"
executed with:
julia --project=. --check-bounds=(yes|no) rpr_mwe.jl
Diff of the llvm code: https://www.diffchecker.com/chE5Jtim
ARG IMAGE=nvidia/cuda:12.1.1-devel-ubuntu22.04 | |
FROM $IMAGE | |
ARG JULIA_RELEASE=1.9 | |
ARG JULIA_VERSION=1.9.4 | |
# julia | |
RUN apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive \ |
using Preferences | |
for uuid in ["ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a", "e9467ef8-e4e7-5192-8a1a-b1aee30e663a", | |
"276b4fcb-3e11-5398-bf8b-a0c2d153d008", "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"] | |
set_preferences!(Base.UUID(uuid), "precompile_workload" => false; force=true) | |
end |
# Super simple SIMD implementation for Complex Numbers | |
struct ComplexSIMD{N,T} | |
re::NTuple{N,T} | |
im::NTuple{N,T} | |
end | |
Base.abs2(z::ComplexSIMD) = z.re .* z.re .+ z.im .* z.im | |
Base.:(*)(a::ComplexSIMD, b::ComplexSIMD) = ComplexSIMD(a.re .* b.re .- a.im .* b.im, a.re .* b.im .+ a.im .* b.re) | |
Base.:(+)(a::ComplexSIMD, b::ComplexSIMD) = ComplexSIMD(a.re .+ b.re, a.im .+ b.im) | |
function mandelbrot_kernel(c::ComplexSIMD{N,T}) where {N,T} |
using Mmap, TextParse | |
using TextParse: Record, Field, Numeric, tryparsenext, isnull | |
struct MMapString{T} <: AbstractVector{Char} | |
x::T | |
end | |
MMapString(path::String) = MMapString(Mmap.mmap(open(path), Vector{UInt8})) | |
# we only need to overload the iteration protocol for TextParse to work! | |
Base.Base.@propagate_inbounds Base.getindex(x::MMapString, i) = Char(x.x[i]) | |
Base.Base.@propagate_inbounds function Base.iterate(x::MMapString, state...) |
julia --project=. -e "using Pkg; pkg"add RadeonProRender#sd/moah GeometryBasics [email protected]"
executed with:
julia --project=. --check-bounds=(yes|no) rpr_mwe.jl
Diff of the llvm code: https://www.diffchecker.com/chE5Jtim
using FFMPEG | |
function save(src::String, out::String; | |
framerate::Int = 24, compression = 20) | |
typ = splitext(out)[2] | |
mktempdir() do dir | |
if typ == ".mp4" | |
ffmpeg_exe(`-i $(src) -crf $compression -c:v libx264 -preset slow -r $framerate -pix_fmt yuv420p -c:a libvo_aacenc -b:a 128k -y $out`) | |
elseif typ == ".webm" | |
ffmpeg_exe(`-i $(src) -crf $compression -c:v libvpx-vp9 -threads 16 -b:v 2000k -c:a libvorbis -threads 16 -r $framerate -vf scale=iw:ih -y $out`) | |
elseif typ == ".gif" |
using StructArrays | |
using BenchmarkTools | |
using LoopVectorization | |
function juliaset2(re, im, c, maxiter) | |
result = re % UInt8 | |
for i in 1:maxiter | |
abs = re*re + im*im | |
mask = abs > 4f0 | |
result = mask & ((i - 1) % UInt8) |
using Hyperscript, Markdown | |
using JSServe, Observables | |
using JSServe: Session, evaljs, linkjs, div, active_sessions | |
using JSServe: @js_str, onjs, Button, TextField, Slider, JSString, Dependency, Asset | |
using WGLMakie, AbstractPlotting | |
markdown_css = Asset(JSServe.dependency_path("markdown.css")) | |
function test_handler(session, req) | |
button = Button("click") |
export play | |
""" | |
play(img, timedim, t) | |
Slice a 3D array along axis `timedim` at time `t`. | |
This can be used to treat a 3D array like a video and create an image stream from it. | |
""" | |
function play(array::Array{T, 3}, timedim::Integer, t::Integer) where T | |
index = ntuple(dim-> dim == timedim ? t : Colon(), Val(3)) |
using Makie, GeometryTypes | |
points = decompose(Point2f0, Circle(Point2f0(0), 1f0)) | |
points[1] ≈ points[end] # first and last are the same, so they will get removed | |
# lets remove it ourselves, so that we can more easily map over it! | |
pop!(points) | |
mesh = GLNormalMesh(points) | |
# Visualize poly | |
scene = Makie.mesh(mesh, shading = false) | |
mplot = scene[end] | |
# Points get converted to 3d + get one end point |