WEBVTT

0:00:15.539 --> 0:00:23.385
<v A>Hey everybody. So if

0:00:24.263 --> 0:01:20.980
<v B>you're following Hacker News or you're following these various sources, you've probably heard about Scientific Python. It's becoming a really important way for people to try and do numerical computation and solve really difficult problems. There's a bunch of really awesome libraries for that, and we'll definitely cover that in detail. And we have Guido Imperiale here from Coiled to tell us kind of more about it. So Guido is an open-source software engineer for Coiled, and I think we're all really grateful for having Guido on the show to lend us his experience and expertise. So thanks for coming on the show, Guido. Hi, everyone. Cool. So before we dive into what is Scientific Python, why don't you give us some background about what have you been up to? What kind of led you to Coiled, and how did you get involved in Dask and in the overall SciPy community?

0:01:21.419 --> 0:02:14.254
<v C>Well, I have done something years in risk management in banking and insurances in Italy and UK. And what risk management is about is simulate all financial instruments or the whole balance sheet many, many times. And a lot of financial institutions use obscure closed-source software, which tends to be very, very slow and inefficient and really unwieldy. So in one of my previous jobs, I was faced with this software, and I decided, nope, I'm going to rewrite it from zero. And I needed a really, really big hammer to break down the problem. And I realized that Dask was just right. Cool. So why

0:02:14.828 --> 0:02:36.480
<v B>don't you dive into that a little bit? So I've heard stories of banks running their own version of Python. I think Patrick, you mentioned this in an earlier episode, there's like Bank Python or something like that. And so what about closed-source software at the companies you were at? What about it was sort of unwieldy and difficult to use?

0:02:36.860 --> 0:04:00.415
<v C>First of all, it was a piece of software designed 30 years ago, back when multi-threading was not a thing. So first of all, it's all traditional design of have an iteration on a single point, go through to the whole depth and then go back. It had no benefit whatsoever from SIMD and AVX or parallel multi-threading. It would be really, really painful. It was written in C++, but that was the only saving grace. And then that was the simulation part of the software. The aggregation part was written in Java, and it was even worse. To give an order of magnitude, the reporting part was taking five days over to run every time—five days exercise with two people who did nothing else but throw kicks at the software whenever it was hanging. And it was running on 20 hosts with 380 gigabytes of RAM each. We are talking about now 10 years ago. So that was expensive hardware. Wow. Yeah, that's wild. And I came, ISO, I rewrote. And by the time I left five years later, that exact same algorithm instead of five days and the 380 gigabytes of RAM was running in two hours and 20 gig.

0:04:01.022 --> 0:04:22.977
<v B>So this is interesting. So you saw this, you know, huge Java C++, you know, kind of monolith, right? And yeah, I mean, it's really inefficient. How do you get started on a project like that? I mean, do you sit down and write a document explaining every bit and piece? Do you start by converting small pieces? Like how do you go about

0:04:22.977 --> 0:04:26.031
<v A>doing such a transformation? Okay. First of all, in

0:04:26.031 --> 0:04:50.534
<v C>any such kind of environment where you have a massive piece of software—that legacy software that you need to tackle—forget about rewriting the whole thing in one go. You just can't. You will fail. You will end up in a five-year project that never delivers and management will pull the plug on it. Guaranteed.

0:04:52.373 --> 0:05:14.749
<v C>So it is imperative to follow a bit of mantra of Agile and deliver as small a piece as you can every time to keep stakeholders happy. And that piece needs to integrate as good as possible with the legacy software. And yes, that means that you will have 20% of throwaway code, but it's

0:05:16.319 --> 0:05:37.560
<v C>the way to go because at all times during this transformation process, which takes in the end, it takes five years—don't get me wrong. Stakeholders can see, 'Oh, now this little piece was rubbish and now it's super fast and super stable.' And they start getting their appetite wet for the next big thing. And they will be happy to keep bankrolling your project.

0:05:37.560 --> 0:06:02.033
<v B>Yeah, that makes sense. Yeah. I think one of the challenges is where you have—there's this sort of meme. It's like, yeah, there's 18 different messaging platforms. I want to make one that unifies them all. Now there's 19 platforms, right? And so you're going to, in the short term, kind of add another piece. Actually, so this new, the rewrite that you did was that—that was using Dask and Python, correct? And Dexaray,

0:06:02.033 --> 0:06:02.540
<v C>Yes.

0:06:02.540 --> 0:06:13.220
<v B>Okay. Got it. So, there was a moment there where you had to kind of convince people to add another language and add, you know, complexity to that project. How did you go about doing that?

0:06:13.260 --> 0:08:12.392
<v C>That was actually easy because I did not start from Dask. That project was around this third-party software within C++ and Java. There was an ungodly amount of Bash and Perl scripting. And which, if anybody had the pleasure to work with it in a serious, among serious size, it's impossible to deal with. As soon as you get beyond two pages of code, Bash becomes unusable. It becomes untestable and really, really hard to read. If you have a newbie programmer on the team, they will not understand why parentheses space works and parentheses without space doesn't work. So it's really, really bad. And Perl is, well, I mean, there are actual competition about obfuscating Perl, and I leave it at that. I've seen Perl stuff. I've seen things that you mortals cannot even comprehend. I've seen Perl programs that generate at runtime Perl regular expressions of five pages, which are then fed into a second Perl interpreter to parse the actual content. Yeah, this is brutal. It's insane. So that was the situation I came in and I realized, nope. And I started rewriting piece by piece, script by script. We're talking about thousands of individual small scripts, everything in Python, adding tooling on top of that, or a customer-specific tooling. Some of which, by now, by the way, it is now open source. Look up PShell on PyPy. Is it BShell? PShell as in Python Shell. PShell. Oh, oh, okay. Got it. PShell. Not to be confused with PyShell or Python Shell or any

0:08:12.392 --> 0:08:24.019
<v A>Of the other variations which were taken. Oh, so how do you spell this? How do you spell your version? PShell. Oh, just PShell. Okay, got it. Got it. So, I started with that and

0:08:24.019 --> 0:09:11.800
<v C>I started rewriting a lot of those individual small scripts which were glued together by Linux. So it was very easy to take one out and put the replacement in, which was like for like, just better working, faster, easier to maintain with unit tests and whatnot. And by the time I replaced the majority of those, I had a common library that was, and the common library, common tooling and a common learning for my whole team, which was 10 people, of their Python language, which I say, okay, now we have a solid foundation. We can start seriously building stuff that is, we built a round path. Now we can build a rocket.

0:09:11.800 --> 0:09:22.599
<v B>Yeah, that makes sense. So were there any people who were just really sympathetic to the current version and you had to sort of win them over or was everybody pretty happy to get rid of the current version?

0:09:22.599 --> 0:09:54.440
<v C>Everybody was very happy to get rid of Bash and Perl. There was an initial problem with some management that forced us to use Python 2.6. That was back when Python 3.3 was out already. So that was a very bad decision, and we had to pay that technical debt because of that decision for several years to come. After many years, we just replaced everything with 3.6 or something.

0:09:54.440 --> 0:09:59.080
<v B>Yeah, that makes sense. Did Python 2 have typing, or did that come with 3?

0:09:59.080 --> 0:10:01.709
<v C>No, it's got nothing. It's got absolutely nothing.

0:10:01.720 --> 0:10:08.360
<v B>Okay. Without typing, I can't imagine writing any serious Python, like more than two, 300 lines.

0:10:08.360 --> 0:10:27.400
<v C>No. As a matter of fact, we wrote the whole thing before typing was a thing. But typing is very recent. It started being usable around 3.5-ish? Let's say 3.6 really. And they're adding fundamental bits every version.

0:10:27.400 --> 0:10:40.360
<v B>Got it. Yeah. I feel like before that, people probably just were heavy users of like isInstance and asserts and these other, just basically runtime, having to do the typing at runtime.

