Skip to content

Instantly share code, notes, and snippets.

View ChrisRackauckas's full-sized avatar
🎯
Focusing

Christopher Rackauckas ChrisRackauckas

🎯
Focusing
View GitHub Profile
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> Pkg.add("DifferentialEquations")
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> using ODE
@ChrisRackauckas
ChrisRackauckas / addingTests.jl
Last active August 6, 2016 04:19
Adding timing tests
function addingTimings()
b = rand(35);
updateIdxs = [1:3;5;7;8;10:12;14:16;18:35]
dim1 = 40; dim2 = 16
k = Vector{Matrix{Float64}}(0)
for i in 1:35
push!(k,rand(dim1,dim2))
end
truesol = b[1]*k[1] + b[2]*k[2] + b[3]*k[3] + b[5]*k[5] + b[7]*k[7] + b[8]*k[8] + b[10]*k[10] + b[11]*k[11] + b[12]*k[12] + b[14]*k[14] + b[15]*k[15] + b[16]*k[16] + b[18]*k[18] + b[19]*k[19] + b[20]*k[20] + b[21]*k[21] + b[22]*k[22] + b[23]*k[23] + b[24]*k[24] + b[25]*k[25] + b[26]*k[26] + b[27]*k[27] + b[28]*k[28] + b[29]*k[29] + b[30]*k[30] + b[31]*k[31] + b[32]*k[32] + b[33]*k[33] + b[34]*k[34] + b[35]*k[35]
function testLoops()
b = rand(35);
updateIdxs = [1:3;5;7;8;10:12;14:16;18:35];
dim1 = 1000; const dim2 = 1000;
NUM_RUNS = 1;
k = Vector{Matrix{Float64}}(0);
for i in 1:35
push!(k,rand(dim1,dim2));
end
const truesol = b[1]*k[1] + b[2]*k[2] + b[3]*k[3] + b[5]*k[5] + b[7]*k[7] + b[8]*k[8] + b[10]*k[10] + b[11]*k[11] + b[12]*k[12] + b[14]*k[14] + b[15]*k[15] + b[16]*k[16] + b[18]*k[18] + b[19]*k[19] + b[20]*k[20] + b[21]*k[21] + b[22]*k[22] + b[23]*k[23] + b[24]*k[24] + b[25]*k[25] + b[26]*k[26] + b[27]*k[27] + b[28]*k[28] + b[29]*k[29] + b[30]*k[30] + b[31]*k[31] + b[32]*k[32] + b[33]*k[33] + b[34]*k[34] + b[35]*k[35];
function threadstest1{N}(A::Array{Float64},b::Vector{Float64},k::Vector{Array{Float64,N}})
@inbounds for i in eachindex(A)
A[i]+= sin(b[1]*k[1][i] + b[2]*k[2][i] + b[3]*k[3][i] + b[5]*k[5][i]) +
exp(b[7]*k[7][i] + b[8]*k[8][i] + b[10]*k[10][i] + b[11]*k[11][i]) +
erf(b[12]*k[12][i] + b[14]*k[14][i] + b[15]*k[15][i] + b[16]*k[16][i]) +
(b[18]*k[18][i] + b[19]*k[19][i] + b[20]*k[20][i] + b[21]*k[21][i]) +
(b[22]*k[22][i] + b[23]*k[23][i] + b[24]*k[24][i] + b[25]*k[25][i]) +
(b[26]*k[26][i] + b[27]*k[27][i] + b[28]*k[28][i] + b[29]*k[29][i]) +
(b[30]*k[30][i] + b[31]*k[31][i] + b[32]*k[32][i] + b[33]*k[33][i]) +
(b[34]*k[34][i] + b[35]*k[35][i])
julia> @code_llvm threadstest1(A,b,k)
define %jl_value_t* @julia_threadstest1_69052(%jl_value_t*, %jl_value_t*, %jl_value_t*) #0 {
top:
%thread_ptr = call i8* asm "movq %fs:0, $0", "=r"() #2
%ptls_i8 = getelementptr i8, i8* %thread_ptr, i64 -2672
%ptls = bitcast i8* %ptls_i8 to %jl_value_t***
%3 = alloca [40 x %jl_value_t*], align 8
%.sub = getelementptr inbounds [40 x %jl_value_t*], [40 x %jl_value_t*]* %3, i64 0, i64 0
%4 = getelementptr [40 x %jl_value_t*], [40 x %jl_value_t*]* %3, i64 0, i64 33
julia> Pkg.status()
9 required packages:
- Atom 0.4.2+ master
- Blink 0.3.4+ master
- DifferentialEquations 0.2.1
- ForwardDiff 0.2.2
- Gallium 0.0.3+ master
- NLsolve 0.7.3
- ODE 0.2.1+ dev
- ODEInterface 0.0.10
type Points{T<:Number} # Note you can make this immutable and still change the contents of the vectors
x::Vector{T}
y::Vector{T}
a::Vector{T}
end
type Point{T<:Number} # Let your points be any number, but match
x::T
y::T
a::T
# First, here's node and elem
# Two large matrices which are used for the plot information.
node = [-8.91541 1.66159
-8.88471 1.55387
-8.82741 1.75439
-8.82629 1.51154
-8.80547 1.57183
-8.80356 1.64926
-8.7752 1.47451
[crackauc@crackauc2 .julia]$ sudo yum update
[sudo] password for crackauc:
Loaded plugins: copr, fastestmirror, langpacks
base | 3.6 kB 00:00:00
cuda | 2.5 kB 00:00:00
extras | 3.4 kB 00:00:00
google-chrome | 951 B 00:00:00
nalimilan-julia-nightlies | 3.0 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/3): nalimilan-julia-nightlies/x86_64/primary_db | 60 kB 00:00:00