From 7abb864cba9ffed86c2081509d538ce634f23a8d Mon Sep 17 00:00:00 2001 From: MoBit Date: Fri, 19 Nov 2021 01:21:41 +0100 Subject: [PATCH] turbo --- Project.toml | 1 + src/Particle.jl | 4 +++- src/ReCo.jl | 1 + src/data.jl | 2 +- src/simulation.jl | 4 ++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 6fa132c..53a08f7 100644 --- a/Project.toml +++ b/Project.toml @@ -7,6 +7,7 @@ JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" +LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" diff --git a/src/Particle.jl b/src/Particle.jl index 0e04dcf..6563d3c 100644 --- a/src/Particle.jl +++ b/src/Particle.jl @@ -55,7 +55,9 @@ function are_overlapping(p1::Particle, p2::Particle, overlapping_r²::Float64, l end function update!(p::Particle) - @simd for i in 1:2 + @turbo for i in 1:2 p.c[i] = p.tmp_c[i] end + + return nothing end diff --git a/src/ReCo.jl b/src/ReCo.jl index dadb265..e8927bb 100644 --- a/src/ReCo.jl +++ b/src/ReCo.jl @@ -5,6 +5,7 @@ using Random, Distributions using ProgressMeter using GLMakie, ColorSchemes, LaTeXStrings using StaticArrays +using LoopVectorization: @turbo, @tturbo using JLD2: JLD2 using JSON3: JSON3 diff --git a/src/data.jl b/src/data.jl index e8ea479..61db8b9 100644 --- a/src/data.jl +++ b/src/data.jl @@ -20,7 +20,7 @@ function save_frame!(sol, frame, t, particles) pre_pos = sol.center[p_id, frame] - @simd for i in 1:2 + @turbo for i in 1:2 pre_pos[i] = p.c[i] end diff --git a/src/simulation.jl b/src/simulation.jl index 7048278..c387cdb 100644 --- a/src/simulation.jl +++ b/src/simulation.jl @@ -36,7 +36,7 @@ function euler!(args) if overlapping c = args.c₁ / (distance²^4) * (args.c₂ / (distance²^3) - 1) - @simd for k in 1:2 + @turbo for k in 1:2 dck = c * r⃗₁₂[k] p.tmp_c[k] -= dck @@ -49,7 +49,7 @@ function euler!(args) @simd for p in args.particles e = SVector(cos(p.φ), sin(p.φ)) - @simd for i in 1:2 + @turbo for i in 1:2 p.tmp_c[i] += args.vδt * e[i] + args.c₃ * rand_normal01() end