0:10:40.360 --> 0:10:45.240
<v C>Well, you still do that. I mean, but yes, typing helps a lot, of course.

0:10:45.240 --> 0:11:09.080
<v B>So, you know, we have this big rewrite effort along the way. At some point, I guess you built the launchpad to your point. And then you said, now we can change this from being, I guess, pure Python or just using like lists and dictionaries and all of that. Now we can change it to doing more Blahs-type approaches that are going to be much faster.

0:11:09.080 --> 0:11:29.880
<v C>No, it was not pure Python. It was like Python scripts, which were wrapping around the closed source C++ and Java code. And what I did, it was Python scripts who were wrapping around the Python engine, which at that point I rewrote in-house together with my team.

0:11:30.760 --> 0:11:35.240
<v B>Yeah. And so, how did you, what was the rocket ship then? How did you make it fast?

0:11:35.240 --> 0:12:29.297
<v C>Yes. The biggest challenge was to understand what the previous software was doing, which was neatly outside of a domain of the education of any software engineer. The problem in a bank, chiefly, is that the people that know what the algorithm should do are people that if they know how to use R, you must be already happy. Most people just know how to use Excel. Those are the people that know the algorithm, know why you do the numbers in the way you do. And then those people just give their algorithm to the developers, which know how to write very good software, but know nothing about subject matter. And they're told, here, here's my Excel sheet, put it in production. And you would be shocked to hear how many financial institutions have

0:12:31.255 --> 0:12:39.000
<v C>at some point in their pipeline, an Excel spreadsheet, which is executed from the C-sharp macro or something.

0:12:39.000 --> 0:13:10.962
<v B>Yeah, I believe it. Yeah. I mean, we saw this, Patrick and I saw this a long time ago with Matlab, where there would be people who would be really good at Matlab, but then couldn't do any embedded code or things that were really needed to run in low memory and these other things. And so you end up having to sort of translate. And then you end up with two teams, like the team that can build things and a team that knows sort of like the mathematical essence of whatever they're building. And getting those teams to work in

0:13:10.962 --> 0:13:14.033
<v A>harmony is really, really difficult. In

0:13:14.033 --> 0:13:29.339
<v C>fact, and because of these hybrid figures engineers on either side. So what are normally called financial engineers, which are people that know the subject matter and have a decent, although not amazing understanding of coding. And people like

0:13:31.320 --> 0:13:39.362
<v C>me, which are software engineers, which over time learned what they were doing, are in very high demand in the financial

0:13:40.172 --> 0:14:17.160
<v B>industry. Yeah, that makes sense. Okay. So you wrap these C++ modules and Java modules, and then at some point, I mean, to get the memory down and get the speed up at some point, you probably had to rewrite those underlying modules. Right? And so that's where the scientific Python comes in. Correct. Right. Got it. Okay. So someone looked at this C++ code that was, I don't know, maybe using Eigen or maybe it's just using raw matrices, raw arrays, and figured out a way to rewrite it using like NumPy and SciPy and Dask and that modern suite.

0:14:17.160 --> 0:15:15.702
<v C>Yes, more or less. Once you have the algorithm on paper, you can start thinking, okay, why is the current algorithm so slow? And how can I write it in a way that is fast? And as I was mentioning before, the immediate thing that jumped to the eye is that this C++ software was written before SIMP existed. So there was no vectorization of any kind. And the Java one was that expensive expensive in terms of memory, because it needed to load as an input 50, 60 gigabytes of data. And then it needed to do successive iterations on that. And it was very obvious that at all times, it was keeping the whole thing in memory. So Dask is very, very good at this,

0:15:17.558 --> 0:15:28.360
<v C>namely, where you can have a baseline data in on disk, and you can load into memory just a little piece you need, crunch it, and then release it.

0:15:28.360 --> 0:16:13.161
<v B>Yeah, that makes sense. Yeah. I mean, if you need random access, then running on something like Dask, where it's distributed, is really nice because you can still get the random access, but you don't need everything on one machine. What about, like, you know, when somebody has something that works in C++, they have to rewrite it in Python? Did you create sort of a, almost like a, like an automatic test suite? Because you could take the existing C++, generate a bunch of output, and then go to the engineer and say, 'Look, we want this output to match these numbers.' And so now they have kind of like a built-in nice unit test ready to go. And so you kind of know when you have something.

0:16:14.106 --> 0:16:35.560
<v C>That's correct. Yeah, absolutely. You can't don't even think about starting a rewrite of this kind of magnitude if you don't have thorough unit tests for the legacy software. You need to design the whole thing so that it can slot in, yank the old piece, put in the old piece, and you don't touch the test, and they just continue working.

0:16:36.600 --> 0:16:46.962
<v B>Yep. Yep. Yep. Totally makes sense. Cool. So at some point, you kind of rolled off of this project, right? And joined Coil. Did you go?

0:16:46.962 --> 0:16:49.560
<v A>To Coil straight from the banking company?

0:16:49.560 --> 0:17:58.124
<v C>Actually, no. I spent a couple of years in an oil trading company, which they told me—well, we have this, they told me they had this 20-year-old Java software, which again was unathomably slow. You already heard that, didn't you? And they told me, 'Rewrite it, carte blanche.' As long as the numbers, as I say, many is faster and more robust, you have carte blanche. And so I started with a clean slate, which was super exciting. And I used Spark again, this time not for vector computations because it was unnecessary, because it didn't have Monte Carlo simulations to run at least in the first iterations. But for managing the complexity of the problem, I used the distributed scheduler to organize the workload with great results. And again, I was computing the whole thing in a fraction of the time.

0:17:58.680 --> 0:18:14.965
<v B>Yeah, that makes sense. Okay. So, and then from there you went to Coil, is that correct? Correct. So, so what inspired you to do that? So, so you could have gone to like a third, a fourth, a fifth company and done, repeated this pattern, but instead you went to Coil. What motivated?

0:18:15.437 --> 0:19:21.790
<v C>First, I was motivated by the company culture. I knew Matt Rocklin because the reason why I was scouted was that for the whole years in my previous two employments, I was a heavy community contributor into Spark as you would expect and into XRA. So, Matt told me, 'Hey, I really like your PRs. Would you like to do just that for a living for me?' And I really liked the way that his team worked from what I could see from the outside. I was seduced by the fact that Coil is a 100% remote company. We are now talking—we were in the middle of 2020. And I was enjoying my working in my pajamas. And I said, 'Wait, what do you mean? That as soon as the pandemic is gone, I have to start doing two hours of commute again every day?' And I said, 'No, I really like my pajamas.' And so I just—that makes sense.

0:19:23.123 --> 0:19:41.000
<v B>Yeah. Some people who are, you know, people who don't have, who are just listening to us can't tell, but we're all in our Scooby-Doo pajamas right now. So just close your eyes. Well, unless you're driving—if you're listening to us driving, don't do this. But if you're at home, close your eyes, just imagine a group of people in their pajamas. That's, that's pretty much what's going on.

0:19:41.000 --> 0:20:05.969
<v C>Back then I was—I had this idea that I could potentially switch the country I was living in. Right now I'm living in the UK and I was thinking, 'Okay, do I still want to live here?' But the idea of having being able to change country, which is a massive stressor and time sink while keeping my job with Seamlessly was a really big.

0:20:05.969 --> 0:20:07.470
<v A>Appeal. Yeah, that makes

0:20:09.040 --> 0:20:30.269
<v B>sense. Yeah. Both Patrick and I moved also, moved during the pandemic and we stayed in the same country, but we moved to just a different part of the US. And yeah, that's a huge appeal. Do you think people—a bit of a segue—do you think people ever go back to the office? I mean, how do you motivate people to do that? Seems like that's going to be a really uphill.

0:20:30.572 --> 0:20:51.092
<v C>Battle. Some people enjoy going to the office. I heard of several people with young kids that beg to go to the office. Yeah. And some—a lot of people really enjoy the social aspects. I miss them. I miss having a few days a week where I just.

