Zachary Sunberg, Assistant Professor
University of Colorado Boulder
Julia solves the two language problem!!
Julia is
EASIER
FASTER
Find out for yourself!
POMDP Models
+
=
Optimization
Specification
Previous C++ framework: APPL
"At the moment, the three packages are independent. Maybe one day they will be merged in a single coherent framework."
POMDPs.jl - An interface for defining and solving MDPs and POMDPs in Julia
[Egorov, Sunberg, et al., 2017]
Short Term (next month 🙂)
Long Term
Think about 3 People
1. You (package writer)
2. User
3. Other Package Writer
# HybridAStar.jl
Environment(xlim, ylim, obstacles)
# Polygons.jl
Base.in(x::AbstractVector, p::Polygon)
if collision(state, obstacle)
# ...
end
if state[1:2] in obstacle
# ...
end
Old:
Tip for Julia: Let the user pass functions that define behavior
(they can make custom types <: Function if they want)
transition!(m::YourMDP, s::State, a::Action)
New:
transition(m::YourMDP, s, a)
Old:
value_estimate = SquaredStateValueEstimator()
New:
estimate_value = s->s^2
Old:
transition!(m::YourMDP, s, a, d=create_transition_distribution(m))
New:
transition(m::YourMDP, s, a)
Old:
generate_s(m::YourMDP, s, a, rng) = s + a + randn(rng)
New:
transition(m::YourMDP, s, a) = ImplicitDistribution(rng->s+a+randn(rng))
Celeste Project
1.54 Petaflops
+
=
Julia is
EASIER
FASTER
using CUDA
x_d = CUDA.fill(1.0f0, N) # a vector stored on the GPU filled with 1.0 (Float32)
y_d = CUDA.fill(2.0f0, N) # a vector stored on the GPU filled with 2.0
function add_broadcast!(y, x)
CUDA.@sync y .+= x
return
end
add_broadcast!(y_d, x_d)
numblocks = ceil(Int, length(y)/256)
CUDA.@sync begin
@cuda threads=256 blocks=numblocks gpu_add!(y, x)
end
#include <julia.h>
JULIA_DEFINE_FAST_TLS() // only define this once, in an executable (not in a shared library) if you want fast code.
int main(int argc, char *argv[])
{
/* required: setup the Julia context */
jl_init();
/* run Julia commands */
jl_eval_string("print(sqrt(2.0))");
/* strongly recommended: notify Julia that the
program is about to terminate. this allows
Julia time to cleanup pending write requests
and run all finalizers
*/
jl_atexit_hook(0);
return 0;
}
x=ccall((:mean,"libmean"),Float64,(Float64,Float64),2.0,5.0)
println(x)
3.5
double mean(double a, double b) {
return (a+b) / 2;
}
Julia from C
C from Julia
zachary.sunberg@colorado.edu