Return to Video

36C3 - Mathematical diseases in climate models and how to cure them

  • 0:00 - 0:18
    36C3 preroll music
  • 0:18 - 0:25
    Herald-Angel: This Talk will be about… I
    have to read this. Mathematical diseases
  • 0:25 - 0:29
    in climate models and how to cure them.
    And I don't have the slightest idea what
  • 0:29 - 0:34
    these two guys are talking about now. And
    when I asked them, they said, just tell
  • 0:34 - 0:40
    the people it's about next generation
    climate models and how to build them.
  • 0:40 - 0:46
    Which is cool. Throw that on Twitter.
    Please welcome Ali Ramadhan and Valentin
  • 0:46 - 0:47
    Churavy.
  • 0:47 - 0:55
    applause
  • 0:55 - 0:59
    Ali Ramadhan: Can you guys hear us? Is
    this OK?
  • 0:59 - 1:00
    Valentin Churavy: I'll stand back...
    Ramadhan: I'll stand back a little bit.
  • 1:00 - 1:05
    OK, cool. Thank you. So if you guys saw
    the last talk by karlab... karlabyrinth or
  • 1:05 - 1:09
    something. So we're kind of expanding on
    her talk a little bit. So she talked a lot
  • 1:09 - 1:11
    about kind of uncertainties…
    audio feedback from microphone
  • 1:11 - 1:16
    uncertainties in climate models. And one
    point that she did make was that most of
  • 1:16 - 1:18
    the uncertainty actually comes from
    humans. But there's a really huge
  • 1:18 - 1:22
    uncertainty that also comes from… comes
    from the models. So we're talking more
  • 1:22 - 1:26
    about the model uncertainties, which is
    kind of uncertainties because of unknown
  • 1:26 - 1:32
    or missing physics, kind of how to cure
    them. So it'll be kind of a weird talk. So
  • 1:32 - 1:35
    I'll talk a little bit more about the
    climate modeling part and then kind of how
  • 1:35 - 1:40
    to cure them involves using new programing
    languages. And that's where Valentin will
  • 1:40 - 1:45
    talk about Julia. So we'll kind of just
    start with maybe just giving kind of an
  • 1:45 - 1:50
    idea of why it's so hard to model the
    climate. So if you've… maybe you've seen
  • 1:50 - 1:55
    images like this a lot where it's like a…
    it's a satellite image basically of
  • 1:55 - 1:59
    clouds. It's used for like weather
    forecasting. But you can immediately see
  • 1:59 - 2:02
    there's lots of, you know, lots of really
    small clouds. So basically, if you want to
  • 2:02 - 2:06
    build a climate model, you've got to be
    able to resolve all the physics in these
  • 2:06 - 2:11
    clouds. So you can actually zoom in a lot.
    And see the clouds look pretty big over
  • 2:11 - 2:15
    here. But if you zoom in on kind of
    Central America, then you see even smaller
  • 2:15 - 2:22
    clouds. And if you zoom in even more so,
    so you zoom in on the Yucatan Peninsula,
  • 2:22 - 2:25
    then you can see the clouds are really,
    really small. So you're… there are maybe
  • 2:25 - 2:29
    five smaller clouds, some some of the
    clouds are, you know, a hundred meters or
  • 2:29 - 2:34
    something. And as the last talk kind of
    suggests that most climate models are…
  • 2:34 - 2:39
    they resolve things of, you know, up to 50
    kilometers. So anything smaller than 50
  • 2:39 - 2:44
    kilometers, the climate model can't really
    see. So you have to kind of take that… it
  • 2:44 - 2:46
    kind of has to account for that because
    clouds are important, and if you have more
  • 2:46 - 2:52
    clouds, then that reflects some of the
    heat out. So maybe you cool. But it also
  • 2:52 - 2:56
    traps more of the heat in so maybe you
    warm. And if you have more clouds, maybe
  • 2:56 - 3:00
    you warm more. But if you have less
    clouds, maybe you warm even more. So it's
  • 3:00 - 3:05
    kind of unsure. We actually don't know if
    clouds will make the climate warmer or if
  • 3:05 - 3:08
    they'll make the climate cooler. So it's
    important for your climate models to kind
  • 3:08 - 3:13
    of resolve or see these little clouds. So
    kind of where the mathematical disease
  • 3:13 - 3:17
    comes in, is that you don't… we don't know
    what equation to solve. We don't know
  • 3:17 - 3:21
    exactly what physics to solve, to see, to
    kind of resolve the effect of these little
  • 3:21 - 3:25
    clouds. So it's kind of the the
    mathematical disease. We don't know how to
  • 3:25 - 3:30
    do it. So you instead use a… well, it's
    called a parametrization, which is the
  • 3:30 - 3:33
    mathematical disease. So in the
    atmosphere, the big mathematical disease
  • 3:33 - 3:40
    is clouds. But if you look at the ocean,
    you kind of get a similar… You have also
  • 3:40 - 3:44
    similar mathematical diseases. So if you
    for example, this is model output. We
  • 3:44 - 3:49
    don't have good satellite imagery of the
    oceans. So if you if you look at, for
  • 3:49 - 3:53
    example, model output from an ocean model,
    high resolution ocean model here, it's
  • 3:53 - 3:58
    kind of centered on the Pacific. So you
    can kind of see Japan and China and the
  • 3:58 - 4:03
    white kind of lines. Those are streamlines
    or that the lines tell you where the water
  • 4:03 - 4:07
    is going. So you could see a lot of kind
    of straight lines. You see this curve here
  • 4:07 - 4:14
    current off of Japan, but you see lots of
    circles. So the circles are these eddies
  • 4:14 - 4:18
    and they're kind of the turbulence of the
    ocean. They move, they kind of stir and
  • 4:18 - 4:24
    mix and transport a lot of salt or heat or
    carbon or nutrients or… you know, marine
  • 4:24 - 4:28
    life or anything. It's the main way the
    ocean kind of moves heat from the equator
  • 4:28 - 4:33
    to the pole. It kind of stirs things
    around. So they're really important for
  • 4:33 - 4:38
    kind of how carbon moves in the ocean, for
    how the ocean heats up. And here they look
  • 4:38 - 4:42
    pretty big. But again, you can zoom in and
    you'll see lots of small scale structures.
  • 4:42 - 4:46
    So we're going to switch to a different
    model output and different colors. So here
  • 4:46 - 4:51
    here's kind of the same area. So you see
    Japan in the top left. But what's being
  • 4:51 - 4:56
    plotted is vorticity. So you have to know
    what that is. It's kind of a measure of
  • 4:56 - 5:00
    how much the fluid or the water is
    spinning. But the point is that you have
  • 5:00 - 5:05
    lots of structure. So there's lots of, you
    know, big circles, but there also lots of
  • 5:05 - 5:10
    really little circles. And again, your
    climate model can only see something like
  • 5:10 - 5:15
    50 kilometers or 100 kilometers. But as
    you can see here, there's lots of stuff
  • 5:15 - 5:19
    that's much smaller than a hundred
    kilometers. So if you superimpose kind of
  • 5:19 - 5:24
    this this grid, maybe that's your climate
    model grid. And, you know, basically for
  • 5:24 - 5:28
    the climate model, every one of these
    boxes is like one number. So you can't
  • 5:28 - 5:32
    really see anything smaller than that. But
    there's important dynamics and physics
  • 5:32 - 5:35
    that happens in like 10 kilometers, which
    is a lot smaller than what the climate
  • 5:35 - 5:39
    model can see. And there's even important
    physics that happens that like 100 meters
  • 5:39 - 5:44
    or 200 meters. So if you want if you want
    to, you know, what the climate will look
  • 5:44 - 5:51
    like, we need to… we need to know about
    the physics that happens at 200 meters. So
  • 5:51 - 5:55
    to give an example of some of the physics
    that happens at 10 kilometers, here's kind
  • 5:55 - 6:01
    of a little animation where this kind of
    explains why you get all these eddies or
  • 6:01 - 6:06
    all the circles in the ocean. So a lot of
    times you have, say, hot water, say, in
  • 6:06 - 6:11
    the north. So the hot water here is all in
    orange or yellow and you have a lot of
  • 6:11 - 6:15
    cold water. So the cold water is in the
    south and it's purple. And then once this…
  • 6:15 - 6:20
    once you add rotation, you end up with
    these eddies because what the hot water
  • 6:20 - 6:24
    wants to do, the hot water is lighter,
    it's less dense. So it actually wants to
  • 6:24 - 6:29
    go on top of the cold water. So usually
    have cold at the bottom, hot at the top.
  • 6:29 - 6:34
    So you have heavy at the bottom and light
    at the top. So when you add… without
  • 6:34 - 6:38
    rotation, the hot water will just go on
    top of the cold water. But when you have
  • 6:38 - 6:43
    rotation, you end up… it kind of wants to
    tip over. But it's also rotating. So you
  • 6:43 - 6:47
    kind of get this beautiful swirling
    patterns and these are kind of the same
  • 6:47 - 6:52
    circular eddies that you see in the real
    ocean. But this model here is like two
  • 6:52 - 6:55
    hundred and fifty kilometers by five
    hundred kilometers and it's like one
  • 6:55 - 7:00
    kilometer deep. So you need a lot of
    resolution to be able to resolve this
  • 7:00 - 7:05
    stuff, but not… your climate model doesn't
    have that much resolution. So some of the
  • 7:05 - 7:08
    features here, like the sharp prints
    between the cold and the hot water, your
  • 7:08 - 7:13
    climate model might not see that. So maybe
    if you if you don't resolve this properly,
  • 7:13 - 7:17
    you get the mixing rate wrong or maybe
    that the ocean is the wrong temperature or
  • 7:17 - 7:22
    something. So it's kind of important to
    resolve this stuff. Another one, the color
  • 7:22 - 7:26
    scheme here is really bad. laughs I'm
    sorry, but another one, for example, is
  • 7:26 - 7:32
    here. Everything's under 100 meter, so
    it's a cube of 100 meters on each side and
  • 7:32 - 7:37
    you're starting with 20 degrees Celsius
    water at the top. You have 19 degrees
  • 7:37 - 7:41
    Celsius water at the bottom initially. So
    it's kind of you're… as you go deeper in
  • 7:41 - 7:46
    the ocean, the water gets colder. And then
    if you can imagine, the ocean kind of at
  • 7:46 - 7:51
    night, it's kind of cold. So the top is
    being cooled and you end up with cold
  • 7:51 - 7:55
    water on the top. The cold water wants to be
    at the bottom. So it ends up sinking and you
  • 7:55 - 7:59
    get all this convection going on. So this
    is happening at a lot of places in the
  • 7:59 - 8:04
    ocean. You get a lot of mixing at the top.
    You get this kind of layer at the top of
  • 8:04 - 8:08
    the ocean. It's kind of constant color,
    constant temperature. So this mix layer is
  • 8:08 - 8:12
    important for the ocean. So knowing how
    deep that mix layer is and knowing how
  • 8:12 - 8:16
    much of the water is being mixed is also
    important for for climate. But as you can
  • 8:16 - 8:20
    imagine, you know, if this happens on very
    small scales. So you're climate model has
  • 8:20 - 8:25
    to know something about what's happening
    at this scale. So this isn't I guess the
  • 8:25 - 8:29
    mathematical diseases in the ocean is, the
    climate model cannot see this, so it has
  • 8:29 - 8:33
    to do something else that's maybe
    unphysical to resolve this stuff. And
  • 8:33 - 8:38
    that's a mathematical disease, I guess.
    Aside from the ocean and the atmosphere.
  • 8:38 - 8:42
    You also have the same problem with sea
    ice. So this is kind of just a satellite
  • 8:42 - 8:47
    picture of where sea ice is forming off
    the coast of Antarctica. So you get winds
  • 8:47 - 8:49
    that kind of come off the
    continent and they're
  • 8:49 - 8:51
    kind of blowing all the
    ice that's beeing formed
  • 8:51 - 8:54
    away. So you get all these
    little lines and streaks and they kind of
  • 8:54 - 8:58
    merge into sea ice. But in this whole
    picture is like 20 kilometers. So the
  • 8:58 - 9:02
    climate model doesn't see this, but
    somehow it has to represent all the
  • 9:02 - 9:09
    physics. And you have kind of similar
    things happening with soil moisture, land
  • 9:09 - 9:16
    and dynamic vegetation, aerosols. So, you
    know, these are kind of three places with
  • 9:16 - 9:21
    pretty pictures. But see, if you look at
    the atmosphere, so it's not just clouds.
  • 9:21 - 9:27
    You also have aerosols, which are like
    little particles, or sulfates that are
  • 9:27 - 9:32
    important for kind of cloud formation and
    maybe atmospheric chemistry. But again, we
  • 9:32 - 9:35
    don't fully understand the physics of
    these aerosols. So again, you have to kind
  • 9:35 - 9:40
    of parametrize them. Same thing with kind
    of convictions. You maybe your climate
  • 9:40 - 9:44
    model doesn't resolve all the very deep
    convection in the atmosphere so as to get
  • 9:44 - 9:48
    all sides to parametrize it. So I guess
    you have many kind of mathematical
  • 9:48 - 9:51
    diseases in the atmosphere. So I'm not
    expecting you to understand everything in
  • 9:51 - 9:55
    this in this picture. But the idea is: The
    atmosphere is complicated. There's no way
  • 9:55 - 10:00
    a climate model is going to kind of, you
    know, figure all this out by itself. And
  • 10:00 - 10:05
    again, you could you could do something
    similar for the ocean. So we can just show
  • 10:05 - 10:07
    an image for like two little parts of
    these. But the point is, you know, the
  • 10:07 - 10:11
    ocean is not kind of just a bucket of
    water standing there. So there's lots of
  • 10:11 - 10:15
    stuff happening deep inside the ocean. And
    some of it, we think is important for
  • 10:15 - 10:19
    climate. Some of it we don't know. Some
    might not be important. But again, a lot
  • 10:19 - 10:25
    of this happens on very small spatial
    scales. So we don't know or the climate
  • 10:25 - 10:30
    model can't always resolve all this stuff.
    And again, same thing with kind of sea
  • 10:30 - 10:34
    ice. Lots of small scale stuff is
    important for sea ice. And I think one
  • 10:34 - 10:38
    person asked about kind of tipping points
    and there's kind of two with like sea ice
  • 10:38 - 10:44
    that are pretty important. One of them is
    this CSL biofeedback. So if you have sea
  • 10:44 - 10:49
    ice that melts. Now you have more ocean
    and the ocean can absorb more heat. But
  • 10:49 - 10:52
    now the earth is warmer, so it melts more
    sea ice. So as soon as you kind of start
  • 10:52 - 10:56
    melting sea ice, maybe you melt even more
    sea ice and eventually you reach an earth
  • 10:56 - 11:00
    with no sea ice. So there's kind of
    research into that stuff going on, but
  • 11:00 - 11:04
    it's a possible tipping point. Another one
    is this kind of marine ice sheet,
  • 11:04 - 11:09
    stability, instability at the bottom of
    the ice shelf. So if you start melting
  • 11:09 - 11:14
    water, if you start melting ice from the
    bottom of the ice shelf, then we create
  • 11:14 - 11:18
    kind of a larger area for more ice to
    melt. So maybe once you start melting and
  • 11:18 - 11:21
    increasing sea level, you just keep
    melting more and more and increasing sea
  • 11:21 - 11:27
    level even more. But again, it's kind of
    hard to quantify these things on like 50
  • 11:27 - 11:35
    or 100 year timescales because it all
    happens on very small scales. So yeah, the
  • 11:35 - 11:40
    point is there's lots of these kind of
    parametrizations or mathematical diseases.
  • 11:40 - 11:44
    And once you start adding them all up, you
    end up with lots and lots of kind of
  • 11:44 - 11:48
    parameters. So this is a really boring
    table. But the point is, so this is like
  • 11:48 - 11:53
    one parametrization for like vertical
    mixing in the ocean. It's basically the
  • 11:53 - 11:57
    process that I showed the rainbow color
    movie about to see a climate model for
  • 11:57 - 12:02
    that. I'm trying to kind of parametrize
    that, physics might have like 20
  • 12:02 - 12:06
    parameters. And, you know, some of them
    are crazy like a surface layer fractional
  • 12:06 - 12:10
    like zero point one or something. And
    usually they keep the same constants for
  • 12:10 - 12:15
    all these values. Usually it's like
    someone in like 1994 came up with these 20
  • 12:15 - 12:19
    numbers and now we all use the same 20
    numbers. But you know, maybe they're
  • 12:19 - 12:22
    different. And like the Pacific or the
    Atlantic or like maybe they're different
  • 12:22 - 12:26
    when it's summer and winter and the
    problem is, there's many of these
  • 12:26 - 12:29
    parametrizations. So you know here's like
    20 parameters, but then you have a lot
  • 12:29 - 12:32
    more for clouds. You have a lot more sea
    ice. We add them all up. Suddenly you have
  • 12:32 - 12:38
    like 100, maybe up to a thousand kind of
    tunable parameters. Kind of going back to
  • 12:38 - 12:43
    this plot that was shown at the last talk.
    You can see kind of the all the models
  • 12:43 - 12:48
    kind of agree really well from like 1850
    to 2000, because they're all kind of being
  • 12:48 - 12:51
    they all have different kind of
    parameters, but they all get kind of tuned
  • 12:51 - 12:55
    or optimized. So they get the 20th
    century. Correct. So they get the black
  • 12:55 - 13:00
    line. Correct. But then when you run them
    forward, you run them to like 2300. They
  • 13:00 - 13:03
    all are slightly different. So they all
    start producing different physics and
  • 13:03 - 13:08
    suddenly you get a huge like red band. So
    that's saying you have lots of model
  • 13:08 - 13:13
    uncertainty. So it's kind of on some
    people might say like oh this like tuning
  • 13:13 - 13:18
    process is like optimization. It's like
    not very scientific to be kind of right.
  • 13:18 - 13:22
    It's kind of like in the past. It's kind
    of like the best live we've had. But I
  • 13:22 - 13:26
    think, you know, we should be able to do a
    little bit better. Better than that. So
  • 13:26 - 13:29
    just to give you the idea, you know, some
    people would say, you know, why don't you
  • 13:29 - 13:32
    just you know, most of the physics, which
    you just, you know, resolve all the
  • 13:32 - 13:37
    physics, you know, but see if you want to
    do like a direct numerical simulation, so
  • 13:37 - 13:39
    it's basically saying you want to resolve
    all the motions in the ocean, in the
  • 13:39 - 13:43
    atmosphere. You basically need to resolve
    things down to like one millimeter. So if
  • 13:43 - 13:47
    you have like a grid spacing of one
    millimeter and you consider the volume of
  • 13:47 - 13:51
    the ocean and the atmosphere, you
    basically say you need like 10 to the 28
  • 13:51 - 13:55
    grid points. You know, that's like imagine
    putting cubes of like one millimeter
  • 13:55 - 13:57
    everywhere in the
    ocean and atmosphere.
  • 13:57 - 13:59
    That's how many great
    points you would need.
  • 13:59 - 14:02
    So unfortunately, you could do that.
    But there's not enough computer power or
  • 14:02 - 14:06
    storage space in the world to do that. So
    you're kind of stuck doing something a bit
  • 14:06 - 14:11
    coarser. Usually most climate models, he's
    like 10 to the 8 great points so that you
  • 14:11 - 14:16
    10 to the 20 to little words. You don't
    want to just run a big climate model once
  • 14:16 - 14:20
    you know you need to run them for very
    long times, usually like you run them for
  • 14:20 - 14:23
    a thousand years or ten thousand years
    when you want to run many of them because
  • 14:23 - 14:27
    you want to collect statistics. So
    generally you don't run at the highest
  • 14:27 - 14:31
    resolution possible. You run kind of at a
    lower resolution so you can run many, many
  • 14:31 - 14:37
    models. So because you can only use so
    much resolution, it seems that power
  • 14:37 - 14:40
    transitions or these kind of mathematical
    things, you have to live with them, you've
  • 14:40 - 14:45
    got to use them. But at least one idea is,
    you know, instead of using numbers that
  • 14:45 - 14:49
    sum. But he came up with in 1994. You
    might as well try to figure you know,
  • 14:49 - 14:51
    better numbers or maybe
    you know if the numbers
  • 14:51 - 14:52
    are kind of different
    in different places,
  • 14:52 - 14:56
    you should find that out. So one
    thing you could do, one thing we are
  • 14:56 - 15:01
    trying to do is get the pressurization is
    to kind of agree with like basic physics
  • 15:01 - 15:05
    or agree with observations. So we have
    lots of observations. How many we can run
  • 15:05 - 15:07
    kind of high resolution
    simulations to resolve
  • 15:07 - 15:09
    a lot of the physics
    and then make sure
  • 15:09 - 15:12
    when you put the prioritization in
    the climate model, it actually gives you
  • 15:12 - 15:17
    the right numbers according to basic
    physics or observations. But sometimes
  • 15:17 - 15:21
    that might mean, you know, different
    numbers in the Atlantic, in the Pacific or
  • 15:21 - 15:24
    different numbers for the winter and the
    summer. And you have to run many high
  • 15:24 - 15:29
    resolution simulations to get enough data
    to do this. But indeed, you know, these
  • 15:29 - 15:34
    days I think we have enough computing
    power to do that. So it's kind of do all
  • 15:34 - 15:37
    these high resolution simulations. We
    ended up building a new kind of ocean
  • 15:37 - 15:42
    model that we run on GPUs because these
    are all faster for giving us these
  • 15:42 - 15:47
    results. So we ended up usually most
    climate modeling is done in Fortran. We
  • 15:47 - 15:53
    decided to go with with Julia for a number
    of reasons, which I'll talk about. But the
  • 15:53 - 15:58
    left figure is kind of that mixed layer or
    boundary layer turbulence kind of movie.
  • 15:58 - 16:02
    But instead of the rainbow color map, now
    it's using a more reasonable color maps.
  • 16:02 - 16:07
    It looks like the ocean, the right is that
    old movie. So we're generating tons and
  • 16:07 - 16:12
    tons of data from using simulations like
    this and then hopefully we can get enough
  • 16:12 - 16:15
    data and like figure out a way to explain
    the prior transitions. But it's kind of a
  • 16:15 - 16:20
    work in progress. So a different idea that
    might be more popular here, I don't know.
  • 16:20 - 16:26
    Is instead of kind of using the existing
    permanent positions, you could say, OK,
  • 16:26 - 16:30
    well, now you have tons and tons of data.
    Maybe you just throw in like a neural
  • 16:30 - 16:35
    network into the differential equations.
    Basically, you put in the physics, you
  • 16:35 - 16:38
    know, and then the neural network is
    responsible for the physics you don't
  • 16:38 - 16:44
    know. So, for example, you know, most
    people here might not. I also don't want
  • 16:44 - 16:46
    to talk about differential equations
    because I would take a long time. So just
  • 16:46 - 16:48
    imagine that the equation
    in the middle is kind of
  • 16:48 - 16:50
    what a climate model
    needs to solve.
  • 16:50 - 16:53
    And the question marks are kind of
    physics we don't know. So we don't know
  • 16:53 - 16:59
    what to put there. But maybe you could put
    out a neural network. So number one is
  • 16:59 - 17:03
    kind of a possible characterisation or a
    possible way you could try to franchise
  • 17:03 - 17:06
    the missing physics where the neural
    networks kind of responsible for
  • 17:06 - 17:10
    everything. We find that doesn't work as
    well. So instead, maybe you tell it some
  • 17:10 - 17:14
    of the physics, maybe tell it about cue,
    which is like the heating or cooling at
  • 17:14 - 17:18
    the surface. And then it's kind of
    responsible for resolving the other stuff.
  • 17:18 - 17:22
    But it's still a work in progress because
    the blue is kind explosive your data. The
  • 17:22 - 17:26
    orange is supposed to be the narwhal and
    they don't agree. So it's still a work in
  • 17:26 - 17:29
    progress, but hopefully we'll be able to
    do that better. So this is kind of stuff
  • 17:29 - 17:34
    that's like a week or two old. But kind of
    reach a conclusion, at least from my half
  • 17:34 - 17:40
    of the talk. So the reason I personally
    like Julia as a climate modeler is we were
  • 17:40 - 17:45
    able to kind of build an ocean model from
    scratch basically in less than a year. And
  • 17:45 - 17:47
    one of the nice things
    is that the user interface
  • 17:47 - 17:50
    or the scripting and the model
    backend is all in one language,
  • 17:50 - 17:52
    whereas in the past
    used to usually write the high
  • 17:52 - 17:58
    level and like Python and maybe the back
    end is like Fortran or C. And we find, you
  • 17:58 - 18:01
    know, when we Julia, it's just as fast as
    our legacy model, which was written in
  • 18:01 - 18:07
    Fortran. And one of the nicest things was
    that basically able to write code once and
  • 18:07 - 18:11
    using there's a need of GPU compiler. So
    basically you write your code one single
  • 18:11 - 18:15
    code base and you go to CPUs and GPUs.
    So you'd want to write two different code
  • 18:15 - 18:21
    bases. And yeah, we find generally because
    it's high level language, we're all kind
  • 18:21 - 18:25
    of more productive. We can give a more
    powerful user API and Julia kind of has a
  • 18:25 - 18:30
    nice multiple dispatch backend so that we
    find that makes it easy for the users to
  • 18:30 - 18:35
    kind of extend the model or hack the
    model. And there's. Some people would say
  • 18:35 - 18:38
    the Julia community is pretty small. But
    we find there's a pretty big Julia
  • 18:38 - 18:41
    community interest in scientific
    computing. So we fund kind of all the
  • 18:41 - 18:47
    packages we need are pretty much
    available. So with our client conclude my
  • 18:47 - 18:50
    half by saying there is most of the
    uncertainty in climate modeling basically
  • 18:50 - 18:54
    comes from humans because they don't know
    what humans will do. But there's a huge
  • 18:54 - 18:58
    model uncertainty basically because of
    physics we don't understand or physics,
  • 18:58 - 19:02
    the kind of model cannot see. You can't
    resolve every cloud and you know, every
  • 19:02 - 19:05
    wave in the oceans you've got you've got
    to figure out a way to account for them.
  • 19:05 - 19:10
    So that's what our prioritization does.
    And we're trying to kind of use a lot of
  • 19:10 - 19:15
    computing power to kind of make sure we
    train or come up with good privatizations
  • 19:15 - 19:20
    instead of kind of tuning the model at the
    end. And we're hoping this will lead to
  • 19:20 - 19:24
    better climate predictions. Maybe you
    will. Maybe you won't. But at least, you
  • 19:24 - 19:29
    know, even if it doesn't. Hopefully we can
    say we got rid of the model tuning problem
  • 19:29 - 19:33
    and hopefully we can make. We find it
    that software development for climate
  • 19:33 - 19:38
    modeling is easier than if we did it in
    Fortran. I will say this kind of an
  • 19:38 - 19:42
    advertisement, but I'm looking to bike her
    on Germany for a week and apparently can't
  • 19:42 - 19:46
    take the next bike out of Leipzig. So if
    anyone is looking to sell their bicycle or
  • 19:46 - 19:51
    wants to make some cash, I'm looking to
    rent a bicycle. So yeah, if you have one,
  • 19:51 - 19:55
    come talk to me, please. Thank you. Danke.
  • 19:55 - 20:02
    applause
  • 20:02 - 20:09
    Churavy: So one big question for me always
    is how can we ask technologists hub that
  • 20:09 - 20:15
    think most of us in this room are fairly
    decent with computers? The internet is not
  • 20:15 - 20:19
    necessarily an new island for us. But how
    do we use that knowledge to actually
  • 20:19 - 20:25
    impact real change? And if you haven't
    there's some fantastic article:
  • 20:25 - 20:30
    worrydreams.com/ClimateChange. Which lists
    all the possible or not all the possible
  • 20:30 - 20:37
    but a lot of good ideas to think about and
    go like, okay, do my skills apply in that
  • 20:37 - 20:43
    area? Well, I'm a computer scientist. I do
    programing language research. So how do my
  • 20:43 - 20:50
    skills really apply to climate change? How
    can I help? And one of the things that
  • 20:50 - 20:55
    took me in this article was how, and one
    of the realization, and why I do my work
  • 20:55 - 21:00
    is that the tools that we have built for
    scientists and engineers, they are that
  • 21:00 - 21:06
    poor. Computer scientists like myself have
    focused a lot on making programing easier,
  • 21:06 - 21:12
    more accessible. What we don't necessarily
    have kept the scientific community as a
  • 21:12 - 21:18
    target audience. And then you get into
    this position where models are written in
  • 21:18 - 21:23
    a language. Fortran 74 and isn't that a
    nice language, but it's still not one that
  • 21:23 - 21:28
    is easily picked up and where you find
    enthusiasm in younger students for using
  • 21:28 - 21:36
    it. So I work on Julia and my goal is
    basically to make a scientific computing
  • 21:36 - 21:41
    easier, more accessible and make it easier
    to access the huge computing power we have
  • 21:41 - 21:50
    available to do climate modeling. Ideas,
    if you are interesting in this space is,
  • 21:50 - 21:54
    you don't need to work on Julia
    necessarily, but you can think about maybe
  • 21:54 - 21:59
    I'm to look at modeling for physical
    systems, modeling like one of the
  • 21:59 - 22:04
    questions is can be model air conditioning
    units more precisely, get them more
  • 22:04 - 22:09
    efficient? Or any other technical system.
    How do we get that efficiency? But we need
  • 22:09 - 22:15
    better tools to do that. So the language
    down here as an example is modelicar.
  • 22:15 - 22:20
    There is a project right now, modelicar is
    trying to see how we can push the
  • 22:20 - 22:25
    boundary there. The language up here is Fortran.
    You might have seen a little bit of that
  • 22:25 - 22:32
    in the talk beforehand and it's most often
    used to do climate science. So why
  • 22:32 - 22:37
    programing languages? Why do I think that
    my time is best spent to actually work on
  • 22:37 - 22:44
    programing languages and do that in order
    to help people? Well, Wittgenstein says:
  • 22:44 - 22:49
    "The limits of my language are the limits
    of my world." What I can express is what I
  • 22:49 - 22:52
    think about. And I think people are
    multilingual, know that that sometimes
  • 22:52 - 22:56
    it's easier to think for them. But certain
    things in one language say it isn't the
  • 22:56 - 23:01
    other one. But language is about
    communication. It's about communication
  • 23:01 - 23:06
    with scientists, but it's also about
    communication with the computer. And too
  • 23:06 - 23:10
    often programing language fall into that
    trap where it's about, oh, I want to
  • 23:10 - 23:16
    express my one particular problem or I
    wanna express my problem very well for the
  • 23:16 - 23:20
    compiler, for the computer. I won't talk
    to the machine. What if I found that
  • 23:20 - 23:25
    programming languages are very good to
    talk to other scientists, to talk in a
  • 23:25 - 23:29
    community and to actually collaborate? And
    so the project that Ali and I are both
  • 23:29 - 23:35
    part of has, I think, 30 ish. I don't
    know. The numbers are as big as the big
  • 23:35 - 23:41
    coupe of climate scientists modelers. And
    we have a couple of numerical scientists,
  • 23:41 - 23:45
    computer scientists and engineers and we
    all working the same language, being able
  • 23:45 - 23:49
    to collaborate and actually work on the
    same code instead of me working on some
  • 23:49 - 23:57
    low level implementation and Ali telling
    me what to write. That wouldn't be really
  • 23:57 - 24:05
    efficient. So, yes, my goal is to make
    this search easier. Do we really need yet
  • 24:05 - 24:09
    another high level language? That is a
    question I often get. It's like why Julia?
  • 24:09 - 24:15
    And not why are you not spending your time
    and effort doing this for Python? Well, so
  • 24:15 - 24:22
    this is as a small example, this is Julia
    code. It looks rather readable. I find it
  • 24:22 - 24:29
    doesn't use a semantic whitespace. You may
    like that or not. It has all the typical
  • 24:29 - 24:34
    features that you would expect from a high
    level dynamic language. It is using the
  • 24:34 - 24:37
    M.I.T. license that has a built in package
    manager. It's very good for interactive
  • 24:37 - 24:45
    development, but it has a couple of
    unusual wants and those matter. You need
  • 24:45 - 24:50
    if you want to simulate a climate model,
    you need to get top performance on a
  • 24:50 - 24:56
    supercomputer. Otherwise you won't get an
    answer in the time that it matters. Julia
  • 24:56 - 25:03
    uses just in time ahead of time
    compilation, the other great feature is
  • 25:03 - 25:08
    actually a spitting in Julia. So I can
    just look at implementations. I can dive
  • 25:08 - 25:13
    and dive and dive deeper into somebodies
    code and don't have a comprehension
  • 25:13 - 25:20
    barrier. If I if you ever have spent some
    time and tried to figure out how Python
  • 25:20 - 25:26
    sums numbers under the hood to make it
    reasonably fast. Good luck. It's hard.
  • 25:26 - 25:30
    It's written in C. See, and there is a lot
    of barriers in order to understand what's
  • 25:30 - 25:35
    actually going on. Then reflection and
    meta programing. You can do a lot of fun
  • 25:35 - 25:41
    stuff which we're going to talk about. And
    then the big coin for me is that you have
  • 25:41 - 25:46
    native keep you code generation support so
    you can actually take Julia code and run
  • 25:46 - 25:50
    it on the GPU. You you're not
    relying on libraries because libraries
  • 25:50 - 25:59
    only are can express the things. That was
    where writtenin there. So early on last
  • 25:59 - 26:04
    December, I think we met up for the
    climate science project and after deciding
  • 26:04 - 26:08
    on using Julia for the entire project.
    They were like, we we're happy with the
  • 26:08 - 26:13
    performance, but we have a problem. We
    have to duplicate our code for GPUs
  • 26:13 - 26:21
    and CPUs. What really? It can't be! I mean, I
    designed the damn thing, it should be working.
  • 26:21 - 26:26
    Well, what they had at that point was
    basically always a copy of two functions
  • 26:26 - 26:31
    where one side of it was writing the CPU
    code and the other side was implementing a
  • 26:31 - 26:37
    GPU code. And really, there were only a
    couple of GPU specific parts in there. And
  • 26:37 - 26:43
    if anybody has ever written GPU Code, it's
    this pesky which index am I calculation.
  • 26:43 - 26:50
    Worthy for loop on the CPU to would just
    looks quite natural. And I was like, what?
  • 26:50 - 26:56
    Sit. Come on. What we can do is we can
    just wait a kernel so he takes a body of
  • 26:56 - 27:00
    the for loop, extracts it in a new
    function. Add a little bit of sugar and
  • 27:00 - 27:06
    magic to court GPU kernels and CPU
    functions and then we're done. Problem
  • 27:06 - 27:13
    solved. What the code roughly would look
    look like isn't actually this. You can
  • 27:13 - 27:20
    copy and paste this and it should work.
    And so you have two functions. One of them
  • 27:20 - 27:24
    launches where you extract your kernel.
    Then you write a function that takes
  • 27:24 - 27:30
    another function and runs it function in a
    for loop or it launches that function on
  • 27:30 - 27:35
    the GPU. And then you have this little GPU
    snippet is the only bit of us actually
  • 27:35 - 27:39
    GPU, which calculates the index and
    then calls the function F with an index
  • 27:39 - 27:46
    argument. I'm done here. My, my
    contribution to this project was done,
  • 27:46 - 27:50
    Well, they came back to me and we're like,
    now it's not good enough. And I was like,
  • 27:50 - 27:55
    why? Well, the issue is they needed kernel
    fusion. So that's the process of taking
  • 27:55 - 28:00
    two functions and merging them together.
    I'm like, okay, fine. Why do they need
  • 28:00 - 28:05
    that? Because if you want to be white(?)
    average efficient GPO code, you need to be
  • 28:05 - 28:10
    really concerned about the numbers of
    global memory loads and stores. If you
  • 28:10 - 28:14
    have too many of them or if they are
    irregular, you lose a lot of performance
  • 28:14 - 28:20
    and you need good performance. Otherwise,
    we can't simulate the solution once. They
  • 28:20 - 28:25
    also actually wanted to take use GPU
    functionality and low level controlled.
  • 28:25 - 28:30
    They wanted to look at their kernels and
    use shared memory constructs. They wanted
  • 28:30 - 28:36
    to do precise risk working, minimizing the
    number of registers used and they really cared
  • 28:36 - 28:41
    about low level performance. They were
    like, well, we can't do this with the
  • 28:41 - 28:48
    abstraction you gave us because it builds
    up too many barriers. And I could have
  • 28:48 - 28:54
    given you a few more typical computer
    science answer, which would have been OK.
  • 28:54 - 28:59
    Give me two years and I'll come back to
    you and there is a perfect solution which
  • 28:59 - 29:03
    is like a cloud cover in the sky. And I
    write your speech spoke language that does
  • 29:03 - 29:07
    exactly what you need to do. And at the
    end, we have a domain specific language
  • 29:07 - 29:11
    for climate simulation that will do final
    volume and discontinuous cloaking in
  • 29:11 - 29:17
    everything you want. And I will have a
    PhD. Kit. Fantastic. Well, we don't have
  • 29:17 - 29:22
    the time. The whole climate science
    project that we are on has accelerated
  • 29:22 - 29:27
    timeline because the philanthropist that
    the funding that research are. Well, if
  • 29:27 - 29:35
    you can't give us better answer anytime
    soon, it won't matter anymore. So I sat
  • 29:35 - 29:41
    down and was like, okay, I need a box. I
    need something. It has minimal effort.
  • 29:41 - 29:45
    Quick delivery. I need to be able to fix
    it. If I do get it wrong the first time
  • 29:45 - 29:50
    around and I did, it needs to be hackable.
    My collaborator needs to understand it and
  • 29:50 - 29:55
    actually be able to change it. And it
    needs to be happened yesterday. Well,
  • 29:55 - 29:59
    Julia is good at these kinds of hacks. And
    as I've learned, you can actually let them
  • 29:59 - 30:06
    go into bespoke solutions and have better
    abstractions after the fact. So that
  • 30:06 - 30:10
    you're that you can actually do the fancy
    computer science that I really wanted to
  • 30:10 - 30:15
    do. The product is called GPUify Loops
    because I couldn't come up with a worse
  • 30:15 - 30:24
    name, nobody else could. So we stick with
    it. It's a Macro based. And so, Julia, you
  • 30:24 - 30:31
    can write syntax macros that transform the
    transform the written statements into
  • 30:31 - 30:37
    similar statements so you can insert code
    or remove code if you want to. At, right
  • 30:37 - 30:41
    now target CPUs and GPUs and we are
    talking about how do we get multi threaded
  • 30:41 - 30:46
    into the story, how do we target more on
    different GPUs? There are other projects
  • 30:46 - 30:51
    that are very similar. So there's OCCA,
    which is where a lot of these ideas are
  • 30:51 - 30:59
    coming from and Open ACC in C++ does
    something really similar. But basically
  • 30:59 - 31:02
    you write a for loop, you write an at
    loop in front of it, which is the magic
  • 31:02 - 31:09
    macro that takes a transformation. And you
    have two indexed statements and now you
  • 31:09 - 31:15
    just say I want to launch it on the GPU
    and it magically does a job. Get,
  • 31:15 - 31:22
    fantastic. So let's pick up the entire
    implementation of the macro at loop
  • 31:22 - 31:29
    without the error checking that didn't fit
    on the screen a couple of nights. So
  • 31:29 - 31:38
    everything is here and basically I'm just
    manipulating the for loop so that on the
  • 31:38 - 31:46
    GPU it only iterates one iteration per
    index and on CPU it iterates all of the
  • 31:46 - 31:51
    indices because CPU is single threaded
    and a GPU is many, many
  • 31:51 - 31:57
    multithreaded. Of course there's a little
    bit of magic hidden in the device function
  • 31:57 - 32:01
    because how do I know where I'm running?
    And if you're curious how to do that and
  • 32:01 - 32:07
    then we can talk after afterwards. But
    otherwise, it's a very simple,
  • 32:07 - 32:11
    straightforward transformation. It's
    written in Julia. It's a Julia function.
  • 32:11 - 32:18
    And. Yeah. So you don't need to understand
    the code here. I just want to show how quick it
  • 32:18 - 32:25
    can be to write something like this. If
    you know anything about GPU Programming at
  • 32:25 - 32:29
    all, there should be a little voice in the
    head, of the back of your head is like,
  • 32:29 - 32:35
    wait a second. How can you run a dynamic
    programming on a GPU? That shouldn't be
  • 32:35 - 32:43
    possible. Well, Julia can run on the GPU
    because it has a lot of meta programing
  • 32:43 - 32:48
    facilities for the port for stage
    programing. So I can generate code based
  • 32:48 - 32:52
    on a specific call signature. It has
    introspection, reflection mechanisms that
  • 32:52 - 32:57
    allow me to do some interesting stuff in
    the background. It is built upon LVM,
  • 32:57 - 33:02
    which is a common compiler infrastructure.
    And so I can actually write staged
  • 33:02 - 33:08
    function that would generate an LVM
    specific code for my one function and do
  • 33:08 - 33:17
    so do that during compile time and is a
    dynamic language that tries really hard to
  • 33:17 - 33:20
    avoid runtime uncertainties. And this is
    one of the challenges if you're getting
  • 33:20 - 33:27
    into Julia is to understand that when
    you're writing code that has a lot of
  • 33:27 - 33:32
    runtime uncertainties, you get relative
    slow performance, or as fast as Python.
  • 33:32 - 33:37
    But if you work with the compiler and you
    write runtime uncertainties you can get
  • 33:37 - 33:40
    very fast code and you can run your code
    on the GPU, you basically that's the
  • 33:40 - 33:45
    limites test. If you can run your code on
    the GPU, that you did your job well and it
  • 33:45 - 33:51
    provides tools to understand the behavior
    of your code. So a warning runtime
  • 33:51 - 33:55
    uncertainty. It does that and I don't have
    the time to go too deep into the answers.
  • 33:55 - 33:59
    There is actually a paper about this. It
    has a type system that allows you to do
  • 33:59 - 34:03
    some sophisticated reasoning type
    influence to figure out what your code is
  • 34:03 - 34:08
    doing. Mutable dispatchers actually
    helping us quite a lot in making it easier
  • 34:08 - 34:11
    to do virtualized codes. It was a case of
    specialization and just in time
  • 34:11 - 34:18
    compilation. And so just looking a little
    bit closer at some of these topics, if you
  • 34:18 - 34:25
    want to look at the entire pipeline that
    flow when you start while you're
  • 34:25 - 34:30
    functioning, call it what happens through
    the Julia compiler. You have tools to
  • 34:30 - 34:34
    introspect and all of these on the right
    hand side here and then you have tools to
  • 34:34 - 34:43
    interact on the left hand side. You can
    inject code back into the compiler. The
  • 34:43 - 34:48
    other thing is Julia has dynamic
    semantics. So when you difficult, you can
  • 34:48 - 34:54
    at runtime, redefine your function and
    recall it new function and it uses
  • 34:54 - 35:01
    multiple dispatch. So if you look at the
    absolute value call here, which of the 13
  • 35:01 - 35:06
    possible methods will it call? In C++ or
    in other programing languages this called
  • 35:06 - 35:11
    a virtual function call. So isn't Julia
    everything a virtual functional call? No.
  • 35:11 - 35:18
    This is one of the important points is
    when we call a function, let's say because
  • 35:18 - 35:24
    sign of X, we look at the type of the
    input arguments and then we first of all
  • 35:24 - 35:34
    look at which function is applicable to
    our input argument. So in this case, it
  • 35:34 - 35:42
    would be the real down here because float
    64 is a subtype of real. So we choose the
  • 35:42 - 35:51
    right method using dispatch and then we
    specialize that method for the signature.
  • 35:51 - 35:54
    So the rule in multiople dispact is to
    remember is we calling the most specific
  • 35:54 - 35:59
    method, whatever specific might mean. So
    if you have this bit of example, where we
  • 35:59 - 36:06
    have a function F, which has three
    different methods and we have an integer
  • 36:06 - 36:11
    argument that can be matched on X, or on Y,
    and then we have a floating point argument
  • 36:11 - 36:17
    on Y and we call this with a "1,Hello".
    Well, we will select the methods that is
  • 36:17 - 36:24
    most specific for this argument, which
    would be the number 1 here. On the other
  • 36:24 - 36:29
    hand, if when we have a float 64 and
    the second position, then we will call the
  • 36:29 - 36:35
    second method. Now what happens if I pass
    in an integer and the first position and a
  • 36:35 - 36:39
    floating point in the second position?
    Well, you would get a run time error
  • 36:39 - 36:44
    because we can't make this decision. What
    is the most specific method? That's just
  • 36:44 - 36:49
    something to keep in mind. Method
    specialization works really similarly when
  • 36:49 - 36:55
    you call a method for the first time. This
    method sign right now has no
  • 36:55 - 37:01
    specializations. And then I look back,
    call it once and Julia will insert a
  • 37:01 - 37:07
    speciallisation just for Float64. Before
    that it could have been a Float32. The
  • 37:07 - 37:11
    Float64 is for this method. So
    Julia specializes in compilers methods on
  • 37:11 - 37:15
    concrete called signatures instead of
    keeping everything dynamic or everything
  • 37:15 - 37:23
    ambiguous. You can introspect this process
    and there are several macros that are code
  • 37:23 - 37:31
    lowered or code type that will help you
    understand that process. I think I don't
  • 37:31 - 37:35
    have enough time to go into detail here,
    but just as a note, if you have a look at
  • 37:35 - 37:41
    this, the percentage for means it's an
    assignment. So if you reference it later,
  • 37:41 - 37:49
    so in line 5, we will iterate on the 4
    value. And then we can look at the type
  • 37:49 - 37:53
    information that Julia infers out of that
    call. We're calling the function mandel
  • 37:53 - 37:59
    with the U in 32 and you can see how that
    information propagates through the
  • 37:59 - 38:05
    function itself. And then if you actually
    do agressive inlining .., we do aggressive
  • 38:05 - 38:10
    inlining and optimizations and
    devirtualization. And so in the end, we
  • 38:10 - 38:16
    don't have calls anymore. We only have the
    intrinsics that Julia provides on which
  • 38:16 - 38:24
    programs are actually implemented. So this
    is a unsigned less than integer function.
  • 38:24 - 38:28
    So we are using time and find as an
    optimization to find static or near static
  • 38:28 - 38:32
    site programs. It allows us to do us
    agressive virtualization, inlining and
  • 38:32 - 38:37
    constant propagation. But it raises
    problems of cash and validation. So in
  • 38:37 - 38:42
    bygone days, this used to be the case. I
    could define a new function G after
  • 38:42 - 38:48
    calling G want a function, a new function,
    f after calling G once and I would get the
  • 38:48 - 38:53
    old restore back. That's bad. That's
    counter-intuitive. That's not dynamic. So
  • 38:53 - 39:00
    in Julia 1.0 and I think 0.5 and 0.6
    already. We fix that. So we invalidating
  • 39:00 - 39:06
    the functions that have dependencies on
    the function. We just changed. But can we
  • 39:06 - 39:10
    see latency of your program? If you change
    a lot of the functions and you recall them
  • 39:10 - 39:21
    well hm we need to do a lot of work every
    time. We do constant propagation, so it
  • 39:21 - 39:27
    isn't very simple example. We try to
    reduce. We try to exploit as much
  • 39:27 - 39:32
    information as possible. And so if you
    call if you want a function F and you call
  • 39:32 - 39:36
    the function sign with a constant value,
    we actually build just turning you the
  • 39:36 - 39:41
    constant avoiding the calculation is the
    sine entirely. And that can be very
  • 39:41 - 39:50
    important during hot calls and in a cycle.
    This can sometimes go wrong or Julia can
  • 39:50 - 39:54
    has heuristics in order to decide when or
    whether or not these optimizations are
  • 39:54 - 40:01
    valuable. And so when you introspect your
    code, you might see the results that are
  • 40:01 - 40:06
    not that are not quite, what you want. So
    we don't know what the return value here
  • 40:06 - 40:10
    is. It's just a tuple. We know it's a
    tuple, nothing else. Holistic to say, not
  • 40:10 - 40:14
    specialize. But the nice thing about Julia
    and where we get performance voice that we
  • 40:14 - 40:18
    can actually do for specialisation and
    hopefully at some point view makes a
  • 40:18 - 40:26
    compiler smart enough that these edge
    cases disappear. So I can use some secrets
  • 40:26 - 40:33
    and foresee specialization to happen and
    then I can actually infer the precise of
  • 40:33 - 40:40
    return type of my function. Another thing
    to know when you're coming for more
  • 40:40 - 40:45
    traditional object oriented programing
    language is that types are not extensible,
  • 40:45 - 40:50
    extendable. So you can't inherit from
    something like Int64. You can only subtype
  • 40:50 - 40:56
    abstract types. We do that because
    otherwise we couldn't do a lot of
  • 40:56 - 41:01
    optimizations. When we, when we look at
    programms, we can't never assume that you
  • 41:01 - 41:05
    won't add code. We had a dinamic programming
    language at any time in the runtime of your
  • 41:05 - 41:12
    program you can't add code. And so we don't
    have close word semantics, which doesn't
  • 41:12 - 41:16
    doesn't allow us to say, hey, by the way,
    we know all possible subtypes here. You
  • 41:16 - 41:21
    might add a new type. Later on by
    saying a common types are not extendable.
  • 41:21 - 41:28
    We get a lot of the performance back. So
    personally, for me, why do I like Julia?
  • 41:28 - 41:33
    Or why do I work on Julia? It works like
    Pyphon, it talks like Lisp and runs like
  • 41:33 - 41:38
    Fortran. That's my five sales pitch.
    It's very hackable and extendable.
  • 41:38 - 41:46
    I can poke at the internals
    and I can bend them if I need to. It's a
  • 41:46 - 41:52
    bit of upon LVM. So in reality, for me as
    a compiler writer, it's my favorite LVM
  • 41:52 - 41:59
    front end. I can get the LVM code
    that I need to actually run. But for users,
  • 41:59 - 42:05
    that's hopefully not a concern. If you do
    our job right and it has users in
  • 42:05 - 42:09
    scientific computing and I'm in a prior
    life whilst doing a lot of scientific
  • 42:09 - 42:15
    computing in cognitive science wanting
    models. And I care about these users
  • 42:15 - 42:21
    because I've seen how hard it can be to
    actually make progress when the tools you
  • 42:21 - 42:29
    have are bad. And my personal goal is to
    enable scientists and engineers to
  • 42:29 - 42:38
    collaborate efficiently and actually make
    change. Julia is a big project and Climate
  • 42:38 - 42:44
    is a big project and many people to thank.
    And with that, I would like to extend you
  • 42:44 - 42:50
    an invitation if you're interested. There
    is juliacon every year. Where you have a
  • 42:50 - 42:58
    develop meet up. Last year we were about
    60 people are much smaller than CCC. But
  • 42:58 - 43:02
    next year it will be in Lisbon. So come
    join us if you're interested and if you
  • 43:02 - 43:06
    want to meet scientists who have
    interesting problems and are looking for
  • 43:06 - 43:09
    solutions. Thank you.
  • 43:09 - 43:17
    Applaus
  • 43:17 - 43:24
    Herald A: Time for questions and answers,
    are there any questions?
  • 43:24 - 43:29
    Herald H: Yeah, we've got microphones over
    there. So just jump to the microphone and
  • 43:29 - 43:33
    ask your questions so that
    everybody could hear.
  • 43:33 - 43:39
    Question: What do you mean when you say
    dead? Julia talks like Lisp and how is
  • 43:39 - 43:43
    that a good thing Lachen
    Churavy: Well, it talks like Lisp, but it
  • 43:43 - 43:48
    doesn't look like Lisp. I assume that's
    what you mean. It doesn't have that many
  • 43:48 - 43:54
    braces. But no, Lisp has another powerful meta
    programming capabilities and macros. And
  • 43:54 - 43:58
    so we have a lot of that. If you read a
    little bit about the history of Lisp. The
  • 43:58 - 44:04
    original intention was to write NLisp,
    which would be Lisp with a nice syntax. And
  • 44:04 - 44:07
    I think Julia is my personal is NLisp.
    It has all these nice features, but it
  • 44:07 - 44:13
    doesn't have the packet syntax.
    Herald A: OK. Thank you.
  • 44:13 - 44:19
    Question: Thanks for the talk. My question
    is regarding the first part of the talk.
  • 44:19 - 44:23
    You, if I understand correctly, you
    simulating a deterministic system there.
  • 44:23 - 44:26
    So there's no additional noise
    term or anything, right?
  • 44:26 - 44:30
    Ramadhan: Well, if you had infinite
    precision, I think it would be
  • 44:30 - 44:35
    deterministic. But I think by kind design
    turbulence itself is not deterministic.
  • 44:35 - 44:38
    Well, it's a chaotic system,
    Question: But the district size version
  • 44:38 - 44:41
    itself is deterministic. You don't have
    the monte carlo part where you have
  • 44:41 - 44:44
    some noise that you would add to
    which might actually be justified
  • 44:44 - 44:50
    from the physics side. Right?
    Ramadhan: Well, I mean, we, if you think if
  • 44:50 - 44:54
    you ran the same simulation again, you
    would not get that. Well, I think if you
  • 44:54 - 44:56
    ran on the exact same machine,
    you would get the
  • 44:56 - 44:58
    same answer. So in that
    sense, it is deterministic.
  • 44:58 - 45:01
    But if you ran on a slightly
    different machine like truncation
  • 45:01 - 45:04
    error, I'd like the 16th decimal place
    could give you a completely different
  • 45:04 - 45:08
    answer. Question: Sure. So the point I'm
    trying. Am I allowed to continue?
  • 45:08 - 45:12
    Herald H: Yes, of course. There's no one
    else. Well, there is one person else. So you
  • 45:12 - 45:17
    can continue a few minutes if you want to.
    Thanks. Laughter
  • 45:17 - 45:20
    Question: So the point I was
    trying to make is,
  • 45:20 - 45:22
    if you add noise in the
    sense that it's a physical
  • 45:22 - 45:25
    system, you have noise in
    there, it might actually allow you to
  • 45:25 - 45:29
    solve a PDI or discretize a PD, but get a
    stochastic simulation itself, which might
  • 45:29 - 45:34
    be interesting because it often can make
    things easier. And also, you mentioned
  • 45:34 - 45:39
    neural differential equations, right? And
    in particular, with physical systems, if
  • 45:39 - 45:43
    you have an discontinuities, for example,
    the DT integral can actually be quite the
  • 45:43 - 45:48
    problem. And there is work on to just
    plug my colleagues work, control neutral
  • 45:48 - 45:51
    differential equations where you can
    actually also built in these
  • 45:51 - 45:54
    discontinuities, which might also be
    interesting for you guys.
  • 45:54 - 45:56
    Ali: That's why maybe we should talk
    because I don't know much about that stuff
  • 45:56 - 46:00
    where we're kind of just starting up. I
    think that so we've been doing this maybe
  • 46:00 - 46:03
    hopefully continuous, but maybe we'll hit
    discontinuities. I don't know. We should
  • 46:03 - 46:07
    talk, though. Q: And also the math is
    beautiful and has no sickness. It's the
  • 46:07 - 46:10
    physics that mightn't change. I'm a
    mathematician. I have to say that. Ali: I know
  • 46:10 - 46:15
    that the physics is ugly, trust me.
    Churavy: Just as quickly, we do have
  • 46:15 - 46:25
    stickers and I sell cookies, too. They are
    in the cookie box and on. I think they for
  • 46:25 - 46:30
    somebody from our community is giving a
    juliaworkshop and we're trying to find a
  • 46:30 - 46:34
    set up an assembly space and hopefully
    that goes out as well.
  • 46:34 - 46:38
    Herald H: Go on please.
    Question: Also, one question for the first
  • 46:38 - 46:45
    part of the talk I want. I wanted to ask
    if it's possible or if you are using
  • 46:45 - 46:49
    dynamic resolution in your climate models.
    Well, you will maybe have a smaller grid
  • 46:49 - 46:55
    size near the (???) and larger
    in the areas that are not that
  • 46:55 - 46:58
    interesting.
    Ramadhan: Like adaptive grids? So I
  • 46:58 - 47:03
    think we mostly do that in the vertical.
    So usually in the ocean, the thinking
  • 47:03 - 47:04
    things are interesting
    in the, you know,
  • 47:04 - 47:06
    close to the surface.
    We have more resolution
  • 47:06 - 47:09
    there. But as you go deeper,
    things get less interesting. So you put
  • 47:09 - 47:14
    less resolution there. Generally, I think
    in general, the idea people have asked
  • 47:14 - 47:18
    that before, you know, why do you always
    use constant grids? Why don't you use
  • 47:18 - 47:22
    these adaptive grids on your global, you
    know, models? And you the answer I've
  • 47:22 - 47:25
    heard I don't know if it's very
    convincing. I think generally there hasn't
  • 47:25 - 47:29
    been that much research or people who do
    research into adaptive grids for kind of
  • 47:29 - 47:35
    models. Their funding gets cut. But I like
    the answer I've heard is a lot of the
  • 47:35 - 47:38
    time, a lot of the atmosphere and ocean is
    turbulent. So if you especially you do
  • 47:38 - 47:43
    kind of adaptive refinement, then you just
    kind of adapt everywhere because there's
  • 47:43 - 47:48
    kind of turbulence everywhere. But yeah, I
    don't I'm not. I guess first for our
  • 47:48 - 47:53
    simulations we're kind of just some of
    the numerical methods are only fast if you
  • 47:53 - 47:57
    run it on a regular grid. So
    that's the reason we don't use adaptive
  • 47:57 - 48:01
    grids for our simulations. But in general,
    adaptive grids for climate models is
  • 48:01 - 48:05
    interesting beyond like it seems like
    there needs to be more research in that
  • 48:05 - 48:08
    area. So I don't know if I answered your
    question, but I kind of just ranted it.
  • 48:08 - 48:11
    Question: You did, thanks.
    Herald H: Go go ahead, please.
  • 48:11 - 48:16
    Question: Yeah, it's just a few guesses
    about us. I think I have. I wept quite a
  • 48:16 - 48:22
    bit of legacy fortune code in Python. And
    my question is, would there be a simple
  • 48:22 - 48:29
    pass converting Fortran code to Julia,
    preferably automatically. Do you have any
  • 48:29 - 48:33
    ideas about this one?
    Churavy: You can do it. Your Julia code
  • 48:33 - 48:39
    will look like Fortran code. So you
    haven't won anything. So, yes. As a good
  • 48:39 - 48:42
    starting point, you can do that.
    Absolutely. But you can also just call
  • 48:42 - 48:46
    Fortran from Julia and then totally move
    over. I generally don't want people to
  • 48:46 - 48:50
    rework their code, except if there's a
    good reason. Like starting from scratch
  • 48:50 - 48:55
    sometimes helps. It can be a good reason.
    Or if you say the solutions, we don't have
  • 48:55 - 49:01
    the necessary experts to to work with the
    old solution anymore. But generally, if
  • 49:01 - 49:05
    you have Fortran code, I would just say,
    well, call Julia from Fortran or from
  • 49:05 - 49:11
    Julia, get it up to speed and then start
    transitioning. Piece by piece. That makes
  • 49:11 - 49:17
    sense?
    Herald H: So any more questions? No more
  • 49:17 - 49:24
    questions. That's an early read. Ali Ramadhan,
    and Valentin Churavy, thank you very much.
  • 49:24 - 49:26
    Applaus
  • 49:26 - 49:29
    36C3 postroll music
  • 49:29 - 49:51
    Subtitles created by c3subtitles.de
    in the year 2020. Join, and help us!
Title:
36C3 - Mathematical diseases in climate models and how to cure them
Description:

more » « less
Video Language:
English
Duration:
49:51

English subtitles

Revisions