0:20:53.438 --> 0:21:02.360
<v C>You know, chat with offices, with coworkers at the water cooler, go out for lunch and whatnot. I miss those bits.

0:21:02.360 --> 0:21:35.963
<v B>Yeah, definitely. One thing that I've been trying to do is to maybe once every couple of months fly to the office and see people in person. And maybe that's the future. I mean, if I work at a company that has one big office and then a bunch of satellite offices, but if your company is totally remote, maybe every two months, everybody flies into some place in the EU and meets up, and you can get, you know, sparingly, but you can get some of that interaction and still work from home.

0:21:35.963 --> 0:21:37.482
<v A>I think.

0:21:38.039 --> 0:22:16.200
<v C>That this is a massive opportunity for co-working spaces. I think that there's a massive amount of people that are in my same situation—that my closest coworker is two hours from train away. The second closest is three hours by plane away. And it would be nice to be just in an office space where I can have water cooler chat and possibly go out and have lunch with somebody that is friendly, even if I am a software engineer and they are a fashion designer. Why not?

0:22:16.200 --> 0:23:06.025
<v B>Yeah, that's a good point. You know, I'm in a co-working space at the moment, and there's not really anything that binds the different workers together. You know, we all have our own—I mean, for security reasons, you know, we all have to have our own key. So I can't go into some random company's office and bum around, but you know, the common spaces are pretty much empty. And I think that you hit that on the head. There's an opportunity there, you know, and like, it'd be nice if the building had some kind of events for anybody who is working there. Right? Yeah. Cool. Okay. So let's dive into I want to learn more about Coiled, but let's put a bookmark in that for now and dive into the topic: What is scientific Python? You know, how is that different than Python? Like, what is

0:23:06.025 --> 0:23:11.965
<v A>that? How do you define that niche? I would define it with

0:23:11.965 --> 0:23:50.119
<v C>anything that involves very large numerical computations, which means science proper, like geoscience, weather analysis, but also you have AI artificial and machine learning. You have finance. All that—all that requires gigabytes and gigabytes of data graph resolution of some sort, like, for example, social network analysis. That is also scientific computation. Got it. So

0:23:50.912 --> 0:24:08.840
<v B>What are the sort of main tools that people use? We talked about Dask. Dask is definitely one of them. What are some other tools that people use where, you know, for example, if you were trying to hire somebody who is an expert in scientific Python, you'd kind of expect them to know about these tools?

0:24:09.960 --> 0:25:42.920
<v C>The library that everybody knows is Pandas. That is the baseline. There's Pandas, there's NumPy that is below Pandas, but is also has a different scope. So Pandas is all about data manipulation, tabular data manipulation specifically. So you were using Excel and now you're using Pandas, and it's better in every possible way, but it still looks and feels like Excel. NumPy instead is about matricial computations and this kind of heavily vectorized algorithms that have potentially many, many dimensions that you can move along. And there is very high interoperability between the two. Again, Pandas is built on top of NumPy. So you can have an advanced NumPy algorithm that runs on Pandas. SciPy is also on top of NumPy. It's just extra functions that are more niche, like statistical analysis and whatnot. If you put everything together, you will end up with something that somewhat resembles R, although R is still king when it comes with really, really exotic algorithms that only exists in one paper circa 1996. That paper had a code attached to it, and you can guarantee that code is in R.

0:25:42.920 --> 0:27:40.600
<v B>Yeah, that's a good way of explaining it. So yeah, at a high level, the reason people use Excel is because tables are probably the easiest way to think in a vector, with a vector mindset, right? And the reason why that's important is because if you do an operation on a vector, that vector can be very large or even unbounded. You could work with it in an atomic way. So for example, you know, if you look at R or MATLAB, you can have two matrices. The matrices can be really high dimensional, even arbitrary number of dimensions with respect to your program. And you can just do A plus B. And as long as the dimensions are equivalent, or even sometimes if they're not, there'll be some fan out operation. But in general, as long as the A and B have the same dimensions, you just do A literally in your code, you write A plus B, and you get the sum of those two. The other part of it is, and people can try this. If you grab Octave, which is the open source MATLAB, or if you grab MATLAB and you do, you have two vectors, you do A plus B, it'll be done like super, super fast, right? You can also write a for loop in MATLAB and you can say, for I zero to the size of the vector, C is equal to C of I is equal to A of I plus B of I. And that will take forever, right? So what the reason is because when you do A plus B under the hood, it's not just a for loop. It's doing a million other things to make that addition super, super fast. It's taking advantage of the different process, like coprocessors and your processor, like the SIMD and these other coprocessors. It might be running on the GPU, you know, depending on if you're using something like JAX or one of these things, it'll actually farm that out to the GPU on the Graphics Processing Unit.

0:27:40.600 --> 0:28:23.967
<v B>Or even in the case of Dask, it might send that part of that sum to another machine or to many other machines and then go and collect the output. And so in all of these cases, you're able to work at a really high level and you're able to do the same operation many, many times on many different data atoms very, very quickly. And that's something that Excel also gives you. In Excel, you can say SUM A. It's very, very terse. It's very fast and sums the entire column super quickly. So it's all kind of with that kind of a mindset that we can get a lot of stuff done without having to be experts on the GPU and SIMD and all of that stuff. Yes.

0:28:24.456 --> 0:28:57.413
<v C>Except that there are two big things to point out. The first one is that the amount of library that is available for Excel is a tiny fraction of what you have on NumPy. And the second big thing is reproducibility. So one of the biggest problems with Excel is that you have your VBA code and your in-cell formulas mixed with your data. And as soon as your data changes,

0:28:59.303 --> 0:29:09.445
<v C>You will need to start thinking, okay, how do I keep my software—meaning my VBA and my in-cell formulas—while

0:29:11.183 --> 0:30:30.259
<v C>swapping the data? And for a regular piece of software that's trivial, the software is the software, the data is the data. And you have a command that says `software.py` or `.exe` input file, output file, or something like that. In Excel, it's not like that. It's the same file. And I've seen the most horrible things to work around that. And inevitably, you will end up with human error with stuff that simply stops working because the software has been corrupted by new data or something bad like that. Or there was a manual step in updating the data that was not performed just right. And now there is a subtle difference in the output that you will not notice because you forgot a validation step that would be otherwise redundant. So that's a colossal problem. And then you have, how do you put Excel code in version control? The short answer is you just commit a binary blob. Now there is a change. Put a new binary blob into version control. What changed? Well, you have two binary blobs. Can't you tell the difference?

0:30:32.537 --> 0:30:55.656
<v C>Yeah. And again, I've seen the most exotic solutions where there were macros that were yanking all the VBA code out of an Excel spreadsheet, saving them to version control, and then another macro that was yanking them back in and rebuilding the spreadsheet was nightmare. Speaking of nightmare, do you want a horror story? Sure,

0:30:56.280 --> 0:31:03.722
<v B>Let's hear. I actually was thinking of—I have a horror story in my head, but I'd love to hear yours first. It's probably more horrific, and then people can ramp down at

0:31:04.414 --> 0:31:08.042
<v C>My story: four words—matrix inversion in Excel. Oh my gosh.

0:31:09.720 --> 0:31:18.437
<v C>I saw somebody write a matrix inversion in three or four pages of VBA. It was, I was—

0:31:20.817 --> 0:31:37.640
<v C>four pages of VBA. It was running. It was like a 10,000 by 10,000 matrix, some so substantial. And it was pushing button and then it was leaving. Two hours later, it was coming back, and somehow—hopefully it was giving the result.

0:31:41.286 --> 0:31:44.745
<v C>I looked at it. I opened my Jupyter Notebook. First

0:31:48.205 --> 0:31:55.225
<v C>line: `import open PyExcel` or whatever. `import pandas`. Second line: loaded the data from his input Excel spreadsheet. Third line: invert. Fourth line:

