 showing up at 9 a.m. on a Saturday. I am Viral Shah. I am one of the co-inventors of the Julia language and we even have, you know, we have Shashi out here who is the core Julia contributor. We have Ravi Mohan out here who is also a Julia contributor now. And as you can see, the Julia community in Bangalore has already grown three-fold. Last year it would have been just me maybe giving this talk. Today we have three Julia people. Are there others that I do not know of? Maybe anyone else who has tried out Julia has used it out here? Okay. Just a, okay. Julia box, okay. Okay. So some, okay. What have you done with Julia? Just kind of test the waters. Okay. All right. So, you know, this is functional conference, right? So I'm, I guess I should really be talking about some functional aspects of Julia and stuff like that. But I mean, I think you guys all know all that stuff, right? Your maps and folds and filters and I'm not a huge fan of them anyway. So, what I'm, what I'm planning to do is I have a whole bunch of demos actually. And, and hopefully these will motivate, you know, why Julia? Why did we even start? Why did we even need a new language? And, and what are some of the design criteria, the design things that we went through? And it's what I think we, what I would like to do is make this completely interactive to as much of an extent as possible so that, you know, it's not just me giving a monologue, but I'd really like sort of people to ask questions as you go along, challenge me on stuff. I'll try to say stuff that hopefully will evoke people to challenge me. Yeah, so with that, let me start off. So Julia today, some of you might wonder, right, where it is, what, what it is, why, you know, why is it even interesting? The Julia community is about 100,000 users today is our estimate at a pessimistic level. It's being taught in about probably, you know, 30 to 50 universities as course material. It's, you know, IIT Bombay yesterday came out, there was an article in Economic Times, IIT Bombay had this $100 laptop. Anyone saw that article or heard about this $100 laptop? So they just get clone Julia and type make and eight hours later Julia was running on the $100, you know, IIT laptop, the arm, arm book. So, you know, people are just kind of taking Julia, putting it on Raspberry Pi, putting it on netbooks, putting it on, you know, their servers, putting it on, you know, doing their, their analytics. People are doing all kinds of stuff. People are using it for research. And I'd like to maybe mention a couple of very interesting use cases. I don't actually have real slides. I just have a bunch of iPies on notebook. So I'll just talk about some of the use cases that I've seen people using Julia. One of the things they like to do is send people to the JuliaCon website, the JuliaCon video. So if I go to YouTube and look at the Julia language, so we had JuliaCon 2015 that was that just happened in June. And there were an amazing set of talks, right? So there were there are 61 videos that I actually ended up uploading eventually, but some amazing talks and I would really like to sort of maybe highlight some of these. And the reason I'm just showing you this YouTube page is so that if you find this interesting, you can actually go and check these things out. So there was this next generation airborne collision avoidance system. This is the FAA that is using Julia for writing the spec of the next generation collision avoidance system that will go on every aircraft. So three years from now Boeing will get probably, I mean, this is my understanding this may not have any bearing to reality. But as I understand it, Boeing in theory should get an executable spec that is written in Julia, which is completely sort of souped up with metaprogramming. So the spec generates the flow charts, the code, the documentation, the test cases, all comes from the same code base and and it's also executable. So you can actually, you know, what goes on your system will be what you've actually been given. So it's not a paper specification. It's an executable specification. And Robert Moss who gave this talk believes that Julia can actually become a standard for specification in avionics. There was another one by another one on 3D printing, I think, yeah, Jack Minardi 3D printing with Julia. So this is an amazing application where this company Voxelate which builds amazingly cool materials. There are materials answers company and they have their own 3D slicer. And the entire code that powers the 3D printer is actually written in Julia. So you have the entire geometry engine that controls how the head moves and you know, put the ink around and builds up. So they have amazing materials that not just lays out the mechanical structure, but also lays out the electronics. So they actually have this amazing demo of a quadcopter. If you see this video, it's like the hit enter and then this printer starts printing and then when it's done printing, this thing just starts flying like it's pretty cool. So that's another really cool application. I mean, I'm trying to kind of pick out applications that you may not have heard of or that are sort of interesting and stand out. There's a bunch of guys doing quantum simulations with Julia. There's a bunch of guys doing data science with Julia and so on and so forth. Yeah, Julia in astronomy. Oh, there's another great one. There was this one on economics actually. Let me point that one out. So this is a team at New York University that's working with Professor Thomas Sargent who got the Nobel Prize in economics in 2011 or 12 for macroeconomics, macroeconomic work. And his team has essentially moved to Julia. He's put out a textbook that gives all its examples in Python and Julia today. And their team working with the New York Fed is actually moving the New York Fed's models of the US economy from Matlab to Julia. Great, right? Open source is high performance. You know, everyone in the community is beginning to use it. So makes sense. So all kinds of interesting applications are beginning to move to Julia and you know, why this excitement, why this movement, right? I mean, why do we need another language? That's the question I asked myself when we started this in 2009. Like, does the world really need a new language? I mean, you know, if someone came to me and said I started a new language, I would ask why would you do that? And we asked ourselves the same question. But at least when we started, you know, I come from even though I'm a computer scientist by training, I actually come from sort of a world of scientific computing, where there was a lot of Fortran, a lot of Matlab are kind of started coming in from the world of statistics. Python started becoming increasingly popular in the last five years for numerical computing. But your traditional computer science languages don't show up in this world at all, right? Like Fortran is probably the last and probably the first and the last intersection there. And I don't think anyone probably uses any any real computer scientist uses Fortran, right? Is that a fair statement? But you know, we have what 20 years, 30 years of scientific legacy that's that's important today. So the real question that was sort of staring us was, can we have something? Can we have a programming language that's high performance? That's good computer science? That's good numerical computing? That's good for algorithmic work? And that's also productive. So, so is something that has all these features even possible or not, right? And everyone until Julia came out until 2012, when our first blog post announcing Julia went live and got 100,000 hits in a couple of days, people believed this was impossible that you cannot have a language that is interpreted and dynamic and, you know, high productivity at the same time as something like C of Fortran, which is high performance, right? It was thought you had to pick one of the two. You could not have both together. But I think, you know, enough has been discussed on this topic and the proof is out there, right? You can download Julia and see, see that is actually as good as I say it is. So Julia lang.org if you're online, just go to Julia lang.org. That's the website. And, you know, that's where the project is in, you know, some videos out there and some very interesting benchmarks. Maybe I'll just, let's look at this plot out here. So this is a benchmark of, of these very simple things in Julia, right? It's the Mandelbrot set. It's your integer parsing, some arithmetic with, which computes by, you know, printf benchmark for some string stuff, a quick sort benchmark that tests your array access and, you know, nothing, nothing exciting about these benchmarks, right? I mean, like, what's the big deal? And these are the languages in which these benchmarks were implemented. Now these are, you know, a caveat is that if you look at these implementations, these implementations are not meant to be how an R user would write this benchmark or a Python user, right? So for example, for quick sort in Python, you'd never write the quick sort algorithm in Python, you would say sort, right? And probably it will do something under the hood. But the purpose of these benchmarks was, was not that the purpose of these benchmarks was to figure out how, you know, something that can be expressed as, you know, 10 line code, 10 line quick sort implementation. If you express the same 10 lines with roughly the same algorithmic styles, right? Your, your recursion, your array accessing your all your control structures and so on and so forth. How well do they do in each of these languages? So Mandel, right? For example, that's that test how good your complex number implementation is. And the, the basic takeaway is that, okay, so the way you read this chart is these are ratios to see. So for example, if I pick go, and this is this pink thing out here, the quick sort in go is as far as fast as quick sort in C. That's, that's what this means. But this orange thing out here, which is random at stat, this thing is, is a random matrix statistics implementation. And that in go is 10 times slower than, than C. Where's Julia out here? So as you can see, Julia is all bunched up close to, you know, so this, this line out here, this line is C. If you're on this line, you're as fast as C. Okay. So every, so Julia has the tightest bunching, bunching of all these languages. And as you can see, these are the languages that people like to use when they're doing scientific, exploratory data science work. These are the languages that people like to use for deployment, or, or actually sort of, you know, doing high performance stuff. So Julia kind of sits right in the middle. It's, it's, it's got the features of these, it's got the performance of these and it's, you know, this, this chart kind of shows, shows where that comes from. So that's a little bit on Julia benchmarks. I would invite you to not believe me at all, and write your own program in Julia and see if it's fast or not, or if it meets your expectation, right? And if you're keen to use Julia, you can download it from julialang.org right now, or go to Julia box. Actually, I should do this in an incognito so that it doesn't log me in. So if you go to julialbox.org, a large part of which has been designed by Shashi out here and Kanmayi, who is not here right now, but, but in Bangalore. If you go to julialbox.org right now, you will be able to see, you know, a page like this. And then you just sign in with your Google ID and you'll get a rich notebook interface where you can follow along with some of the basic things that I do, but not the more advanced things because I have all the libraries configured out here. All right. So maybe it's a good time to maybe take a little bit of a break and see if people have any questions, or maybe even if I can get a raise of hands of what are your preferred programming languages. What do you guys do? I mean, you know, if I, I mean, what's the, what, what would be a good guess for a dominant programming language in this group, if I had to pick Java? A lot of Java guys. Let's see a show of hands Java. Okay. That's like about good half the audience. Okay. What about some scalar, maybe a few fewer scalar users? Okay. Then what about something like R? Okay. A few hands there too. A lot of hands that I'm missing. So what am I missing? Oh, I was going to like not go with CC plus plus, but okay, CC plus plus. Okay, but that's actually like only like three people out here. Oh my God. Okay, JavaScript. Wow. Wow. We're in a revolution out here. Okay. Well, some stuff like Ruby, maybe? That's clearly on his way down. Okay. Oh, Python, of course. Yeah. Okay. All right. So we have like a mix of just about everything you can imagine. And now one more Julia. So fantastic. So I'm going to basically focus much of my talk on the numeric parts and why Julia and why scientific computing and those types of use cases. But I don't want you to believe that that's all Julia is good for. You can even build stuff like GUIs in Julia. So I would recommend that you listen to Shashi in the afternoon if you want to hear about how to build amazing UIs in Julia. So I'm not going to talk about that stuff. I'm just going to stick to numerical computing for my talk right now. And here's one reason why Julia, right? So you guys recognize what this is. I'm not without me showing the title of this document. Yeah. Scheme. Scheme. R6. Yeah. So this is a scheme language spec, right? This is this is exactly what it is. This is supposed to be the clearest, simplest language out there, right? I mean, you can't get any better at some level. Well, maybe you can, but you know, this is considered as a gold standard, right? If you look at the scheme specification, it's crazy how much of the specification is devoted to arithmetic and just numbers. Given that a programming language has a little bit to do with typically most programming languages, right? I have a lot to do with data, with control flow, with structure, with programming structures. It's I find it a little crazy how much is spent even in a minimal language on defining numbers and arithmetic. So if you look at, there's a whole section on numbers, by the way. So that's right here. I don't know how to highlight this thing out here, but but you get it, right? The section three has 10, two pages on just numbers, but that's not where it ends. If you keep sort of, you know, looking through arithmetic, 39 to 47, right? Eight pages of stuff on arithmetic. I think this is probably the largest section of the manual, like there's nothing else that is eight pages. Like errors and violation, right? Clearly, like that seems like an important thing to have in a language, right? That's like one page or macros, one page, right? I mean, such an amazing and important feature is one page. You know, pick anything that you want, right? Unspecified behavior. That's like that doesn't even have a full page of its own. But numbers have two pages and arithmetic has eight pages and then of course there's Booleans and all kinds of other stuff. Arithmetic and basic forms here again. There's another page on this. So good 10-15% of the scheme specification is tailored towards numbers and the behavior of numbers. And the reason I mentioned this is if you probably take all the code in Julia that expresses all the arithmetic and all the logic of numbers, it probably won't fill up eight pages. And this is the executable code that I'm talking about. Julia does not actually in its language at its core even define what these things are. Julia at its core defines data types as just a bunch of bits. So I can say that here's 32 bits and by the way tag them as an integer and now I will define the plus operator on the integer and the minus operator and the you know the sign zeros and the unsigned zeros and all this. So all of this stuff which you would traditionally consider as low level language features are actually not baked into the language at all. Arithmetic on integer should they overflow or should it saturate? I mean you can have a debate on this all day or maybe you don't care that's also possible. You know floating points you know how many types of NANDs should you support. All these little interesting little things that people care about are not actually sort of baked into the language. They are pretty much actually available in Julia. They're actually defined in Julia and just specified in Julia and I'll give some examples of that as I go along. So I'll just move on. This is an iPod on notebook. So let me pick a simple one to start with and go from there. Actually I'm going to start off with the one on arithmetic. So modern. This is one of my favorite ones and it's a little esoteric also. So now we jump into Julia syntax. What I'm doing out here is I'm defining. So this is a type definition in Julia. Julia has the mutable types and immutable types. So this is an immutable type and what we're saying is that we're defining a new immutable type called modern. So basically integers, modulo, some number and N out here is a type parameter. So this is a type that is described as describing all integers that are integers modulo N for a particular value of N. So for example modern 13 is a separate type than modern 15. This is a separate type than modern 25. There's a parametric type and all this says out here is how to construct, this is the constructor for the type and essentially just stores its value inside it. And this syntax says that it's a subtype of integer. So unless I specify otherwise it will try to inherit the behaviors of the integer. So let's execute this. I did that and then so modern 13 of this number, if I just do this, this is what I get. So this number modulo 13 is 4. So for example if I have 13 out here, 13 modulo 13 is 0. If I have 14 you would expect it to be 1. So that's what it is. And so on and so forth. So at this point let's maybe start mucking around with this. So I have A and I have let's say B. So can I do A plus B at this point? I cannot because I just created a new type and I have not told Julia what plus on these two things means. But I can actually. So in modular arithmetic the way I would do plus is I would you take the two values and then you add them and then you take the modulo of the result. So this is doing exactly that. At the same time let's do a minus. So actually let's now that I've evaluated this plus I'm going to run it again. And you know that's what happened with A plus B. Do you think this will work? Any guesses? Yes. So one is an integer and I haven't told the system how to add a mod into an integer yet. So I haven't done that yet. But I can do that. Let me just execute. So you know just like plus I can you know implement minus I can do star I can do the unary minus. And then by the way I don't like the way this is displaying right. So I'm just going to evaluate this line which overrides the show operator. So how this is actually printed. As soon as I do this now if I go back and do my A I got a nice. So all I did was overloaded the show method on on modern and said just printed you know this way. So I have an interpolation in the string where the type parameter is actually inserted into the string and the value is inserted from the type into the string. Okay. So this is A and this is A plus B right. So now we kind of we can make it look nice. All right. And this is the compact show. You'll see why I need the compact show. Okay. So here promotion right. So here is a promote rule. Now this is where I'm going to define to Julia that okay A plus B plus one did not work. Why did it not work because the the addition between a modern and it was not defined. Now this is typically you know promotion rules are typically baked into the language spec right at least for primitive numbers and for integers and stuff like that. In Julia they are just a bunch of rules that are that are told to the system by the you know with with statements such as this all this is saying that if you see if the system sees a type that is a modern and a type that is an in modern twins. Okay. And if modern twins then you have to be able to convert an into a modern at any given point in time. So this is a convert rule. Okay. So let's evaluate these two rules. So convert you can convert is a generic function in Julia where when you define a new type you can tell Julia how to convert an existing set of types to your type. So this line is telling Julia that if I get an in converted to a modern using by calling this method right. This can be anything you want. So for example all the conversions in Julia right if I had a float and an in or if I have to add a matrix and a vector or if I have to do if I have to add a string and something as well. The nasty stuff like that is you know not defined but but you could if you wanted to. So all these conversion rules and promotion rules are actually specified in Julia and what happens is that at compile time Julia will you know figure out the types of all its inputs and actually figure out what conversion and promotion rules apply and then go ahead. So now that I have done this right let's now that we have defined these two things. Let's move this a little bit up here. So we had a plus b which was working and now let's try a plus one. I have missed something now. Let's forget to evaluate some code. Okay I don't know if I want to do live debugging of what I messed up out here. Yes they are. So let's figure this out maybe spend a minute. Int is in 64 on a 64 bit platform within 32 on a 32 bit platform. Maybe there are some more methods out there that should work. I think I have run all this stuff in a wrong order so let me restart this notebook and do a run all. Okay let's see what happens here. Right that was supposed to not work. I'll delete it. Alright so it's working now. Right okay so I can do a plus 5. I think I ended up defining methods in a wrong order and that's probably why I put myself in a bad state. That's the problem with notebooks. Okay so now that I've done this I can do you know a plus five. I can do one plus a. I can do two a. I can do... So by the way the juxtaposition operator does multiplication in Julia so it's the same as writing two star. But here's the cool part. We didn't say anything about matrices at this point. Right so far we haven't said anything about matrices in Julia but we were able to do two times this matrix A which I think has been defined like right here. Right so this is a random matrix A that has been defined. Remember that I haven't even told Julia how to generate random moderns yet but it has been able to take a random matrix of integers, apply the convert rule that we wrote above and convert it to a matrix of moderns and that's what it got out here. And then A to the millionth power just worked because there is a generic implementation of the carrot operator in Julia which says if you have a matrix and you raise it to a particular number what happens. And if you have implemented all the underlying built-in operators it actually can compose them and do operations that you did not imagine it would be able to do. And so here's another one of those types. So this is you know this is basically I think this is a real power of Julia right that it's taken all the arithmetic all the all the mathematics that you need and abstracted it into a simple set of language features which can compose very well which are not baked in and that that the compiler can work with. And I think this is crucial right because finally when you want to write your machine learning algorithms or you want to write your image algorithms or your signal processing algorithms in most systems like MATLAB or R you have this this sort of you know caste system right that if you are inside the system if you are the R developer if you are the R compiler writer let's say the language implementer you have access to all these amazing first-class features that you can use for performance but if you are outside if you are if you're an outcast like most programmers are from the programming language implementer's view if you're an outcast you don't get access to all these amazing features in Julia that's not the case at all in Julia whatever's available inside is also available outside whatever the compiler writer uses is also available to the users and you can you can actually start looking into this stuff so for example which is the method that will get called if I do a plus one I can just say at which so this is a macro in Julia by the way so I can write a macro as all macros in Julia have an ad notation and this just told me that if I run a plus one it's going to call this routine and then I just click on this and I you know get sent to the Julia source P and I can actually look at its implementation all right so this is what happens when you do a plus B obviously you know if you get two numbers right of that can be of any type you just promote them to a common type and then add them so that's what's going to happen out here and then if they are of the same type what you do so this this is the method that does that and now you can face what no error does and and actually finally when you get down to the bottom of it let's let's see what happens so you can actually look at the code that gets generated so this is a code that got generated for a plus one actually I think this is a wrong matrix so I want let's just call it mod int of 12 mod this will generate too much code and let's keep these in let's say 15 so by the way I have been using modern 13 all along right now modern 15 is a completely different type so the Julia compiler is going to see this as a new type and actually generate all the code internally to generate a modern 15 what did I miss out here now so this is the code that Julia generated for for adding these two moderns that I gave it right or I can look at the LLVM that this generates actually let's look at so this is the lower deck this is the lower tree that Julia generate so this is this is the first phase of the Julia compiler getting into action the moment it sees that code this is what it does and then it will try to guess the types so here you will see that types are being inserted even though I didn't have types in my expression out here Julia is running his type inference analysis and it's actually beginning to popular types out here is a modern this is an H64 these you know what is k all that stuff and then finally you can look at the LLVM code that gets generated everyone here knows what LLVM is right is anyone who doesn't know if you don't I'll say a couple of lines okay LLVM is a compiler infrastructure so it's basically what you know is an intermediate representation that Julia generates and then LLVM takes it from there to machine code it's the foundation of a lot of new compilers today so this is the LLVM that Julia generates and then finally you get the native code and you can actually look at the native code and it's not hard to imagine that if you're in in most interpreted dynamic languages that that you would not get anything that looks this this type right for for something that was this abstract right a modern to a random modulo being added to another random modulo in with all the operators sort of implemented all over okay all right so the last thing to too much of modulo right but I'm wondering if you think matrix multiplication should work you have defined star and plus is that all the need to implement matrix multiplication what else what would be missing not a corresponding right so so there is a generic matrix multiplication already built into Julia okay right that much is there so in theory I think this should work but I think it does work actually yeah oh sorry the questions are not probably getting recorded is that the issue okay never mind yeah so there is a generic matrix multiplication implemented in Julia which is the trivial you know for loops well it's actually a little bit more than the trivial for loops the matrix multiplication is never trivial but but what it has is you know it will have the implementation of matrix multiplication going by the rows and the columns and all that stuff so long as your array type implements the indexing that it needs which is a of i comma j it implements star and it implements plus right so algebraically matrix multiplication all it all it needs is a semi-ring defined over a plus and a star operator and we have that so I gave it this random new type and you could actually do matrix multiplication with it in Julia right so this is this is really this is the power of of abstraction right that I'm now able to leverage all the things that I never even knew about a road because someone else has written them and this becomes increasingly powerful as people write packages and libraries in Julia that others begin to leverage okay so while I'm on this modern why don't I also talk about an interesting facet about matrix multiplication as this is one of another of my favorite topics and this goes to show the care with which we have built a lot of the libraries in Julia how am I doing on time I'm just kind of 20 more minutes okay all right so on the topic of matrix multiplication if I had let's just create a random matrix of let's just make them once you can verify the answer right okay so I have a is my matrix of once now and b is my matrix of once but of float 64 okay so that's what be looks like let's just put a semicolon to suppress output if I do okay so if I just square these matrices right if I if I take the first one which is a matrix of ends and the second one that's a matrix of floats if I square them which one should be faster and why sorry I'm comparing there's a matrix of once right that I'm squaring so a times a and then the next one that I will do will be b times b I'm taking a matrix of once same same two matrices as in as integers and as floating point value and I'm going to square them same operation just a different type inside the matrices would you expect something to be faster something to be slower may be the same pick technically in should be faster sorry exactly right all the amazing sim D stuff and word lengths and all that stuff you would expect it to be faster that's what I would also have thought and let's let's check if there was someone else who had some other hypothesis let's let's hear them all out no no we're not that smart yet not that not there yet eventually eventually in okay any other views okay alright so here's a here's a test now so this is the first time there is always a compilation that kicks in so at the jet compiler kicking in so there's always a little delay you always run everything the second time this took one second and let's do well you can already tell that it's significantly faster with floats right so 20 times faster on my Mac right very tough to imagine right why this would be the case and so the reason this is the case is because and this this is the 30 years of numerical linear algebra research there is there is a specification called the blast basic linear algebra subroutines which has one of its operations in the blast is a matrix multiplication operation and because it has been a standard for 30 years almost any scientific code written on last 30 years uses these photo and blast libraries is under the hood and the specification is implemented by each CPU manufacturer to have the maximum performance of those operations on those operations of course it only defines the specification for floating point and complex floating point value it does not when they define the blast at the second int in there you would have had in multiplication also be fast and by the all the SIMD magic is already happening under the hood out here in Julia if you look at the code my guess is you'll see it or if it's not there even if it was there it's going to be very hard to come to the close to this factor of 20 so matrix multiplication is an incredibly tough problem that people spend their entire lives optimizing and you can benefit by it just by using Julia by typing but by just using float 64 the float 64 version is using blast and the blast that we use is called open blast actually which is from these guys which was from these guys in China at one point but Intel has a has their own blasts AMD has their own blasts IBM has their own blasts it's really a standard that just works and you just plug in the right blast for your CPU and like boom like code just become 20 times faster as compared to the reference blast which will be even slower than this so here's so you know so there's all this sort of all this knowledge or all this amazing folklore about numerical computing that you know you probably don't know or you probably should not even care about right I mean this is esoteric stuff but if I just told you that if you work with matrices just use floating point and the far the best fastest things will happen under the hood that's pretty good right I mean you know that's how you stand on the shoulders of giants right someone did the work and you know someone else benefits from it right and not only that I can even do an SVD of this now right I can I can compute an SVD factorization of this I can I can I can compute principal components analysis I can do all this amazing algorithms I can once I am a PCA I can put it in a computer vision algorithm from a computer vision algorithm I can build a self-driving car I mean the list just kind of goes on and on right at some level but if as you peel layers from just about any sophisticated numerical code you will find yourself coming down to these basics you find yourself coming down to matrices numbers bits operations on them and you know leveraging a platform such as Julia I think is a lot of power alright so I've touched upon a little bit about the language features right about what Julia does about its numerics about about the language I I think you guys have got a feel for what the language also looks like at some level now if you use MATLAB it looks quite a lot like MATLAB that's the most popular numerical language in use and the syntax is friendly if you are a chemist you will not run away screaming looking at all the parentheses in this that usually is what happens if you're a python user the language you know minus the indentation it kind of looks similar so not not so foreign right if you come from our probably you'll be happy that all those dollar signs are missing and not an eyesore that is that's what I feel if you come from see the syntax actually feels very similar and familiar in fact your mental programming model if you're a C programmer or if you ever programmed in C your mental model of performance will transplant directly to Julia so it's passed by reference for example and not passed by value that a lot of dynamic high productivity languages are so everything that you have in your mind about programming C and doing you know good C programming if you just use the same tricks in Julia you'll actually get code that runs as fast as C but is written in Julia okay so let's get rid of some of these things and move on to other things all right so this is great here's a fun did you guys know that you can have there is actually a batman curve there's actually a mathematical function that defines batman okay so here's what it is this is what it looks like these are the bat functions and this is a plotting code that that takes different parts of the bat curve and plots it and that's the batman curve okay this is a real thing I'm not making it up okay like you can Google it so yeah yeah let me touch upon that so this is the batman curve so this is using matplotlib from so in Julia you load modules with with using and there's a package called pipe plot which that wraps the entire matplot live from python so we don't build all the stuff that we don't have to but there's another amazing package called gadfly which which is completely implemented in Julia and I'll show some demonstrations of that as well but this particular example is just a fun thing that you can take your mathematics and look at this function right I mean there's a bat curve it's kind of like that right I don't know what you call it upper cup what would be the liquid this is not a carrot by the way so another thing in Julia you can actually use all your full unique code set is available for you to go crazy on you can even do stuff like I'm doing slash alpha tab and you can do well I didn't want to evaluate the plot but you get the idea all right so that's batman for you let's leave this let me touch a little bit on parallel computing I'm just going to sort of touch upon a number of different topics of course I can't run this because I'm not I have not booted up this platform you know my EC two instances with a thousand cores but you could if you if you have a cluster with SSH access it's trivial to come you know make it part of a larger Julia cluster you can add your workers count them and then just sort of start doing operations so for example here's something you would have never imagined to be able to do in a in an interpreted I mean in a in a dynamic language right this is a parallel for loop running over of a not a billion over a trillion coin tosses okay so each processor is doing a billion coin tosses out here and it it all got done in ten seconds so Rand bull generates a random boolean value this promotes it when integer and this is your map in some sense and then this is your reduced operator and I stick an ad parallel in front of it which is a macro that takes this loop identifies you know this range splits it up assigns it to different processors and then the at time macro just wraps it in a time so this is you would not even do one colon ten to the six on a typical python thing right you'd never write a python program that iterates over anything that's ten to the power million I mean ten to the power something or in millions right Julia of course is is a jit compiler so I mean yeah you would not mind doing this in C for example if you don't mind doing it in C you should not mind doing it in Julia and this is an example of the other interesting thing about parallel computing I'd like to point out is that this is a new area it's an area of active work and research but all of Julia's parallel computing libraries are actually implemented in Julia itself there's nothing special under the hood it uses the same IO frameworks that are available you know socket communication shared memory communication all the stuff that's available to everyone else it just takes that and builds that up into a higher-order constructs for doing parallel computing so we have distributed arrays we have a parallel map we have you know remote references all kinds of parallel models that people are playing around with and and and then you know oh and by the way we are also adding multi-threading so Julia is almost thread safe now which means you can actually start this is actually running as multi-processes if you do parallel computing on your desktop also you'll end up spawning multiple Julia process and doing IPC amongst them but as soon as threading will become so threading we just branched off Julia 0.4 so 0.4 will release in three weeks from now or four weeks from now and multi-threading will be available as an experimental feature in Julia 0.5 probably in the three to six months time frame it's already available on master if you wanted you just need to know what make file flags to use so a lot of work going on in the parallel computing domain okay next one I'm going to I'm just going to focus on more of the algebraic and linear algebra stuff I think if you want to hear about Julia as a programming language Shashi is your guy I think you should you should hear his talk where he'll touch upon some of those things what a singular value decomposition is if you don't know what a singular value decomposition is raise your hand okay I think that's pretty much everyone but you heard about it in your college when you wondered why the hell I have all these matrices and do I really have to deal with them okay the singular value decomposition at its core is just it's a matrix algorithm you take a set of matrices and you decompose them so that a equals u times s times v okay that's it's just a factorization that's all it's doing but the important factor is the important point about the factorization is that you get a set of orthogonal vectors which represent your space so what you can do with a singular value decomposition is basically I can do an exact decomposition which means if I multiply the factors I get the exact results back or I can say that you know what I don't want all of them back let me let me do this on the command line I just find it easier to use Julia on the command line often alright so let's just say that this is you know 5 by 5 matrix just take a random 5 by 5 what the hell let's take a normalized you know and n 5 by 5 random n is from the normal distribution random is from the uniform distribution if I say SVD of a I can I get u sigma and v so I get this u matrix I get this s which is the singular value so and I get this v now the way the singular values come out in a singular value decomposition is that they are sorted from the largest value to the smallest value and without getting into the math what you can say is that I don't want a full decomposition I just want a partial decomposition in this case let's just reconstruct the matrix a using these two values right because the the remainder of them are not as large as the other ones so the basic idea is I can construct an approximation of the original by using its factors and throwing away much of the information and I just keep the information that corresponds to the largest value in some sense you know if all of these values were one then it would tell me that oh you know you really need all this information to reconstruct the matrices but in this case it's telling me that clearly the last one is not that important at all compared to the first two so let's just say I'll take the first two so I would have to take you off I'm just going to use the first two so from the you matrix I'm going to take this then I'm going to take two out of these and I'm going to take and reconstruct the original I think I've messed up somewhere I think I need to do this and then I need to do this so that I get the 5 by 5 then if I do minus a so I got some approximated version of this you have to do a transpose I mean just see if I can get this okay I always keep forgetting the transpose has to go on or not but this is a low-rank approximation right now it's it's not easy to see what's happening with these numbers right but you got the idea but let me show what happens with with a picture so this is Gil Strang this is one of our common demos that we use and we love people heard about Gil Strang anyone use this linear algebra textbook I think there's already one person there's two people yeah several people out here right yeah but probably most of us have used the shamp series or something something like that I suggest go and just Google Gil Strang linear algebra lectures and you know your world will change probably at least it did for me when I did that okay so that's Gil Strang out there so this is Gil Strang in red greens and blue and now what did I mess up I think I did a PKG dot update which I shouldn't have done sorry I think I did this is a colors package that got updated last now for me okay let's just run this whole thing again and hope it's work I think this should be colors right let's do one more restart if this works great otherwise move on to the next I think it's a really cool demo I really wish it could work okay so that's the first second and let's see yeah okay all right so at this point I'm reconstructing that image that I loaded right so these are the the red greens and the blues out of that image and I have a for loop which which is using this package called interact that shashir has built and that gives me this slider so I can move this slider around and pick a value from the slider and based on the value that I pick I can reconstruct that image with that many components so for example when K is one you get this so if I wanted to reconstruct that image with just one principle component over the word one principle piece of information that's what I get so this is you can kind of see this is like two vectors being multiplied right because there's a vector dog going down this way and there's a vector going down this way and you know you see this is this is the kind of pattern you see if you just multiply and take a out of product of two vector but now as I add a second vector right so this is this is a matrix multiplication happening under the hood right but what's really happening is that I had I'm using two singular values right so I have an outer product of the first set of vectors and now on that I'm super posing an outer product of another two vector so I've added more information to it and as I keep increasing this at seven you can pretty much tell that this is probably the same image right the original image to reconstruct would need 300 of these but pretty much we are able to throw away and if you go to like 20 right I mean these two images are a pretty darn close right already and I go to like 30 it's becoming pretty hard to tell now right it is even changing much right so this is this is the power of of linear algebra right I mean and this is signal processing image processing whatever you call it and and these are all the things that we sort of build on Julia one on one on top of the other I'm going to take another last quick demo on this fluid images I just like showing images because it's nice to look at in a demo otherwise looking at numbers is kind of boring this is this is another one of chassis notebook actually so this is this is the conference right this is our conference thing let me just run this whole thing so what is happening here is this is a this is a this is an image seam carving demo and what it's doing is basically is finding the lowest energy in a lowest energy seam in an image and the idea is that if you remit if you remove the seam you're removing the lowest energy part of the image and without going into many details about it I'll just show what happens that's that's kind of the most fun so this is what a seam looks like so the slider picks where the starting point is so I picked the top of the first line of row of pixels for the start up start my computation from there and then it will sort of go down and figure out what the seam should look like for example if I start at a different point this is what the seam looks like okay so these are all the seams possible in this image and the idea with a low energy seam removal is that if you remove these seams you are losing the least amount of information in the picture as you compress it visually so for example let's go down where this thing is yeah so this is the full image this was the original thing that I started with and now we every time I'm moving this slider whatever is that red line is being deleted okay in real time I'm kind of doing this and then so the visual compression of the conference logo you can kind of tell right you could tell that this was the original one but it's kind of being squashed now but you can still all the key icons are there all all the dates all the text the image did not get removed right I mean so this is this is a typical seam carving algorithm that gets used for these types of things the interesting thing is that if you do this in python you could not even use an image this large for doing it in real time you'd have to something that's like really tiny because it would be really slow Julia you could actually have a much bigger image and do it in real time okay so yeah alright so I think I'm going to stop at this point hopefully have given a sort of a good flavor of what Julia is under the hood why Julia is the way it is under the hood why it's good for numerical computing the amount of care that you've taken to build these things and over the last three years you know it's all these amazing contributions from the community the core Julia project on github has actually over 400 commitors just Julia itself there are 600 packages and you can call almost every python our package from Julia so pretty much the entire world of numerical computing is available at your fingertips in Julia with all the performance and productivity and with that point as we take any questions if there are yep you can use the mic I think people so a lot of some of the stuff is really awesome to look at the my question is more around what are the next plans what is the focus of the language going to be more around parallelization and numerical computing SIMD the scientific computing side or will there be constructs around some of these things going to any other area what is the core focus of the language because like for instance the matrix multiplication that we showed awesome but want to understand if that can be used to do some other kind of task right what's the focus you mean like a non-numerical task yeah okay so as the language evolves what we are going to do is we started out with a language with a focus on numerical computing that's that was our background that's where we came from but what we found is that as we evolved Julia it has become an amazing general purpose programming language and one of the things that actually going to happen as we go towards one point over is that the mathematical libraries will be detached from the base so the base of Julia will become very small the core Julia language compiler runtime will become tiny incredibly small compact very low memory footprint that can be put into a web server it can be put on to a device it can be just about anything the mathematical library will will continue to be part of it but maybe a module so you'll have to import it but also in ways that you can replace more and more of it right I just showed a few things and we'll make it more modular more replaceable so that even fancier data structures can be easily brought in without having to have everything in base there will be an increased focus on multithreading and parallelization for sure that's a key focus for us at the same time we will improve our GC and a memory footprint so that we go down to even lower form factor today we are already on arm you want to run on even constrained more constrained form factors as we go along as well as run it on the largest data sets terabytes of data that you can imagine so design will become increasingly sharper cleaner nicer another key thing that's coming out two pieces which are incredibly important for our language ecosystem one is there's an IDE which is based on atom that will be adopted as a standard by the community and the second thing that's coming out is a debugger close to release and there'll be by the way it's been incredibly hard to get a debugger for language like Julia which is completely jittered and is using LLVM and we find ourselves fixing a lot of LLVM and compiler bug that Apple and Google are not fixing to make a debugger work but but it'll be there and in the next couple of months you'll have a real debugger along with it so that's the in short what all will happen as we go towards one point Julia will be able to overtake Python do you want to do that at all and if so what do I mean more specifically what is it going to take I really don't know I mean would I want to be as a creator of something yes of course I'd like to see white scale adoption will it overtake Python it's a hard question to answer I really don't know I think Julia clearly has a niche that it's good at and I think in that niche it is definitely I already can see it becoming a dominant force going forward so will it even replace all the MATLAB and our codes that are out there obviously not right nothing ever gets replaced in computer science you just add more stuff right and the same will happen with Python actually we have an amazing coexistence so Python calls Julia Julia I mean we actually have demos of Julia calling Python calling Julia calling Python all the way and I think as we go forward there will be closer collaboration between the two communities I don't see Julia replacing Python in any way actually to be honest right right exactly right I can pass my raw data I can do my very advanced signal processing stuff and you know push it on to a database and on a web backend or whatever it is I didn't I don't I didn't show any of that stuff but all that is possible today excellent all that is already possible today at a much higher performance that is available in Python so there are always things like pandas which are really good and you know which have been written in C so we always are catching up to that but our goal is not rewrite a whole bunch of internals in C and match Python speed when we are slower we say what do we do to the Julia computer compiler so that it becomes as fast as writing hand-coded stuff in pandas so we may not be there now but the workflow that you said is is 99% already there and whatever is missing it's a few lines of code that you can always write in your own application so database wrappers are already there in fact we are going to so I am a co-founder of Julia computing with support Julia and all of our customers actually want this right they say this is great great prototyping environment but we want to put Julia in production so database wrappers for no SQL database people are beginning to ask my SQL Postgres has just become pretty much standard there are web servers in Julia this Julia box out there so all kinds of amazing stuff already exist and I couldn't showcase all of it but all of this will be showcased at JuliaCon Bangalore which happens October 9th and 10th almost a month from now and I would really encourage you to try out Julia and submit a talk about your experiences with Julia I think it's going to be run by Hasgeek so the funnel will open up like a couple of days it already opened the funnel is already open it's not publicized yet JuliaCon.in yeah actually why don't I just load that while someone else might have to see please feel free to cut us off yeah oh yeah I should show c call so it's trivial to call c programs from Julia and let's just do that right away c and the same applies for Python as well by the way everyone knows the clock function from the from the standard c library right it does it does anyone have Julia open well you already know okay the last one and then we'll move on so you don't need a c compiler to call any c code right typically in most programming environments you have some wrapper that generally and then you have a c compiler that will create some dot SO and then you load it and like all this process that happens this is how you call a c any c function from Julia and you can pass in any inputs you can have any return values out can do all sorts of crazy stuff so literally just interactively by the way I can also this is not going to work but let me try it anyway yeah I broke my build sorry you can actually do interactive c++ from Julia this is really cool like I there's nobody else who can do that except some guys at CERN they have their own system for doing this because of like the crazy amounts of data the hardened collider generates but you can actually so we have a collaboration on going with them you can say using cxx and then you can say include IO stream and hit enter and it will evaluate it and print it and you can say see out hello world on the Julia Apple like right here and and it'll just work that would be another thing that we do really well yeah thank you very much all right thanks for coming in today this morning and helping us understand little more about Julia hopefully you guys got a kind of quick preview into the language I would encourage you as we pointed out to kind of go in Julia box are we doing a Julia Julia box free version like last time we did now it's open for everyone last year we sent out after the conference whoever wanted to sign up a sneak preview into it but now it's available online so anyone can go look at that all right cool thanks again