Where do you run your Python code? No, no, no, not Python 3, Python 2, or PyPy, or any other
implementation. I'm thinking way lower than that. This week, we're talking about the actual chips
that execute our code. We catch up with David Stewart and meet Suresh Srinivas and Sergey
Midnav from Intel. We talk about how they're working at the silicon level to make even Python
2 run faster and touch on dedicated AI chips that go beyond what's possible with GPU computation.
This is episode 113 of Talk Python to Me, recorded live at PyCon 2017 in Portland, Oregon on
May 19th, 2017.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the
ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,
where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,
and follow the show on Twitter via at Talk Python.
This episode is brought to you by Talk Python Training and Hired. Be sure to check out what
we both have to offer during our segments. It helps support the show.
David, Suresh, Sergey, welcome to Talk Python.
Thank you very much. Great to be here. Thank you very much.
David, you were here. We talked in the early days of the Intel Python distribution,
and you guys have a lot of new things to discuss that you've done in the whole Python space. In addition,
you know, with the Intel Python distribution, but also with other things, right?
Yes, that's right. Yeah. We have a lot of, I mean, yeah, about a year ago when we talked the first time,
we had really put the plans in place for not only our upstream contribution to Python,
Python. We were also doing a lot of work with PyPy, the JIT interpreter for Python, as well as the
Intel Python distribution. Since then, we've released the Intel Python distribution, and we've had some
very significant, you know, upstream contributions and some proof points with some customers that have
been showing some very positive things. So yeah, you know, not to repeat maybe last time, but just to
say, generally speaking, if you're doing scientific computing, the Intel Python distribution,
particularly things like using pandas or scikit-learn or numpy, scipy, these are all things
that really work together very well with this Intel Python distribution. And it's a sort of a one
distribution, just download and install the whole thing as one, right? So not a lot of messing around
with it. We also have significant proof points with PyPy. In particular, we were showing off a doubling
of throughput of like OpenStack Swift with PyPy contributions we had made. And that's, you know,
so that means faster throughput, less, more users being able to, you know, being maintained and
things like that. So that was a year ago.
Yeah, that was a year ago. And when you say you're doubling the speed with PyPy, does that mean the
contributions you've made back to PyPy now result in going faster? Or is that somehow running the Intel
Python distribution on PyPy?
It's actually so the Intel Python distribution separate from PyPy, right? So we do we have two major efforts from a year ago that we're doing upstream open source contributions, and the Python distribution, which is a program product, right? Right, right, right. So what we had the doubling actually was just initially,
initially out of the box, let's see what PyPy gives us. And we were stunned that we got, you know, twice the throughput and like 80% better response time on Swift, just out of the box. And that said, Oh, let's start doing some work, you know, to actually optimize this thing and make it better and try more sort of proof points with other real customers, right? And since then, as well, the Python distribution,
has had a lot of proof points with customers. I think you've had financial organizations, right? Financial, oil and gas, government organizations, a lot of different usages.
Yeah, it's great. So okay, so yeah, that's, that's a really cool that you guys are working on that. I know we're not just talking about the Intel Python distribution. But let's dig into that just for a minute, like, is that basically CPython forked with some changes in the middle? Or like, is it a from scratch implementation? Or how does this relate back to CPython in terms of the beauty of Python, right, is it's a language specification and sort of the the sort of standard implementation CPython, right? But it's very open
to any number of any number of other right interpreters or implementations of the language, PyPy being one of them. And it's basically a JIT, which means a just in time compiler, which means that instead of just interpreting the byte code from Python, it actually generates native code, any opportunity it can for the hot parts of the program. And that's incredibly helpful strategic, because then we can make use of a lot more processor instructions, make use of more processor parallelism.
Yeah, okay, that sounds, sounds great. Suresh, were you involved in this Intel Python distribution work?
So we can deliver some workloads, and then optimize, start optimizing the CPython itself. So we have things like profile guided optimizations, and link time optimizations that have now become defaulted CPython.
Tell us a little bit about the profile guided optimization. So what you do is you run in a profiler, and then you somehow feed that back to the compiler?
So profile guided optimization is very critical since a lot of these runtime languages, they have like both large code footprint, and then they have a lot of branch mispredictions, right? And which essentially stall the front end of the CPU. And by profiling the code, then you're able to then relay out the code better, so that it's friendly to the CPU, and it's also more efficient. And that's a great idea.
So PGO is now default with Python.
With CPython. And the PyPy, the PyPerformance project, that is how they're measuring it now.
Wow, that's really cool. And Sergey, how about your involvement?
They have solved a really critical problem in making an interpreter or GTing really fast on Intel architecture. Intel distribution for Python, it also solves the problem of making numerical and machine learning running faster. And Python is known and loved for really nice numerical packages, NumPy, SciPy, Scikit-Learn.
All the stuff that we saw in the keynote today.
Yeah.
It's just like, here's why people that do numerical analysis love and use Python. And for those people listening who didn't get a chance to watch the keynote, you deserve to go on YouTube and watch it, right?
So yeah, absolutely. Those groups of people, the scientists, data scientists, it's great, right?
That's why we focus on this area and we optimize these numerical packages, not interpreter itself, but rather the packages. And for that, we rely on high performance libraries, native libraries that Intel develops for decades, Intel mass kernel library, Intel MPI, Intel data analytics creation library. These all good high performance libraries are used underneath to accelerate NumPy, SciPy, Scikit-Learn.
I see. So you take, let's say, NumPy. You take NumPy and you recompile it against these high performance Intel libraries. And that, because the foundation is faster, basically makes NumPy itself faster.
It makes as fast as, almost as fast as native code.
How much do you think the fact that you guys control the hardware and build these libraries that you can make them compile to exactly what they need to be or, or could anybody do this? Is it a big advantage that you guys control the chips and understand the chips?
Absolutely. I can tell you the example. I was with Intel mass kernel library team for 15 years. And we started optimizing MKL for new processor three, five years in advance of its launch. That's really huge benefit. So by day one of processor launch, we had MKL optimized for that processor. Same with Intel Python distribution.
We had Knight's landing Xeon 5 processor launch last summer. And by that time, Intel distribution for Python was already optimized for KNL.
I see. Because you guys have a long lead time. Yeah. I think that's a good, the other side of this is not just being able to, you know, have these libraries for if you're using those for scientific computing,
but there's a ton of usage of Python in the data center that is not scientific computing. You know, a great examples, the site Instagram, you know, any number of other sites that are out there that are using Python to open stack itself is implemented in Python.
So one of the things that in terms of working with the chip architects is being able to actually help them design the chip so it runs all Python better. Not just this live tuned library code, but all Python as well.
Right. And that's, you said there's some really interesting performance improvements that you got for running old Python. And we'll dig into that in a little bit. Because that's as fun as it is to look at the data science stuff and the machine learning performance and all that.
Most people are running old Python, maybe Python 2 stuff that they don't even want to touch much, much less optimize away. Right. So if somehow you guys can just magically make it run faster, like that would be good for us to do. Wouldn't it? I mean, it would make sense. Yeah, it would. It would.
So, I mean, we're talking about performance in terms of speed, but when you're optimizing like the data center, one of the major measures of efficiency in the data center is how much do I have to pay to run this in electricity and cool it?
So just like pure efficiency in terms of energy, right? Like how much of a difference have you guys seen in that?
That's really huge because part of the challenge in the data center is all the cooling costs and all the space costs and things like that. So Intel and Facebook work together to create a new server architecture, right?
That many of the Python programs kind of run in the data center on that architecture and that runs at 65 watts compared to…
Compared to… Yeah, give me an example. Like what is that relative to?
Compared to a server that runs at 150 watts. And so it's really efficient and then it has a lot of technologies that we are adding to the silicon itself to make it perform well at the same time.
Because people want both the power and the power.
Obviously you want the speed, but you can get the double density in a data center. So if you're AWS or Azure or Google or Facebook, you can have twice as much computing power and same amount of energy in and cooling out.
That's a real win. And not only that, that is something that we've observed, you know, an extra processor generation of performance improvement with, you know, some of these optimized software.
So that's something that's an advantage going that route. Yeah.
Yeah. And so what's really cool, I think, is some of this work that you guys are doing is being pushed upstream to CPython, is being pushed upstream to PyPy.
It's one thing to say, well, we have our own distribution and that one's really fast. So please use ours instead. But you guys are also giving a lot back by making Python itself faster for everybody or more efficient in energy terms or whatever.
It's really sort of not a one size fits all sort of philosophy. It's really doing data science. You're doing the using these libraries, Sergey was mentioning. That's the Intel Python distribution is a great one stop shop for all of that stuff.
If you're not using necessarily the libraries, then, you know, we're working in the sort of the upstream areas to make sure that any use of Python that you would download will run faster.
Yeah. Are there any notable specifics about what you've contributed to CPython or PyPy that you can think of off the top of your head?
Yeah. One of the things that's been interesting for us is making sure we have really customer sort of relevant, you know, workloads.
When we talk about workload, what this means is, you know, you have software just sort of sitting there, you install Python and well, that's not particularly interesting, right?
What's more interesting is if you can run some code that represents what everyone else is doing, right? And, and hopefully not like a just a simple sort of, you know, micro, right?
It's like something that's actually sort of realistic. And so one of the things we're really excited about is we just open sourced with Instagram, a new workload that will represents what not only Instagram is doing with Django, but also represents a lot of other Django usage out there.
And so that one is really by open sourcing it by both companies contributing to it. I think it's going to help everybody sort of drive performance better, right? We also do a lot of monitoring of the sources.
So for Python 2, Python 3 and PyPy, we actually do a nightly download of the sources, run a bunch of benchmarks and then report the results out to the community.
So anybody can go to languagesperformance.intel.com and see a complete readout of a bunch of different workloads with the different versions of Python and PyPy.
And so you can see exactly on a day to day basis how the performance changes. Now, the reason why this is important is someone can do a pull request that slows things down by 10 or 20%.
We've seen this in some cases where a single pull request, you know, will really slow things down, right?
And so we're not only monitoring this thing, we have engineers that are jumping on it and being able to see, hey, if we have a real regression in performance, we want to jump on it very quickly and get it back.
So this is one of the earliest things that we did in these languages to try to help with this.
That's a big deal because it's very hard to be intuitively accurate about performance, isn't it?
Or it could be your intuition might say one thing, but it might be absolutely wrong.
You go, well, this should run faster.
And it's like, wow, it only, you know, improved like half a percent or maybe it degraded, you know, 5% because a lot of the things that might have gotten pulled in or just assumptions that were missing.
Right, right.
The code looks tighter, but it actually does something different with memory.
Some example, I think that if you look at, say, a list comprehension versus a for loop that adds to a list, I think the list comprehension is faster, even though they're effectively doing the same type of thing.
Right.
These types of things are pretty interesting.
And by the way, if you're a programmer, I think I made the comment last year on the podcast, the best runtime in the world, the best libraries in the world and poor Python code, right, will still run poorly.
Right.
And so one of the things I think I'm really also very excited about is that we have a great profiler called VTune.
It's from Intel.
The group Sergei is from.
And there you're actually able to see where the hotspots are in your Python code.
And I think this is really powerful because, you know, I think both the runtime and the user code are really important to optimize or else you may not get nearly what you think you're going to get in terms of performance.
Right.
Even if you adopt the fast libraries.
Exactly.
If you have an O, if you have some sort of exponential order of magnitude algorithm, you're still in trouble, right?
Or an order log in or something like that, right?
Yeah.
Or order n squared or something like that.
Then you want to make sure you actually can identify some of those things and correct them.
Yeah.
So Sergei, tell us a little bit like how would I take a, let's say we're talking about Django.
Could I take a Django app and apply this VTune profiler to it and get some answers?
Absolutely.
This is what we suggest essentially as a first step.
You run your application on your architecture.
You want to understand what affects the performance and how I can improve this performance.
The first step is to run it with a profiler like VTune.
And VTune, this is, exists for many years.
This is product known for profiling native codes.
Yeah, I remember VTune from my C++ days.
Yeah.
The only challenge with that when you run VTune in old days with Python code, it didn't show
your Python specific code.
You saw these weird symbols.
You're like, this C eval.c is really slow.
It seems to be doing a lot of stuff in here.
It tells nothing.
So what we added to VTune, it now understands the Python code and you can show exactly the Python
function or Python line of the code, the loop, which consumes the most cycles.
So you can really focus on optimizing this piece of the code using a variety of technologies,
either libraries or PyPy or other technologies.
Or maybe just changing your code.
Oh, yeah.
As you were saying, Michael, a for loop versus a composition, right?
Yeah, exactly.
Exactly.
Yeah, that's pretty interesting.
Does it require some kind of GUI thing?
Can I make this like a CLI, part of my automated build?
You can write command line.
If you like nice GUI, you can write GUI like, yeah.
So either a CLI or a GUI.
Yeah, yeah.
So any of you guys can take this one.
Suppose I'm sitting, you know, I got my MacBook Pro here and I've written my code and it runs
a certain way.
And then I want to like push it out to some hosted place, DigitalOcean, Azure, AWS, whatever.
How much would I expect the performance to vary on say like one of those VMs versus say on like my native machine?
And could I use something like VTune to like test it there?
So I test it in its home environment.
I think it's a great question.
You know, so much code is being run in the public cloud now.
My recommendation on that and, you know, performance, here's the other thing.
There's nothing against any of the public cloud providers.
But one of the things you if you're sharing compute resources, you're not necessarily getting the purest performance.
There's some sort of performance trade off for the fact that you're doing a dedicated machine.
And it varies, right?
You don't know what you have.
You have an SLA.
Are they doing machine learning or do they have an unpopular website and they just have to pay for a VM?
Or even, you know, in some instances, we have a noisy neighbor.
You know, maybe you'll have some VM that's destroying the cache, right?
By the way, we have a feature that we've added our processor to detect noisy neighbors and manage them, which is a separate thing we're doing for cloud service providers.
But anyway, for Python.
So, yeah, I would recommend running it native and doing most of your tuning there.
By the way, I've noticed that not all cloud service providers would let you run VTune.
Oh, really?
Yeah.
Well, it's not that it's not running VTune.
And it's just they sort of sometimes mask some of the, you know, some of the registers that let you detect, you know, the performance.
And so that's some of the things I think you've got either a private cloud setup or, you know, an on prem.
It's much easier to really tune the performance and figure out what's going on.
Maybe if you're doing open stack, you control the thing a little better.
Exactly right.
And, you know, hey, give people the ability to actually monitor the performance of what they're doing and figure out how to make it better.
Right?
Okay.
And also, like our silicon has these advanced features called the performance monitoring unit.
Okay.
Which, like when you're profiling on your MacBook Pro, VTune can really take advantage of that.
And it can tell you where your cache misses are coming from, where your problems are coming from.
Whereas, sometimes, if you try to do it on a public cloud, it becomes harder for you to figure out.
Right.
So, we would definitely recommend like what Dave is saying to be able to profile and get your code optimized and then deploy.
Yeah.
I see.
Yeah.
So, maybe test both, right?
Yeah.
Because on one hand, you get the best, most accurate answers on the real hardware.
But it actually has to live over there.
So, you want to know also what it does.
Yeah.
Certainly see what the experience is.
Particularly if you're expecting some throughput measurement, you know, set things up.
By the way, for performance work, we sort of recommend that people have something that they can run their code against that's repeatable.
You get repeatable results and then just change one thing at a time to kind of see what the change is.
Use a very scientific approach, right?
As opposed to changing a bunch of things and, gee, things, a lot of change, but I don't know what it was that affected.
Right.
Make a hypothesis.
Make some measurements.
Exactly right.
It's the scientific method, right?
It is.
That we were taught in school.
Yeah.
I think Aristotle and those guys were on the subject.
They were on the subject.
That's right.
My previous manager used to say, "Measure twice, cut once."
Yeah.
Yes.
Exactly.
Yeah.
Very much.
Perfect.
So, another area that you guys are working in that's, it seems to be like the last year or so this has become real, is AI and machine learning.
I remember thinking for like 10 years, like, yes, AI, machine learning, this type of stuff, especially AI, was like one of those always 30 years in the future sort of technologies.
People are working on it, but it doesn't ever seem to do a thing.
Flying car and jetpack.
Yes, exactly.
Like, as soon as I have my, you know, teleporter, I'll be able to do machine learning and stuff.
But over the last, I'd say two years, it has become super real, right?
We have self-driving cars.
We have all sorts of interesting things going on.
Lots of application of AI just in recommendation engines, facial recognition, all these sort of things that are just practical, everyday things.
Yeah.
It's going to have some interesting societal effects.
Absolutely.
I think in some very powerful ways.
Oh, social effects.
Yep.
We have a world need to think about what that means for us.
I totally agree.
I mean, I'm thinking of like breast cancer analysis.
We used to think radiology was like a super high-end job that like you're safe if you are a doctor.
And now it's like, well, or you feed it to this machine and it's actually a little more accurate.
You could talk about other social impacts like are you going to use past performance to indicate which is the best candidate to hire?
Well, if you did that, you might eliminate a lot of people of color or women because they haven't been as much in the workforce, right?
Right.
So you've got to be very careful at some of the social impact of these things.
However, I will say this.
One of the things we have been very, you know, there are a lot of systems on the internet, you know, that Intel's provided the chips for.
And there's a ton of data that's out there.
And so one of the things we did that's very interesting from a Python standpoint is since a lot of companies have this data accessible through Hadoop and Spark, what we've done, we recently just in March upstreamed our open sourced what we call Big DL.
Okay.
Big DL.
It's sort of a big deal.
Good.
Thank you.
I got to laugh.
Anyway, so Big DL has a Python interface.
So what it does is deep learning.
So when you're doing a training of a deep learning algorithm and then inference analysis, right?
What a lot of times that data that you're using to do the training on is accessible out of Hadoop and Spark.
So a lot of people have said to us, hey, we would like to be able to do deep learning on our Spark data lakes or, you know, Hadoop, right?
Big data.
It's like, yeah, so that's what Big DL does.
But it's like a lot of people said, we don't want to have to use Java to go into that stuff.
We'd like to be able to use Python.
So that's what one of the things that got released in March was our first Python interface to Big DL.
So this is one of the ways where a lot of organizations, they already have a big data lake already that they can access through Hadoop and Spark.
They can use Python and the Big DL project to do their deep learning experiments and then products.
Yeah, that sounds really, really cool.
And it sounds like you guys are doing a lot of almost reorganization of Intel around this AI research and work.
That's a very good observation.
In fact, we started up a new product group, the AI platform group.
Product group?
Platform group.
Yeah, AI product group.
Right.
We're reporting directly to the CEO.
So these are chips that they're making, that Nirvana is making, that actually does this deep learning inference, training and inference, much, much faster, order of magnitude better than anything else that's out there.
Wow. Okay. So I know about deep learning on CPUs and training and machine learning. That's pretty good.
You move it to a GPU and it gets kind of crazy. These chips, these are not just GPUs. These are something different?
Correct. Yeah. They're specifically designed for the problem set that deep learning presents to the CPU.
So it's not like, yeah, I mean, our main Xeon processors actually do deep learning pretty well compared to the GPUs that are out there.
But something that actually like turbo charge it and really take it to the next level, a chip that's specifically designed for that, not for that plus graphics or that plus something else.
Sure. Because traditionally graphics cards just coincidentally are good at machine learning.
Well, with a ton of effort, I remember, you know, the first time looking at, well, how do you get a GPU to actually do general purpose computing?
Let's see, if you do a matrix operation, right, it's a texture. And so let's see, we'll get a couple of textures as matrices.
We'll feed them into the GPU and then you can do texture, you know, lighting transform on the textures.
And it's like, well, that happens to be a matrix operation. Read out the resulting matrix.
And it's like, from a programming standpoint, you know, that's why you need a lot of libraries and things to help you through that process.
Can I express this general programming problem as a series of matrix multiplications?
Exactly.
That are essentially just texture, OpenGL texture processing and things like that.
So this is one of the things I think is very exciting about moving this into the mainstream in terms of either, you know, at the x86 Xeon processors.
And then as we bring Nirvana's chips, you know, we bring them into the Xeons.
We have, you know, actually FPGAs as well.
You know, these are special purpose.
You know, you can program to do a bunch of accelerations and they have multiple acceleration units built in.
And so we can actually accelerate a lot of things along with the CPU.
So there are a ton of options that we're bringing to the table that will really accelerate a lot of specific workloads.
Yeah, that sounds really interesting.
I want to dig into that some more.
This portion of Talk Python is brought to you by us.
As many of you know, I have a growing set of courses to help you go from Python beginner to novice to Python expert.
And there are many more courses in the works.
So please consider Talk Python training for you and your team's training needs.
If you're just getting started, I've built a course to teach you Python the way professional developers learn by building applications.
Check out my Python jumpstart by building 10 apps at talkpython.fm/course.
Are you looking to start adding services to your app?
Try my brand new consuming HTTP services in Python.
You'll learn to work with RESTful HTTP services as well as SOAP, JSON and XML data formats.
Do you want to launch an online business?
Well, Matt McKay and I built an entrepreneur's playbook with Python for Entrepreneurs.
This 16 hour course will teach you everything you need to launch your web based business with Python.
And finally, there's a couple of new course announcements coming really soon.
So if you don't already have an account, be sure to create one at training.talkpython.fm to get notified.
And for all of you who have bought my courses, thank you so much.
And I think it really, really helps support the show.
Just on the general machine learning stuff, Shuresh, you were working in the data center and optimizing that space, right?
Over the next five years, how do you see machine learning contributing to that?
Like, can you take a trained up machine learning system and say, "Here's my data center. Here's what we're doing. Can you make it better?"
And just ask it these questions. Like, is that something that could happen?
No, that's definitely happening because it's all about like, what are the inputs that you can take in?
And the more inputs you can take and learn some specific things, then you're able to start optimizing the system.
So we'll start seeing this kind of technology becoming more prevalent in a lot of things that we do.
It's very exciting time to be in this field.
It's every day I wake up going, "It's even more amazing than yesterday!"
So, same question to you, Sergey.
The big deal in this new area is cross-team productivity.
You cannot solve the modern complex problems without involving domain specialists, programmers, data scientists.
This is all new collaborative environments. So productivity is the key.
This is what we are trying to offer through Intel distribution for Python.
We provide out-of-the-box performance and productivity to our customers.
So they can focus on solving their domain problem in deep learning, in machine learning in general.
And then with Intel distribution for Python to scale this to real problem in data center.
How about parallel distribution, multi-grid computing type stuff?
What do you see out there and what do you see working for that in the Python space?
Yeah, I mean, I think one of the things that is, like I said, we have an array of things, so to speak, that you can bring to bear on different problems.
One of the ones that Sergey mentioned is something we call Xeon Phi, P-H-I, Xeon Phi.
And it actually, as opposed to maybe 18 cores on a chip, it might have up to 80, 90 cores per chip, right?
So think about that.
I mean, think about these all x86 compatible CPUs, all available to do a variety of things in parallel.
So that's an interesting model to think about.
It's like, if you have parallelism, you can express it a number of different ways.
You can express it in terms of the vector.
We have vector processing within the CPUs.
We have this parallel processing.
And I think Python has a lot of, you know, certainly some of the things that Sergey was mentioning in terms of these libraries that can be, make use of the vector operations within the CPU and really turn up the performance, right?
So, traditionally, Python has sometimes had a few challenges relative to, you know, parallel programming.
And so, one of the things that's really cool about thinking about one of these libraries like MKL that Sergey mentioned is it can automatically take advantage of the parallelism that's available, right?
And so, you know, if you have one of these, by the way, the Xeon Phi, if you go to the top 500 supercomputers, there's a significant number that you can look at and it says, oh, it uses the Xeon Phi as part of that, right?
So, the top, you know, supercomputers in the world are using this chip basically achieve incredible results.
It just keeps going.
It's really, really amazing all the stuff that people are doing there.
So, back to the AI chip.
It sounds to me like what you're telling me is you have this custom chip, which makes a lot of sense because, like, GPUs, they were meant to do a video process.
If you could make a special purpose chip for that, you're in a good place.
What about other things?
Do you guys have other specialized chips coming in addition to AI?
Is this a trend, right?
Yeah.
Going to have more specialized chips.
A couple of things I would talk about there.
One of them is you may have heard of a new memory technology that we've actually, it's incredibly revolutionary.
I say that, you know, as an Intel guy, but I got to tell you, it's just mind blowing is that it's memory that sits, you know, you think about DRAM, you know, your regular memory and your Mac or whatever.
Versus flash memory, right?
The flash memory is you can get a lot of it.
It's lower cost, but it's slow.
Main memory, the DRAM is like super fast, but it's expensive, right?
And volatile.
What if you could have memory that was non-volatile, if you want it to be, and sit in between flash memory and DRAM, right?
Okay.
And so we've come up with this, we call it 3D cross point.
It's a memory technology that's coming out in SSDs now.
And think about it from a Python standpoint, being able to make use of memory that's, it's actually chips in the DIMMs in the computer itself.
So when you power on the computer, it actually has, you know, this persistent memory already available without going to the SSDs, right?
So it's instantaneously available.
I see.
The choice previously has been better with SSDs.
I remember when it was not.
So the choice is, we've got this regular DRAM, and then we've got swap.
And that's like a hundred times worse, or something, to go to swap.
And if it's a slow spinning laptop, cheap disk, maybe it's way worse than that still, right?
But think about a data center where you have maybe a few terabyte of DRAM in a system, and then multiple terabytes of this.
It's just right as more, you know, memory DIMMs in the computer, right?
This is amazing, right?
And not only is it super fast in terms of latency, access latency, but it also can be used persistent.
So these are things which are, from a Python standpoint, we'll actually be able to make some of this stuff available to Python programmers when these products start rolling out.
So this is a very interesting future.
The other thing from a future chip standpoint that I think is very interesting is to look at, we're now, because we're partnering up with a chip designer.
You're talking about Intel controlling the chips, right?
One of the things we're able to do is, folks like Suresh, Sergey, are able to partner up with the chip designers and say,
"Let's take a look at how Python runs on the chips."
Okay?
So you're running this stuff and you go, "Oh, hmm, looks like from the size of the code footprint, actually we're spending a lot of time just twiddling our thumbs in the processor,
because it's waiting for instructions to get fetched."
Is that because it's too big to fit in the smallest cache?
Correct.
And this is true of a lot of interpreted languages.
If you look at PHP, Node.js, et cetera, they're all of these massive code footprints.
If we've analyzed the internal pipelines within the CPU, we see this idling effect, right?
And now with the next generation of chips that are coming along, they've actually taken a look at this and actually we're amazed at how much they've been able to improve on this instruction level parallelism.
So in fact, even with a single instruction stream without parallel instruction streams, they're actually able to run old Python code faster.
So if you think about it, if you've got a data center, I've got a bunch of Python running there, one of the best things you can do.
Now, you know, we as software guys would say, "Oh, we want you to use all of this good software goodness."
What are you running on this old version of Python?
Right, right, right.
Use the new upstream version or use the Python distribution, et cetera.
But the good news is as an IT decision maker, you can now think about, well, upgrading to the latest Intel CPU actually runs Python.
It's more than just like a, is it a different clock speed?
It's not the frequency that matters.
It's not even really the number of CPUs.
The CPU itself actually at the same frequency can actually process Python much, much faster because it's making use of more of the CPU.
Does that make sense?
Yeah, yeah, that makes a lot of sense.
Well, and you know, you make your comment about as a programmer, it's great to use all the new stuff.
I personally as a programmer would like to work on new code that is adding new value and not go, "You know that crummy thing that's been there for 10 years?
We need to rewrite that so we can save on computers."
Like that is not where I want to spend my time.
Like you guys don't, right?
Right. Oh, yeah.
Yeah.
So if you can just make it run faster without me touching it, then I can go write stuff that I want to write, like that new REST framework.
By the way, I would say one of the things that's cool about either PyPy or the Intel Python distribution or the other upstream work that we're doing is those typically don't require code changes either.
So that's the other thing is that if you make, you know, that's sort of the goal.
We sort of feel like Python's a powerful enough language and an attractive enough way for programmers to work, productive way for programmers to work.
Why should they be hobbled by performance, right?
Why not provide something that will immediately give a boost?
Now, we'd sort of like to think you ought to get a new processor too.
I think that's a good idea.
I think all of us would appreciate that.
Yeah.
I think good.
But then, you know, some of these other things, our goal really is to make it so you, by taking a few actions, you don't have to change the code.
Now, there are some new things, by the way, if you want to get into your code to let me play with some new features, right?
That's where we've got some of these things like some accelerators or big deal, which will let you use Python to do more deep learning sort of things or maybe accessing this 3D cross point memory.
So there's a lot of stuff that's going to be very powerful to bring this stuff to bear.
If you want to change the code.
And if you don't, you know, we have these other things to help you out with.
Sure.
You know, if it's your core product, right?
If your Instagram and these are your APIs or whatever, like you probably want to spend some time to make those faster.
Yeah, absolutely.
Right.
Things like that.
Interesting.
So what about Cython?
Have you guys thought about how Cython works on the chips?
And for those people listening, maybe they don't know.
Cython is like Python language with a few little tweaks that compiles basically down to C or the way C compiles, right?
In fact, Intel Python distribution is making both Cython and Numba, which are a couple of these, you know, moving to C code, basically, right.
And then their trade-offs, as engineers know, their trade-offs for everything.
The nice thing about that is you can get optimized either Cython or Numba, you know, as part of that package, right?
Some people will go, well, I don't want to have to give up on the quick turnaround of being able to change code and have it interpreted, right?
So that's where some of those trade-offs go, right?
Python 2, Python, CPython, PyPy would tend to say, hey, you can still have the same development methodology.
Yeah.
Numba, Cython or more.
There's a build step, which is weird to all of us, right?
Yeah.
It's all about choice.
If we don't have Cython or don't have Numba, what choice do we have?
Going to native language or staying with Python?
So we're just providing choices.
People can make trade-offs to get what they need.
That's a great point.
If you choose any of these things, we want to make sure Intel is the best option to use for it.
Yeah, that's cool.
So let me ask you this, okay, about like maybe a workflow.
So I write my code all in pure Python.
Maybe run on CPython, right?
See how it works.
Maybe it's not quite as fast as I want.
Or maybe you just want to optimize it because it's better to have it faster.
Like you can scale it, put it more, you know, more density or whatever.
Then I run Vtune against it, figure out where it's actually slow.
That might be like 5% of my code or less, right under like a large application.
Like it's actually these three parts that kind of kill it.
Like if I look at my website right now, which is pure CPython talking to MongoDB,
the slowest part of the site is the deserialization of the traffic back from the database into Python objects.
Like that's literally 50% of workload on my website.
And so I'm not going to change that because that's not my library.
That's like a different ODM.
But if I did control that, like would it make sense to go write that and say Cython,
that little 5% and then somehow bring that in?
What do you think?
Optimizing last 5%, if you make it zero, even zero.
Yeah, the 5% that's spending where almost all the work is.
The 5% of my code base where I'm spending 80% of my time or 50% of my time.
Yeah, totally it makes sense.
Totally it makes sense.
Okay.
You really focus how do I optimize the biggest hotspot with minimum code changes.
Right.
5% is a nice, nice hotspot.
Right, right.
If I rewrote 5% of my code in Cython, but that's where it was mostly slow,
you could probably get a big bang for the buck, right?
Right.
It's like I was one day just lunchtime, I got this call on my cell phone.
It happens to be this Intel executive that I kind of know, an acquaintance, right?
And she said, "Oh, my daughter is working on this project in school with Python.
It's running really slow."
This is hilarious.
How did you know that I was, you know, I heard you had something to do with Python performance.
And so, can you do anything?
I've got an insight at Intel.
I'm going to figure out why my code is slow.
That's it.
And, oh yeah.
Well, trust me.
You know, I've learned many things sitting down with people at lunches, like people who
created all manner of things in our world is like, "Oh, that's why that works that way."
Okay, interesting.
Anyway, so I said, "Well, have her try PyPy."
As an example, it's a very easy step to try and, you know, see if it speeds things up,
right?
And so, I didn't hear back from her, so I suspect that probably either worked for her or she got
frustrated, who knows.
But I've talked to, there are plenty of like architects, CPU architects, and people who,
there are people who have this massive lake of instruction traces.
So we're actually able to take millions of instructions and record them and figure out
what's going on.
That's how we analyze future chips and analyze performance on them and running these existing
instruction traces.
And so, they will maybe have billions of instructions floating around in Python scripts
that will actually go figure out what's going on and categorize them and help, you know,
develop what's going on.
But if that stuff runs really slow, and it was actually one of those architects that mentioned
PyPy to me the first time, and he was like, "I think he's actually here.
He retired.
Lucky dog."
And so, you know, I got to find him and thank him again for, you know, having helped us,
you know, get more insight into this stuff.
Yeah.
Yeah, that's really cool.
So, coming back around to your AI focus, do you guys see AI?
How can you design chips in the future?
That's a very interesting question.
I'm sure a lot of engineers that I've worked with might be considered artificial intelligence.
No, I'm sorry.
I am an engineer, so what can I complain about?
I think there's already a lot of machine learning being employed in the design of the chips.
We have a building.
There's a particular building.
I can't tell you where it is.
Is that in Portland?
It's an undisclosed location.
Okay.
I will say you, there is a building that's stuffed full of CPUs, and it's got the most amazing structure.
It was built really interesting structure.
But that thing is running, essentially using machine learning to analyze simulations of chips continuously, 24/7, 365.
Wow.
So, that place, it's really kind of fun to kind of think about all of that's going on, and I've actually taken a tour.
It's super cool.
This portion of Talk Python to Me is brought to you by Hired.
Hired is the platform for top Python developer jobs.
Create your profile and instantly get access to thousands of companies who will compete to work with you.
Take it from one of Hired's users who recently got a job and said, "I had my first offer within four days, and I ended up getting eight offers in total.
I've worked with recruiters in the past, but they were pretty hit and miss.
I tried LinkedIn, but I found Hired to be the best.
I really liked knowing the salary up front, and privacy was also a huge seller for me."
Well, that sounds pretty awesome, doesn't it?
But wait until you hear about the signing bonus.
Everyone who accepts the job from Hired gets a $300 signing bonus.
And, as Talk Python listeners, it gets even sweeter.
Use the link talkpython.fm/hired, and Hired will double the signing bonus to $600.
Opportunity is knocking.
Visit talkpython.fm/hired and answer the door.
"You know, we have been using machine learning essentially to design CPUs and validate them.
A lot of what we're doing, by the way, is not waiting for the silicon to be baked before we figure out whether it works or not.
We actually have a lot of simulation that we're doing.
We have a little, we actually, you can actually buy it.
It's something called Simix, which we actually are able to produce simulations of all of the things that are going on in the chips, right?
And so we're actually able to run a ton of workloads and programs through this thing before the chip ever appears, right?
And so we're able to run essentially, whether it's Python, Java, you know, any number of things through these simulators.
So that by the time that the silicon comes out of the fab, it actually already runs all of this stuff.
So there's a lot of stuff that we're doing to, you know, accelerate the design of the chips.
Yeah.
I think it's going to be 10 years from now, we're not even going to predict it, the majority of the stuff that's happening, right?
Well, think about what happened 10 years ago.
It wasn't, you know, I mean, you know, Facebook or any of these other things in the internet.
Google, all these things are around, but it's like the concept of how they've affected our lives now.
Yeah, it was just the dawn of internet as a usable thing for everyone.
Yep.
Right.
And it's been fun to be a part of, you know, Intel to have really helped fuel this thing.
And now I think from our standpoint, one of the things that's very exciting is to, you know, say,
"Hey, how can we project the future better?"
Because you talk about how to figure out how things run better in the future.
One of the things we're doing is a tremendous amount of work in the whole area of benchmarking and performance, right?
If you think about it, we talked about, you know, various things like this, this Instagram, you know, Django benchmark that we're working.
There are other various, you know, codes that we're working on for the Python distribution.
But one of the things that we're doing is kind of really looking at the whole area of AI as an area.
And it's like, how do you benchmark that?
Or think about big data.
Think about if you maybe have, you're standing up Cassandra and Kafka and Node.js and all of these things in a system.
How do I figure out what the performance is today?
And then how do I project forward performance on some of these things, right?
And so there's a whole area.
I'm incredibly excited about this is that you're going to start seeing more and more of this from us.
I think I'm working on a lot of it myself.
Of seeing us really take a much stronger position out there to try and help contribute some of this stuff to the industry.
And so you can take your, you know, Instagram, Python, Django benchmark, for example, and evaluate what is this going to work against, you know, this CPU versus that CPU or this vendor system versus that one, this public cloud versus that public cloud.
These are all things that I think are incredibly powerful to think about.
Well, the control now is with you as a user to figure out what kind of choices do I make?
So we're doing a lot in that sort of space because we sort of believe that in the data center, you know, performance is king, right?
It's like, and people have come to expect from us every CPU generation to have a good whatever it is, 30 to 40% boost at the, you know, right?
Same price point.
So performance is king as far as we're concerned in the data center.
And we're doing a ton of stuff to try and drive the future and use this whole area of benchmarking and workload.
So we would love, by the way, from the community standpoint, if they have representative sort of workloads that they'd like to work with us on, we would love to get involved with that because that's something we're incredibly excited about.
Yeah.
I think there's having realistic workloads makes a super big difference.
Take your MySQL, your website, right?
Yeah.
The data marshalling issue that you're going.
We'd love to be able to have that as kind of a standard piece of what we're looking at to make sure either the CPU runs it really fast, we can go in with the library providers and make sure that stuff gets accelerated, right?
So those are the kinds of things we absolutely want to stand up.
And we think there's a dearth of these things actually representative benchmarks that will help people visualize what's going to the data center today because it's not just like your old database.
You know, you know, you know, your big, you know, SQL databases, you know, running relational database transaction processing, all this stuff exists.
But there's a ton of new stuff in the data center today.
And we sort of believe that Intel will be contributing strongly to this area.
So you guys, I feel like over broadly across the industry, there's like a, a mind blowing opening into open and open source from where from all sorts of companies that you just wouldn't expect.
Right.
I mean, the stuff that Microsoft are doing, like Facebook with their, some of the open HHVM and the open data center project.
Yeah.
The data center stuff that people just, so you see Intel contributing more to these open source projects in order to make your story back at the data center better.
Absolutely.
I mean, Intel has been for the past few years, the top one or two contribute to each Linux kernel release.
So you go back in time, who, who are the top contributors to the kernel?
Intel has been like number one or number two for years now.
Okay.
For each kernel release.
So that in and of itself represents a very strong commitment to open source, at least at the core.
Right.
So all of the work that we're doing is on open source code, right?
So whether it's Python, whether it's open source databases, you know, this is a very strong commitment to open source.
Absolutely.
That's awesome.
All right.
So we're kind of getting near the end of the show.
I have two questions.
And I'm going to mix it up a little bit.
Uh-oh.
Because normally I have the same two questions.
I kind of biffed the last time in your standard question.
So, uh.
So the two questions are, Sarah, I'll start with you, is if you're going to write some Python code, what editor do you open up?
What do you usually write your code, your Python code in?
I usually don't write Python code.
I am.
You're analyzing how it runs.
I'm an outlook guy.
Okay.
Gotcha.
Speaking, I typically use Spider.
Spider.
Okay.
Yeah, sure.
Spider's good.
The continuum guys.
I don't know if they're here.
Sure they are.
I haven't been able to do the rounds yet, but that's a cool thing that comes with the Anaconda.
David?
Suresh.
I recently took a class at Hack University.
It's a local organization.
Mm-hmm.
I've been loving Jupyter.
Oh, yeah.
I've been working with Jupyter.
Jupyter is amazing.
Yeah, yeah.
David?
My fingers are programmed with VI.
I'm sorry.
I'm an old guy.
My fingers are programmed with VI.
It's the only way muscle memory works with me.
So, yeah.
There you go.
Awesome.
Then I guess I'll ask you the standard questions while I have one more.
Suresh, there's a ton of packages on PyPI, over 100,000 now, which is partly why Python
is such an amazing community.
Like, all these different packages you can just install and use.
Think of a notable one that maybe people don't know about that you've come across.
I should have prepared you guys for this question.
Yeah, yeah.
You did a good question.
I did a bad job, but it's good for you to be surprised at that.
Yeah.
I think some of these lightweight web development ones, like Flask.
Yeah, Flask is amazing.
Django is really popular, but people are using Flask for some lighter-weight things.
Yep.
A lot of APIs built with Flask.
We also have the Django REST framework guys here.
So, yeah.
For sure.
How about you, Dave?
I'm going to suggest people check out, I don't know if it's in PyPI or not, but big
big deal.
Yeah.
It's a great thing to check out.
Big deal?
Okay.
It's a big deal.
It's awesome.
All right.
So here, I want to throw one more in as a mix.
Since you guys have a special vantage point towards the future, predict something interesting
in the next, that will come out in five years that we would be maybe surprised by.
Like, just in computing in general.
Sresh, go left or right.
Yeah.
I think, I think AI is going to be like really, really pervasive.
Yeah.
Much more from your glasses to the clothes you wear to all kinds of things, the car you drive.
Yeah.
I can definitely see on automobile AI processing for sure.
Yeah.
This edge processing stuff.
Yeah.
David?
I'd like to see a more organic approach to computing.
You know, our artifacts are, you know, slick and carbonized or aluminized or what have
you.
I would actually like to see computers made out of natural wood cases with maybe some mother
of pearl or, you know, something that would just actually be more human.
I mean, almost a steampunk kind of approach or a more organic approach.
I'd love to actually see it become a more organic part of our lives as opposed to dehumanizing.
Sure.
Well, as it goes into this IoT of everything, and we have these little chips that run Python,
MicroPython and other things, it's much more likely that we'll have little computing things
that are more adept rather than beige boxes or aluminum boxes.
Sergei?
I think whatever direction industry will go, Intel will become, will stay relevant
and be at core of this transformation.
Yeah.
That's my tradition.
Yeah.
You guys will be there.
So here at PyCon in Portland, Oregon, you guys have a big presence here.
Just one quick fact that I think people might like to hear is how many Intel employees do
you guys have in this general area?
The exact number as of whenever your audience listens to this may be different, but it is
true that as you know, Intel is the biggest chip maker in the world.
Oregon is actually our largest site.
So we have sites really all over the world, but it's kind of a, this Oregon from that sort
of standpoint is, is we're growing not only the new fab processes, the new absolute micro things
that are going on into design of the manufacturing, making millions and millions of things that are a few nanometers big.
You know, it's amazing.
We also have kind of the center of a lot of our software work going on here, as well as the circuit design itself is going on here.
So there's a nothing against the other, you know, parts of the world where Intel does business, but it's a, we have, we have, we have a lot here in Oregon from that.
Yeah. It's like over 10,000, right?
I can't actually give a number.
I would probably be, I would probably be shot if I did.
So I don't know. No, no, no, no one would shoot me, but I couldn't tell you.
So I guess the point is it's really surprising. Like what a presence you guys have here, right? This is definitely in Hillsborough, Oregon, to the west of the West Hills from Portland.
You guys drive traffic jams. I'm sure with the, your workforce, we try and stay outside of the traffic jams if we can.
So yeah.
All right. Well, thank you so much for meeting up with me and sharing what you guys are up to with everyone on the podcast.
Thank you, Michael. It's been great. You have a great listenership.
I know of people who've come up to me amazingly. So, oh, you were on, you know, Michael shows.
I was like, I, I, here's a shout out to all the great Python programmers out there.
Really appreciate everything you're doing with Python.
David, Suresh, Sergey. Thank you guys. It's a pleasure as always.
Thank you for all your work that you're doing.
Yeah. Thank you. Bye.
This has been another episode of talk Python to me.
This week's guests have been David Stewart, Suresh Srinivas, and Sergey Medinov.
This episode has been brought to you by Talk Python Training and Hired.
Hired wants to help you find your next big thing.
Visit talkpython.fm/hired to get five or more offers with salary and equity presented right up front and a special listener signing bonus of $600.
Are you or your colleagues trying to learn Python? Well, be sure to visit training.talkpython.fm.
We now have year long course bundles and a couple of new classes released just this week.
Have a look around. I'm sure you'll find a class you'll enjoy.
Be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, Google Play feed at /play and direct RSS feed at /rss on talkpython.fm.
Our theme music is developers, developers, developers by Corey Smith, who goes by Smix.
Corey just recently started selling his tracks on iTunes.
And you check it out at talkpython.fm/music.
You can browse his tracks he has for sale on iTunes and listen to the full length version of the theme song.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Smix, let's get out of here.
I'm dating with my voice.
There's no norm that I can feel within.
Haven't been sleeping.
I've been using lots of rest.
I'll pass the mic back to who rocked his best.
I'll pass the mic back to you.
Oh, no.