0:31:58.520 --> 0:32:12.600
<v C>save out. I looked at him, push button. 40 milliseconds later, the program was done. Yeah. He looks at me. I said, 'Oh, I didn't know you could do it.' Yeah. I would be worried if I knew—if you knew.'

0:32:14.760 --> 0:34:13.320
<v B>Oh my gosh. Yeah. I have a similar story where I'm going to throw my brother-in-law under the bus. So my brother-in-law is really, really good at math. Got like a perfect on the Math SAT. So I'm going to set him up to knock him down here, but he's really good at math, but he's not a computer scientist. He's an economist, right? And I remember this is years and years ago. So we were both relatively junior professionals. And he asked me to take a look at his laptop because of course, everyone with a CS degree is also an expert in IT, right? In your family. So I was really prepared not to have any solution for this because I'm usually terrible at IT. But it's just—he said it was running really slowly and he had, I'm not even kidding. It must've been over 200 Excel programs open at the same time. And almost all of the files had almost exactly the same name. And basically he had created, as you said, you know, he had this code that did all of this logic, but he wanted to run it on a hundred different data sets. And so, as an economist, he didn't know how to do that. So he created a hundred copies of this Excel spreadsheet, and then he just had them all—and it was more than a hundred—had them all open at the same time. And he was trying to copy and paste data into each one. And I was like, 'You have to learn R.' I was like, I—at the time, I don't know how popular Pandas was. I don't even know how old Pandas is. So I didn't know about any of that, but I told him, 'You have to learn R and get a book on R.' Yeah. I mean, to your point, people get sort of trapped in Excel, and then it becomes difficult for them to take the next step. And so that's kind of where I think scientific Python—that's where I think it can grow the most—is with that audience, right? The Excel audience. So how do people, let's say, you know, people out there like my brother-in-law and other people who might be really good with Excel,

0:34:13.320 --> 0:34:17.970
<v B>how do they get started with scientific Python? Like what's a way they can ramp

0:34:17.970 --> 0:34:21.025
<v A>into that? There are plenty of

0:34:21.025 --> 0:35:03.480
<v C>tutorials out there. First, they would, they should start with the Python tutorial, which is generic and it teaches them like basic for loops. And already that will give them the tools to awkwardly read a CSV file, do some calculations on it, and then write it out. And then from there, they should start with a Pandas tutorial specific for scientific Python and realize that all that for loop that they've wrote in pure Python, where they were opening the CSV file and reading cell by cell and calculating cell by cell, actually that becomes three lines in Pandas. And it's a lot faster as well.

0:35:03.480 --> 0:35:35.080
<v B>One thing that's different, you know, with Excel, it's, it's reactive, right? You know, with Pandas, it's imperative, right? So, you know, with Excel, you change the data and then the answer just magically appears, right? And so how do you get people to sort of make that paradigm shift from, you know, everything is reactive and, and, and sort of, it's like a, Excel is like a true functional programming language, right? How do you go from that to something like Pandas, where it's, you know, a script where you read in the data? Yeah. How do you get people to make that paradigm shift?

0:35:35.080 --> 0:36:05.400
<v C>I think that for anybody that uses Excel professionally, reproducibility and removing human error is the cell. Yes. Excel is reactive, which is great if you want to prototype something, but then if you want to repeat the same operation every other week and you want to repeat it exactly the same way and you want your replacement to repeat it the day that you're on holiday,

0:36:07.489 --> 0:36:22.360
<v C>Excel is doom is it, you will get it wrong. You will introduce human error in these 20 different manual steps that you need to repeat the exact same thing. And the idea is you have input data,

0:36:24.786 --> 0:37:15.225
<v C>which is a plain formula-less Excel file or CSV or whatever, or a webpage. And you have software that you push button and you're guaranteed that if you push button twice on the same data, you will get the same output. And if you want to change one thing, you can put, you can have version control one week, push button. Oh, now it works. Okay. What changed in Excel? At best, you have binary blob versus binary blob. In Python, you have those five lines that somebody changed and they shouldn't have. And you can blame it and fix it accordingly. It's much

0:37:16.103 --> 0:37:19.107
<v A>better living. Yep. That makes sense. Cool. Yeah.

0:37:19.529 --> 0:37:24.912
<v B>I think that makes sense. Do you recommend people go from Excel to R to Pandas or

0:37:24.912 --> 0:37:26.839
<v A>go straight to Pandas? Skip R.

0:37:27.960 --> 0:37:28.860
<v C>There is

0:37:28.860 --> 0:37:30.126
<v A>no need

0:37:30.649 --> 0:37:58.830
<v C>for R nowadays. Again, unless you are a scientist that needs that one specific algorithm that somebody wrote 20 years ago and it's barely almost unknown. But even then, there is a really nice library, which I cannot remember the name, which can wrap our functions and you can work on the NumPy objects. Cool. That makes sense. Yeah.

0:37:58.830 --> 0:38:27.619
<v B>So for folks out there, you know, if you go from Excel straight to Pandas, you're going to see these constructs like DataFrames and wonder sort of, you know, a lot of Pandas is inspired by R. And so the inspiration might be a little bit lost on you, but I agree. I agree with Guido. I think you go straight to Pandas, you know, and you don't necessarily need to know the whole history there to get up and running and get proficient and get effective. And

0:38:28.260 --> 0:38:52.746
<v C>For those that miss the fumbling around bit of Excel, I think that using a Jupyter Notebook helps immensely. I always prototype my new code on Jupyter Notebook and only at a later date, when I want to productionize it, I move to PyCharm. That's my personal preference at least. I find it a lot faster for prototyping. Yeah.

0:38:53.978 --> 0:39:04.035
<v B>That makes sense. Do you how do what tool do you use to share Jupyter Notebook results? Do you do the export to HTML or do you have like another tool that you

0:39:04.035 --> 0:39:18.261
<v C>use? If I just want to show them to somebody on the internet, I may publish them to a GitHub Gist. Or I if I want, if I'm going to share them to somebody that doesn't know what Python is, I will do a save as

0:39:19.071 --> 0:39:51.859
<v B>to HTML. Yep. That makes sense. So cool. So yeah, I think we covered this in really good detail just to recap for folks out there. You know, so NumPy is a BLAS and BLAS, BLAS stands, let me step back a little bit. So BLAS is Basic Linear Algebra System. And so the idea is again, going back to that vector add, you know, you want to do A plus B and you want it to be a component-wise add really quickly. And so BLAS basically provides you with a way to, and BLAS is pretty low level, like C

0:39:51.859 --> 0:39:55.799
<v A>or C++ or Fortran. BLAS is written in AVX assembly.

0:39:55.977 --> 0:39:57.765
<v C>It's very, very highly optimized.

0:39:58.947 --> 0:41:31.240
<v B>Right. Oh yeah. But even the interface will be, you know, if you wanted to interface directly with a BLAS system, you'll be writing C or at best you'll be writing C or C++. So, and yeah, you're right under the hood, it's all custom written assembly code that's optimized for a million different architectures, etcetera. And so that's how people have done scientific computing in general, especially how scientists have been able to do it without having to sort of rewrite that from scratch, because that can be really difficult. And there's issues with precision. There's times where you want to change the order of operations. The thing that comes to my mind is actually the log sigmoid, where often you want to get the log likelihood of a sigmoid function. And it turns out if you do the sigmoid and then you do the log operation as two steps, you incur a lot of imprecision. And so your answer ends up being very imprecise. So many, many BLAS systems will offer a log sigmoid operator, which does both of those at once. And the result ends up being much more accurate. These are all things that people don't want to have to think about, right? Unless they're down in the weeds. And so, so NumPy provides like a beautiful, you know, Python interface to n-dimensional arrays and all of those operations. And it allows you to use Python to do all of that, but it's also pretty low level. Like you have to think in terms of matrices. And so that's where where Pandas comes in.

0:41:31.240 --> 0:41:34.037
<v A>One thing that everybody that

0:41:34.037 --> 0:41:52.920
<v C>is not using Python is complaining about as isn't Python slow. The answer is, well, yes, Python is pretty slow, but NumPy is as fast as C in theory, actually faster than whatever C you will write because it's been highly optimized.

0:41:52.920 --> 0:43:52.463
<v B>Yep. Yep. That's right. Yeah. This is a common criticism of Python. I think that for everything, you know, there's a Pareto distribution here. So a tiny percent of your code consumes 99% of the time. And so with NumPy, that expensive code is almost certainly being done in assembly or at best at C. So, so you are executing a command saying, you know, add these two arrays and you're telling NumPy to do that. And if that instruction, that message telling NumPy to do that takes a hundred times as long as it wouldn't C, it's totally irrelevant because that is very, very tiny compared to the actual adding of those matrices. And that actual add instruction, which is going to take the vast, vast majority of the time is now super, super optimized, way better than if you had just written a for loop in C++. There are times what comes to my mind are simulators, but there are times where you do have many instructions and it's not really something that can be parallelized. And even there, there's number, and there's a bunch of these, there's CyPy, Cython, you know, a bunch of these tools that will convert Python functions to C on demand. So if you're not doing anything complicated with objects, you just have a lot of serial mathematical operations. There's a whole bunch of different just-in-time compilers that can optimize that for you. So yeah, in short, don't be adverse to Python for speed reasons. So we've done a pretty good job covering NumPy and Pandas. The thing that Dask does is take it to multi-node. And that I think is really, really interesting. And I have to confess, I don't actually know a lot about that part of it. I'd love to know more, so, so multi-node is how do I take this operation that now runs really fast on my machine and

0:43:52.784 --> 0:44:05.490
<v B>get it to run on, you know, a hundred machines, even if they're in my office or if they're, you know, even better, if they're in the cloud somewhere and how does how does Dask actually do that? How does it run your code remotely?

0:44:05.811 --> 0:45:16.129
<v C>Right. So traditionally, distributed computing has been very low level. Back in the day, we had these very low-level C++ programming toolkits that will tell you something like, okay, you have two nodes and this is a command that lets you send this piece of data from one node to another node. And then the other node will need to expect that. And it doesn't scale in terms of complexity. It becomes really, really complicated, really fast. So the idea behind Dask is that you have this object in your Jupyter notebook or whatever that looks and feels like a Pandas DataFrame or an NumPy array, except that you look at it and there is a line that says this Pandas DataFrame is 40 terabytes. How is that possible? But you're on your laptop and you have a 40 terabyte Pandas DataFrame on your laptop. How is that possible? There's a trick. You don't actually have it on your laptop or anywhere else for the matter. You have the instructions to

0:45:17.749 --> 0:45:28.440
<v C>generate that DataFrame. And then every time you do a manipulation on that DataFrame or on that NumPy array, you add an extra delayed instruction to the

0:45:30.287 --> 0:47:30.200
<v C>bunch. And at the end on your laptop, you have two megabytes, say, worth of delayed instructions, which are to you, they are completely invisible. You have the final product in front of you, just know the actual numbers are in it. And then you invoke one method that in Pandas and NumPy does not exist, which is .compute. When you do that, two things happen. Well, a few things happen. If you're just on your laptop, you can run the whole thing on your laptop and it will be already faster and more performant than NumPy or Pandas because it will read from disk or from the network whatever bits you need, crunch them through and then release the RAM as soon as possible before the next bit can be loaded up. Say, for example, that you have an hypothetical Excel spreadsheet of a million lines and you want to sum up a column. If you do that in Pandas, you have to load up the million lines. Now you have everything in memory and then you do the sum in memory. And unless you have something fancy, that sum will be most times using a single CPU. With Dask, you can say, load this million lines to spreadsheet and split it into 160 chunks. So 1 million over 160 is, I don't know, 10,000 something. And now you can now every and the end, every one of those goes to one of my 16 CPUs and or eight CPUs or four CPUs, depending how fancy my computer is. And it does not matter how many CPUs I've got. I have split I have split it into 160 chunks and Dask will take care of it of saying, okay, load the first one. Well, as soon as you start finishing loading the first one, do the partial sum of that column that

0:47:30.200 --> 0:48:44.502
<v C>you want. And now you have one single number and then you can release it. In the meantime, I see you've got seven more CPUs that are idle. Load the second one and the third and fourth and seven and the eighth. By the time you finish loading the first one, load the ninth on the first CPU and so on. So at any time on your eight CPUs host, you've got eight 10,000 lines chunks in memory, completely saturating your CPU capacity capacities. And you are instead of 1 million lines. That's the idea. And then once you have the subtotals of two chunks, what did the user want? Oh, they wanted the just a grand total. Fine. I don't really need these two numbers in memory. Sum them up. And now I have one number. Rinse and repeat. And I can do a recursive aggregation. And every, all of that is under the hood, completely transparent to you. You don't see it. If you're running on your laptop, all you see is your million lines database is now taking as much as 80,000 lines. If you have eight CPUs and you split into 10,000 bytes chunks and it runs eight times faster. And then you can scale up

0:48:46.189 --> 0:50:10.733
<v C>to the cloud or to a data center because you don't have a million lines. You have a billion lines. And no matter how fancy your laptop is, it will just not do it. It's just not enough even then. So you never, you don't even have this billion lines database, which is probably going to be in the terabytes on your machine. You have it somewhere on one or many databases on the cloud. So you have your one megabyte worth of Dask DataFrame or Dask array. Push button compute. Dask will push these instructions to the Dask scheduler, which in turn has a thousand or whatever you may, I mean, you paid for Dask workers. And the Dask scheduler will coordinate the workers to say, you do this one, you do this one, you do this one, exactly the same way that earlier my local laptop was coordinating my eight CPUs, except that I don't have eight CPUs. I've got 8,000. And then you can do fancy stuff like share data between workers peer to peer, which is something that typically in a processing pool, for example, you can't do. And the data sits near the workers. It never touches your laptop. Yeah, this is

0:50:12.201 --> 0:52:05.400
<v B>super cool. So, so just to recap, so see if I understand. So, you know, most people want to either visualize some result, in which case, you know, you're only interested in as much information as your brain can process, right? So, so some kind of line chart, you know, with smoothening and all of that is more than enough for your brain to understand what's going on. Or if it's not going, you know, the information is not going directly into your brain, it's going into another database. And usually there's that database can take it in one piece at a time and doesn't need to have the entire thing loaded in at once. And so in either of those cases, to your point, like either you're streaming out small chunks, or you're crushing everything down to a small chunk. And so only the intermediate values might be large. I mean, it might get, might get small very quickly at the end. And so the way Dask works is instead of saying, you know, load this huge data set, do all of this logic on each piece and then aggregate, it's deferring all of those commands. And then at the end, it's analyzing the sort of graph of operations and it's figuring out where it can break things up into pieces. That's correct. Got it. So a couple of questions. One is, how do you handle, like, let's say I'm using some pretty esoteric like Gambit, right? Which is a game theory library in Python, right? So let's say I want to use Gambit to, you know, calculate some Nash equilibria of some data. How does that work with Dask? Because now the Dask scheduler needs to tell these nodes, hey, you have to, you know, pip install Gambit. And then when you're done, you have to pip uninstall it, right? Like how do packages work in this kind of environment?

0:52:06.158 --> 0:52:50.920
<v C>Right. This is where Coil steps in. So normally what you will need to do, you have two ways to do it. One is you SSH into every one of the workers and you repeat the exact same pip install on every worker. That's the first option. The second, definitely more sensible option, is you create a Docker image and then you send it to all the workers. Even then you will be struggling with a complexity, with a lot of DevOps work in terms of keeping all the workers aligned. You have a thousand workers, you got to keep them aligned. It's not that simple.

0:52:50.920 --> 0:52:59.480
<v B>Yeah. And multiple people could be on the cluster too. Like I might need Gambit, you might need PyTorch, and we both submit our job at the same time, right?

0:53:01.559 --> 0:53:46.760
<v C>In that case, you will typically have two separate clusters. It's a lot easier. Ah, okay. Got it. It doesn't make much sense to share a cluster with different software. And you cannot share a cluster with different versions of the same software. Typically what people do when they want to build the heterogeneous clusters, they change the hardware. So for example, they will have some nodes that are memory optimized with many, many gigabytes of memory, but not that great of a CPU. With compute optimized nodes, which are built for heavy lifting, but cannot store that much data. And the GPU nodes on the

0:53:46.760 --> 0:54:14.037
<v B>side. Got it. But so let's say I have a Docker image and my Dockerfile is pip install gambit. And I submit my job along with this Docker image. So then the DAS scheduler tells these nodes, I guess, run this Docker container and then inside the Docker container, do this computation and then tear down the Docker container. Is

0:54:14.037 --> 0:56:01.319
<v C>that how it works? No, it's the other way around. The Docker container will also contain the DAS scheduler and workers plus all the software that you need. And you can, you will start DAS scheduler or DAS worker from inside the Docker container. So it's up to you to deploy the Docker container on the hosts and then start everything. And that's where COILD steps in the company work for. We, the idea being that all of this work is a lot and it months is potentially months worth of DevOps engineering time to have it in production scale on that many workers. And if you are a lonely data scientist in that has the money for it, because maybe your company bankrolls you, but doesn't have the human resources to support you in your work. You can just push button and fire up a thousand workers in a matter of minutes with COILD, which you just specify, I want these packages, push button and COILD will build Docker for you. You don't need to know a single line of Dockerfile syntax. You just need to know your algorithm and which which libraries you want to have. If you're prototyping in a Jupyter notebook, DAS will do something fancy, which will, which is pickle the cells of the Jupyter notebook so that you don't need to install everything remotely beforehand. You can change your code on the fly in your Jupyter notebook cell,

0:56:02.965 --> 0:56:17.240
<v C>compute that code is pickled entirely, not just the reference to it and sent to the worker in real time. So that in theory, you could have generic workers that just have NumPy, SciPy and Pandas installed. And that would be enough.

0:56:17.240 --> 0:56:58.920
<v B>Yeah. One thing that Google Colab does, which I thought was pretty cool, is you can do like `!pip install` inside of Jupyter. And so when you do like a `!pip`, that tells Google Colab that this is a pip install command. Yeah. It somehow gives you a, I guess you run inside of some kind of Docker or VM and then you pip install whatever you want. And at some point Google like just terminates that machine running that Jupyter notebook. And so, in this way, like you don't have to pass Docker to Google. I feel like you could do something similar as long as it's just Python. You're not trying to install any kind of OS level stuff.

0:56:58.920 --> 0:57:16.455
<v C>I don't believe that you can pip install stuff on a running cluster. But again, if you're using Coiled, rebuilding a cluster is a matter of 10 minutes at most, even if you're rebuilding the whole Docker image at all. Oh, interesting. Yeah. Okay.

0:57:16.827 --> 0:57:50.374
<v B>That's an interesting way of doing it. Yeah. I like that. Because yeah, especially at bigger companies, you have a lot of different teams and different teams are using different packages, and they're all running on the same cluster. Or in this case, they're running in this case. Yeah. Maybe 'cluster' is not the right word. They're running on the same hardware. Yeah. They want to do, they want to do distributed computation. Maybe I'll put it that way. So they want to run their task at the same time. And so, yeah, to your point, it's like, why not just build an ephemeral cluster for

0:57:50.965 --> 0:57:52.804
<v A>each team, right? As a matter

0:57:54.036 --> 0:59:19.424
<v C>of fact, a company that was working for was doing exactly the other way around. They were having one cluster managing at the same time four or five different versions of the same application software that they could run in parallel. And it was not a good design. There were a lot of compatibility issues, a lot of interoperability, integration issues. You had to do integration testing every time. Does this version or does the latest version of the cloud, of the cluster software collaborate correctly with the older version of the application software? It wasn't great. I find that whole design was because the whole thing was bare metal, was born in bare metal. It hadn't been migrated properly to the cloud. It was designed well before Docker. And with Docker, none of this makes sense, to be honest. You can just have your own specific version of everything. And you have a bunch of Docker images that you just distribute and you don't need to care. And if somebody else wants to run a different version of the same thing on the same resources, fine. It's just, it's Docker; you will not even

0:59:20.149 --> 0:59:38.965
<v B>see them. Right, right. Does, does Dask then, uh, play nicely with like, uh, you know, uh, like the autos auto, uh, auto scheduling and auto scaling and all of that in, in Kubernetes. So let's say you have a bunch of people running jobs and then, you know, it's six o'clock, everyone goes home. You know, does Dask notice sort of like tear

0:59:38.965 --> 0:59:42.036
<v A>down those nodes and everything? Indeed it does. Dask

0:59:42.036 --> 1:00:03.653
<v C>has a functionality called adaptive scaling, which does exactly this. You tweak how many seconds does a worker need to be idle before you tear it down? How much pressure do you need to have in terms of Dask piling up in queue before you spin up a new worker and everything goes up and down on the fly?

1:00:04.446 --> 1:00:34.600
<v B>Yeah, that is super cool. So I can imagine something where you know, you like MD5 or you show some your requirements, your Docker container—actually Docker container already is summed, but basically, you have two people have the same pip packages; they could get on the same cluster and you could use some kind of hashing to make sure of that. But if someone revs one of the dependencies or shows up with a totally different program, they get, they would get a unique cluster that would scale up and down for them.

1:00:34.600 --> 1:00:53.800
<v C>Yeah. And again, this kind of functionality it comes in Dask straight away, and you have packages like Dask Kubernetes. If you want to install it yourself, it will cost you quite a lot of DevOps to have it right. If you use Coiled, you have it out of the box.

1:00:53.800 --> 1:02:19.880
<v B>Yeah, actually, this is very timely because we just did an episode on Kubernetes and, inspired by that episode, I personally went in and did a bunch of digging. I finally got a Kubernetes cluster up and running where an ingress proxy, which I learned a few days ago for the first time. But basically it's this thing where you, when you visit the cluster, you get authenticated, you know, there's some SSO through like Google Auth that sets some cookie. And then once you're authenticated, you can get into the cluster for real. It doesn't bounce you out and I have a few services on there that now each service doesn't need its own auth because I've put auth on the entire, on the entire cluster. But that whole thing took me multiple days to figure out. I was on Google, I was on Wikipedia, I was looking up a bunch of articles on Medium and I was hacking my way through it. And you know, and it's currently kind of held together with duct tape. So that is just to make it so that you can securely log in to this Kubernetes service, right? It took forever. And so, you know, it's definitely not worth it. I mean, if you could use something that's managed actually. Yeah. So, how does Coiled handle authentication? That's kind of a good, good, good kind of segue.

1:02:19.880 --> 1:02:37.857
<v C>I'm not familiar with that base of the soft part of the software. I am focused on the Dask distributed, but the idea being that you have your own AWS account and you install Coiled in it, and that's it.

1:02:38.667 --> 1:03:07.720
<v B>Oh, I see. Okay. That makes sense. So, you have Coiled provides some like Terraform or some other kind of scripts where you can spin up Coiled in your own, you know, private cloud. And so there isn't just one Coiled cluster for everybody. Correct? And so, got it. And in your cloud, it's already private. So you don't have to assume that you can trust the people who can see those IP addresses. Yes. Got it. Okay. That makes sense.

1:03:07.720 --> 1:03:22.680
<v C>And of course, on top of that, there is a wealth of security that comes out of the box with SSL and whatnot, which again can be a bit fiddly to figure out, and Coiled just delivers it out of the box.

1:03:22.680 --> 1:04:11.378
<v B>Very cool. Okay. So I think we covered a lot of things in really good detail. So, you run Dask, you create a bunch of operations in Dask. At some point you say dot compute, and then up until then everything has been instantaneous because it's not actually doing anything; it's just deferring it. When you say dot compute, that's when everything pauses, Dask goes off and crunches all of that, and then comes back with those answers. One other question: how do you deal with things that are difficult to decompose? Like you mentioned matrix inversion, right? Matrix inversion is a difficult operation to run on, for example, a hundred nodes, right? It's not impossible, but it's not trivial. How does Dask handle something like

1:04:12.272 --> 1:04:15.765
<v C>that? That's where the fancy code comes in. It's all about

1:04:17.640 --> 1:04:46.439
<v C>copying over data when it's needed, where it's needed. And all of that happens automatically for you. So you will end up with multiple copies of the same pieces of data, meaning that the total amount of memory cluster-wide will be somewhat higher than if you were running on a single host. There are algorithms that figure out how to try to keep the number of copies alive at any given time.

1:04:46.439 --> 1:04:51.996
<v A>at a minimum. Got it. Okay. Yeah. That's some gnarly stuff. That's yeah, that's,

1:04:51.996 --> 1:05:04.298
<v B>as you said, that's where the really complicated code is. Maybe for something like matrix inversion, there's even some specialized implementations that are distributed friendly. There are,

1:05:05.040 --> 1:05:33.319
<v C>the algorithms can be slightly different from prior pure NumPy. Yes. Yeah, that makes sense. Some things are which are straightforward and in NumPy can be close to impossible in Dask. For like, the most obvious example is sort—sorting a bubble sort of any kind of sort when you have everything at once in memory in

1:05:35.955 --> 1:06:56.550
<v C>front of you is 1980s textbook computer science. But when you have your chunks that are in small pieces scattered all around the network, it becomes almost impossible. So you can sort each chunk locally, but then you will not be able to do a global sort. So there are solutions around that where you, for example, instead of calling sort, you get a function called top K, which is give me the 1000 largest elements or smallest elements globally, at which point becomes trivial. You get the 1000 largest elements in each chunk. Each chunk is a million elements, for example, and you get 1000 out of that, you get 1000 out of the other, you compare them. Now you have 2000. Now you get 1000 out of all 2000s. You need to repeat. You now again have something that is distributed friendly, but you had to change the algorithm at that point. You had to let go of a piece of algorithm that you actually didn't care about, which is the bottom 9,990,000. Yeah, right.

1:06:57.327 --> 1:08:04.120
<v B>I remember working on sorting and MapReduce a really long time ago. And I think what we did was, we had each node compute the quantiles of their piece of the data. And then we had another that could look at 100 different sets of quantiles and try to guess at the overall quantiles of the overall data set. So quantiles are just buckets. If I had the sorted data and it was broken up in a buckets, where would those boundaries be? Once you say, I know roughly 10% of my data is between zero and 10, another 10% between 10 and 100, and other 10% between 100 and 200. If you have that rough estimate, then you can give each of those buckets to a new node, have them sort in order. And then now you have something totally sorted. If you know like each bucket is strictly greater or less than the other, right? But you're right. It's like, that's not 90s textbook stuff. That's like, it starts to get really complicated and it requires you to do a lot of like statistics that are approximate. And so you lose all your guarantees.

1:08:05.907 --> 1:09:07.129
<v C>Yes. And another thing that is normally done is called rechunking. So if you really need all of your data in a single piece, you will realize that actually you need all your data along a certain axis in a single piece. So for example, let's say that you really need a sort or you have a matrix that is a million lines by a million columns, and you will need it sorted by row. And you have, let's say you have it chunked in a thousand by a thousand squares. You can't sort that. What you can do is call a rechunk. And now instead of have a thousand by a thousand squares chunks, you have a million lines single chunk by a single column. So the individual size of the chunk of every chunk is the same as before, but now it's sortable in place because you have it in memory all at once, but you still don't have the whole matrix in memory. Oh,

1:09:07.129 --> 1:09:19.802
<v B>interesting. Really, really interesting. Cool. So yeah, this is fascinating. I'm going to have to really do a deep dive personally on Dask and learn a lot. I think folks out there, actually, if someone wants to learn Dask, what is the

1:09:20.089 --> 1:09:28.965
<v A>The best way they can learn that? There are plenty of really good tutorials on Dask.org. Got it. So go to Dask.org, check out the

1:09:28.965 --> 1:09:35.800
<v B>tutorial section. Do you recommend people learn on their laptop, or should they get a machine in the cloud? Does it really make a difference?

1:09:36.424 --> 1:10:54.760
<v C>It does make a difference the moment you want to deal with sizable data. If you're just learning and fumbling around with a few kilobytes or megabytes of data, your laptop is fine. The 'hello world,' air quotes, because of course it doesn't make much sense in Dask, takes less than a millisecond to run. Yeah. Compare it, for example, to a hello world in Spark that takes, I think, two to five seconds. Something ridiculous. Because Dask scales down a lot better than, say, Spark. And then you can scale up from that, and you can work on your laptop, and then you realize that, oh, now I want more data, and now my laptop is dying. And now you scale to the cloud with the exact same software. This is, as a matter of fact, what I do normally. I work with a reduced dataset locally, which is super fast, on my Jupyter Notebook, play around with it. And once I have the algorithm nailed down, I take the exact same algorithm, and I connect to a Dask scheduler, and crunch it instead of the laptop, I send it to the Dask scheduler on a dataset that is a thousand times larger.

1:10:56.760 --> 1:12:16.120
<v B>Yeah, that makes sense. Totally. Yeah, it's really nice. Actually, this is something that is missing in a lot of modern compute, is the ability to run locally and then switch to running at scale, and then switch back. So I'm thinking right now of Kubeflow, and there's this determined AI. There's a lot of these solutions for running in the cloud, you know, running parallel operations in the cloud. But if you write for them, and you find a bug, and you want to reproduce that bug locally, you're stuck. You can't really do that. And so you end up in this really painful loop where, you know, I submit my job to the cloud, I go get a coffee, I come back, oh, I missed a colon. I submit it to the cloud, go for a walk. And so it's just the iteration time goes, just plummets, right? And so it's nice to have sort of it all in one unified interface where you can say, okay, I clearly have a bug that is independent of my data. And so I'm going to pull one one thousandth of the data, I'm going to run the whole thing on my laptop 20, 30 times, get the bug fixed, and then go back to running at scale. That's really nice. Cool. So let's jump into Coiled, the company. So, you know, tell us a bit about Coiled, the company. How long has it been around? And how long have you been there?

1:12:16.120 --> 1:12:27.240
<v C>Coiled has been around for, I believe, a year and a half. And I've been there for a year, actually a year, a year and a half now. Two years the company, a year and a half me.

1:12:27.240 --> 1:12:43.973
<v A>Oh, okay. Got it. So about how many people are there now? Around 50 something. Got it. And is it, I know it's remote. Is it concentrated in the EU? Is it really all over? It's, most of the people just happen to be

1:12:43.973 --> 1:13:03.880
<v C>in the US, but now we have a half dozen people in the EU, one in India. We used to have a couple in Australia that turned out to be problematic, because our company meetings were at 6am in the morning for them, which was not really sustainable.

1:13:04.520 --> 1:13:27.038
<v B>Yeah, that makes sense. So it's been around for a couple of years, about 50 people. I mean, that's actually a lot of growth. I mean, to go from zero to 50 in two years, it takes a lot of coordination to get that many people onboarded. I mean, that's a person every two weeks. Yeah, very cool. So are you what's sort of the plans going forward? Are you hiring full-time? Are you

1:13:27.038 --> 1:13:32.978
<v A>hiring interns, all of the above, none of the above? I don't believe we are hiring

1:13:32.978 --> 1:13:41.320
<v C>interns right now. We have a page with careers. If you want to have a look at it, if you want to send your CV, you are more than welcome.

1:13:41.320 --> 1:13:53.799
<v B>Cool. And so what time zones are you supporting? So you mentioned India, the US and the EU. Are those is that pretty much the time zone block or, or what are the requirements?

1:13:53.799 --> 1:14:20.360
<v C>We are flex, we are as flexible as humanly possible in terms of requirements from the individual workers. So it's very, very flexible for personally. I'm a night owl. And that means that I frequently work until 1am in the morning and then logging late in the next, the next, well, the same morning, technically.

1:14:22.840 --> 1:14:27.960
<v A>That's cool. Patrick, are you a night owl? Uh, yeah, no. Morning person.

1:14:27.960 --> 1:14:35.880
<v B>No, I used to be. I used to be, but with kids, I lost the opportunity to do it. I still think I would do it if I could.

1:14:36.440 --> 1:14:40.200
<v A>If the sun is not shining bright, I'm pretty much getting tired and going to sleep.

1:14:42.200 --> 1:15:35.963
<v B>You know, I actually, at a place that Patrick and I used to work a long time ago, I got into a lot of trouble because I just could not show up at what was it? 7:30 or something. They were asking us to show up, and I just couldn't do it. And I was like, 'I'm sorry.' I mean, I had no reason, you know, it's not like I had something at 7:30, but I'm also a night owl. I just could not do it. And I would always go in much later than that. But now with kids, I don't have a choice. They just come in and kick the door down, you know, jump on my stomach. And I'm like, okay, I guess we're getting up now, but that's cool. I think that, yeah, I think there's a ton of flexibility there. If you're out there and you are, if you're a Dask user, if you're a Dask enthusiast, Coiled is hiring folks. Yeah. This is a question we get asked a lot. You know, what's the best way for someone to impress the hiring

1:15:35.963 --> 1:15:39.034
<v A>managers at Coiled? Coiled Contribute on both.

1:15:39.034 --> 1:16:13.000
<v C>We have the Dask board on GitHub, Dask Dask, which is the NumPy and Pandas wrapper, and the Dask distributed, which is the scheduling part. We have plenty of issue tickets to pick up from. And if you have your own issues and you believe that it may be within your reach, go on and contribute with a PR. You will be very, very welcome to do so. That's how I impressed my troppelin, for example. That's exactly how I was cut it. I was just contributing.

1:16:13.880 --> 1:17:27.639
<v B>Yeah, that makes sense. I submitted a change recently to Apache Drill. You know, one of the things that just talking to some folks, I realized there's a lot of people don't understand that at the end of the day, all of these things, whether it's Linux or whether it's Dask or whether it's Drill or Spark or all of these things at the end of the day are just pieces of software that you can go and look at. I mean, if they're open source. And so, you know, don't ever shy away from going and reading the developer instructions, building your own local copy of whatever it is and making whatever improvements or fixes you want to make. You know, I think a lot of people are intimidated by that. You know, they say, 'Well, I pip install Dask.' I don't know how to get the code or how to change the code. And it turns out it's not as hard as you would think for any of these projects. And so I think it's great advice. I just want to double down on that and say, if you think this is interesting, go in and look at how you can have an impact right now. And that's going to be the best way to signal not only to them, but to yourself, like to tell for you to sort of confirm with yourself that this is something that you really

1:17:27.962 --> 1:17:31.034
<v A>enjoy and are good at. Yes. And it's

1:17:31.034 --> 1:17:47.065
<v C>going to be immensely, even if nobody is going to hire you, is going to be immensely useful for your career growth and is 100% something that you can put in your CV. Frequent Dask contributor, it has a weight on a CV, definitely. Definitely.

1:17:47.723 --> 1:18:48.960
<v B>Yep. I think, just to make this super concrete, we had a candidate who had kind of mixed results on the coding part of our interview. You know, so we were kind of debating; the hiring committee was going back and forth as to what to do about this candidate. And one of us went to their GitHub and we saw that they had done all this open source work and they had these projects, they took the time to test it, and it was related to our field. And so that actually had a huge impact. It almost just instantly changed everyone's perspective. So, if you do things, and build things that you're proud of and then publish them so you can be proud of them at least for a long time. And then also kind of broadcast the message to others as well. Cool. So Guido, if people want to reach out to either you or other folks at Coiled, what's the best way for folks to kind of follow you and know more about what you and what Coiled are up to?

1:18:48.960 --> 1:19:37.700
<v C>So if you are interested in Dask development, we have the Dask GitHub boards. We have the community board, which is about the higher level design and direction. And then we have the Dask Dask and Dask distributed boards, which are the lower level day-to-day issues. We have, I believe, our customers' luck. We have Discourse. We are active on Stack Overflow as well. So if you put a question on Stack Overflow about Dask, there is a good chance that some of us may spot it. But if you want to make sure, reach out directly. We have people that just do that as a job.

1:19:37.700 --> 1:21:36.260
<v B>Cool. When you say Dask, when you say Dask board, I'm actually on the Dask GitHub page now. What do you mean by that? The issues page. Okay. Oh, got it. Okay. So yeah, check out the issues page and see the, oh yeah, here we go. Monthly community meeting. Oh, that is super cool. So yeah, definitely. If you go to Dask issues, you can actually see the issues are also used for discussion, which is really neat. Yeah, I've never seen that before. Cool. Okay. I think we can put a book work in this. This has been super, super interesting. I think that, oh, before we close out, I wanted to let people know that, you know, this is the Coiled product. Obviously Dask is completely open source, free to use, but also Coiled. If you're a student, if you're getting started, Coiled is also free. They have a very generous free tier. You will still pay for your cloud resources, although Amazon also has a bunch of amazing resources for students. And you can combine these. They're not exclusive. So you can be on the AWS credits that they give students and use those credits to run Coiled completely for free. And, you know, even if you, let's say, have already graduated, you could get spun up with Coiled at a very modest amount. You get to choose what sort of resources that you want to put forth there and be well within the free tier. So there's really no reason not to try this out. And, you know, once you have Dask running locally on your laptop, you could use Coiled to run something at a larger scale with very little friction. Cool. And with that, we can call this a show. Thank you so much, Guido, for coming on. I mean, we covered a lot of really interesting stuff. We explained to folks how, even if you're writing in C, if you just do 4a from 0 to 10, that's not going to be as fast

1:21:36.260 --> 1:21:58.418
<v B>As NumPy and why that is. And we covered Pandas, we covered R, we covered Dask, gave people a whole bunch of great references. We'll put a whole bunch of links here in the show notes to help everyone out there get ramped up on this if you're not already. And so thanks so much for helping to drive the discussion, Guido. I really appreciate your time.

1:21:59.059 --> 1:22:00.325
<v C>No worries. Thank you.

1:22:02.029 --> 1:22:42.074
<v B>Cool. All right, everyone. Thanks for supporting us on Patreon and Audible. We really appreciate that. If you want to get a hold of us, it's patreon.com/programmingthrowdown or you can subscribe to us on Audible through our programmingthrowdown link in the show notes. And if you want to reach us through email, you can email us programmingthrowdown@gmail.com. So a lot of show suggestions have come from folks emailing us, listeners who know someone they think would be a really good fit for the show. And we really appreciate that. So definitely keep the dialogue going. And we will catch everyone in a couple of weeks. Bye, everyone.

1:22:42.614 --> 1:23:01.220
<v A>Just chipping in here after the fact to clarify the free usage of Coiled. Anyone can use Coiled for free with their existing AWS or Google Cloud account up to 10,000 CPUs a month. There's a great way to test it out and try it. For more information, you can head over to coiled.io.

1:23:05.220 --> 1:23:15.860
<v A>Music by Eric Barndoller.

1:23:17.540 --> 1:23:28.969
<v A>Programming Throwdown is distributed under a Creative Commons Attribution-ShareAlike 2.0 license. You're free to share, copy, distribute, transmit the work to remix, adapt the work. But you

1:23:28.969 --> 1:23:44.660
<v B>must provide attribution to Patrick and I and ShareAlike in kind.

