Video
Đăng bởi Quản trị viên OpenER ·
Tác giả giữ toàn bộ bản quyền (All Rights Reserved) — không phải giấy phép mở. Bạn vẫn xem và học miễn phí trên OpenER; muốn tái sử dụng cần xin phép tác giả.
DAN GARCIA
Hey, hey. Sorry, just juggling five balls. Good to see you. Today's topic, welcome to 61C's topic on thread-level parallelism part I, woo!
Great to see you, as always. Let's jump right in. We're going to start with a conversation about parallel computer architectures. So big picture — step back, 10,000-foot view.
The goal of 61C is teach you how to program a computer really well so that you can increase performance. There are many ways of doing that.
If you were building a system, if you were a computer engineer, building a system, the first thing you do is, change the heart rate. Change the speed of your mouse.
Your heart rate is 300 to 800 beats per minute. That's a lot. So think about just turning that crank up, turning that crank up — gigahertz machine, 2 gigahertz, 3, 4, 5.
That's incredible. But we've kind of stopped. We're going to talk a little bit later about why we can't go much past that. It's really about power dissipation.
We can't keep these chips cool, so we've kind of maxed out.
So we increase the clock rate as much as we can, but power issues, how much total power, how to dissipate the power, and the power density — all those things are relevant in that conversation, and we can't quote much past 5 gigahertz.
Next, well, we can also lower the CPI, Cycles Per Instruction. That says, lower SIMD. Sorry, this means, go SIMD. This says, Single Instruction, Multiple Data.
Can one instruction operate on wider data? Can you operate on four floats at once? That'd be amazing. We've done that and talked about that in the last lecture.
So try to go wider, so SIMD. You could also perform multiple tasks simultaneously. You can have multiple CPUs, each executing a different program. This is great.
These tasks could be related.
They're all tight, working on the same matrix, and many guys are doing some part of the same matrix, or completely unrelated — distributed web requests, or on different computers, even — you can imagine that — or running PowerPoint in one thing, and a QuickTime movie in another thing, and doing a spreadsheet calculation in another thing.
So it could be related very tight in the same program or very different things, and so that's different scales.
So this lecture is about the top level, the idea of three, of just doing something about the same program. We're working on the same program, the same data.
And how do you divide that up into a parallel space? That's today's lecture and actually the next couple of lectures. We'll talk about that. And in summary, you can do all three of them.
That's the idea. So do all the above, high clock frequency, go SIMD, go wide with your vectors, and multiple parallel tasks as much as possible.
So big picture — we always show this in the — having a new module.
By the way, this is a new module, so if you're behind, jump on this and feel free to reset here. This thread-level parallelism is very exciting.
So you see in the left — let's even get the pen. Where's my pen? Let's even get the pen out and talk about, well, this. You've seen hardware descriptions.
If I've got a 32-bit-wide AND gate, that's 32 operations all happening at the same time. Done that already. You've seen parallel instructions, where we did pipelining.
Now you know how you can do up to five. It's a five-stage pipeline. There's five instructions.
They can all be chunking up through that little slice of time, can have five instructions all active at the same time. Pretty neat. Parallel data was about SIMD.
Can we go wide with our vectors? Can you add four vectors in one clock cycle? That's great. The next couple lectures are up here.
So the next couple of lectures this space, and in fact, in particular, this lecture is about parallel threads, and there's the next couple of lectures talking about thread-level parallelism, and that's the piece of this.
How could you have different cores, each of them working on different threads? What do all those mean?
What's required on the architecture point of view to make that work? All that's this lecture and the next series of lectures. So here's some big pictures of parallel computer architectures.
Early, early days view of this — I love this picture.
This is a picture of just trying to throw a couple of machines together, wire them up via Ethernet and say, let's try to have a job that can really — this is distributed computing in some sense.
Can you take a job that is far enough, it has enough pieces that can be broken off, that a whole computer can be asked to work on that piece and then somehow collect that together?
So usually, there's a command module that divides it up, all these kind of worker bees working on something, and then they come back.
But you're communicating via Ethernet or via a shared drive or something like that. When you go full scale — this is what happens with all the national labs.
This is what we have in supercomputers.
So you have these massive racks, massive server racks with an array of computers, and we'll even talk about that a little later when we talk about warehouse-scale computers.
Most of those computers, just FYI, are working on computational science problems. They're usually working on floating-point data. You're doing matrix multiplication. You're doing neural network stuff.
You're doing climate simulation. A lot of these things, all of them, the actual data that you care about the most, is floating-point data.
It's not integer-based data where you're thinking about int and two's complement numbers. You're dealing with doubles, mostly almost dealing with doubles, or even more if you need higher precision for that.
So that's what those machines are doing, and those are unbelievable. You go to supercomputer conferences. They're those machines, and they're talking about how to crunch on massive, massive, massive floating-point data sets.
In your phone, in your watch, in your computer, we now have also multicore machines. We talked a little bit about that, and we'll get a little bit deeper into that and how that works.
And these multicore — and this is on a single chip. This is on a single chip. Multicore machines — there's some graphics. There's maybe a shared L3 cache.
L1 and L2 are separate for each core. It's incredible, and we've shown a picture of that before, and that's another architecture.
So all these are ways to think about parallelism at different scales, actually, at different scales. So let's dig deeper into that bottom-right picture. What's happening if you have a CPU with two cores?
This is, again, single disk, single die, two cores in that. Let's just go very simple. So what does that mean, two cores?
Does that mean you're doubling memory, so now my 32 gigabytes of memory or maybe more? Computers nowadays — you've seen virtual memory. You know the idea that there's a distinction between it.
It was all a lie between how much actual memory you have and the address space. I can have a 32-bit address space. That's 4 gigabytes of allocatable memory.
How do I have 10 programs, all of which are controlling all 4 gigabytes? Well, that's the idea of virtual memory.
Each of them has a virtual address space that's that big, which that means now, now I can have an actual computer that has not exactly 4 gigabytes — if you didn't have that abstraction, you'd have to have a machine that has exactly 4 gigabytes, and only one program can be running at a time, or you could be switching and time slicing it.
But now with virtual memory, you've seen before we can have many machines. Each of them thinks they have the whole 32-bit address space or even a 64-bit address space.
And the amount of actual memory you have can be more than 4 GB or less than 4 GB, certainly not 64 if you're living in 64-bit address space.
But mostly, that RISC-V 532 means it's a 32-bit-wide virtual address space. How much actual memory you have doesn't matter. I mean, you could have a huge amount.
They now sell 1.5 gigabytes of RAM on the new Mac Pros, incredible. And you can have a machine that has very little, and you can still run 32-bit address space programs.
All right. So we talk about one die with two cores on it. Does that mean you're somehow doubling memory? You're not, because the core doesn't memory on it anyway.
The core's over here. Memory's over there. So what does it mean to do this?
It means you're separating two different processor cores, each of which, each of which has its own control, its own datapath, its own PC, its own set of registers, its own ALU.
They are really two full, quote, unquote, "computers" on one die. Those two cores are on one die, and they really are fully autonomous. They can be completely running separate things.
I'm doing a load. You're doing a store. I'm doing an add. You're doing a subtract — simply separate different registers running two programs at the same time.
We love this. That's a two-core model. What is the shared part of it, though?
Well, the shared part of it is, I've got one memory block, and I/O is working within that, and I've got my I/O interface here. We talked about I/O a little bit in previous lectures.
So there has to be some communication where each processor is making load and store requests to memory.
And now you have a conversation about what happens when they're both writing and reading to the same spot or writing and reading — how do you synchronize that?
There's some conversations lower down on that.
But at the big picture — this is a 10-mile view up — you have two different cores, to everything you know about — everything up to this lecture was just this picture.
This was the picture up till now. And now we're saying, well, I want to have two cores on the same die. Well, let's have a second guy and this interface.
Here's the extra interface, the same connection you had in memory, loads and stores. That's the way you can make this work.
There is a little more details with the caches, but from this 10-mile view up, you have two cores, two distinct control datapaths, PCs, registers, and ALUs all working with one shared memory.
This is called a shared memory model. Okay, so now let's dig a little deeper. This is the last slide on this first lecture. Each processor is executing its own instruction set.
It's chunking through two different programs, all running in parallel. Separate resources — datapath, PC, registers, ALU, said that already. Highest-level caches are also going to be separate.
You want to be able to not have to go to Sacramento as you're making memory requests, and it's not there, you want to be able to save it, and have your net is there.
Your L1 and L2 net is there, saving you from going to Sacramento, because that one shared spot. You do have some shared resources. We mentioned memory is a shared resource.
It's expensive. I mean, 1.5 gigabytes of DRAM is very expensive, so you're not going to duplicate that per core. You got many, many cores in the newest machines that's certainly not duplicated.
You will duplicate L1 and L2, typically. And L3 is funny. L3 is usually really big, and so usually in the megabytes. So you're probably going to have a shared L3, although not required.
It's often on the same silicon chip, doesn't have to be. All that's still in the model of a multiprocessor execution model, doesn't have to be there.
You can decide, well, there's no L3 at all. That's still fine. It's still in the category of a multiprocessor system.
Here's some new words that you might not have heard — a microprocessor is, well, all those CPUs we've been talking about before.
A multiprocessor microprocessor — that means two or more cores in one microprocessor, usually two more processors.
The processors could be different — By the way, my first computer — I bought my first big computer I bought when I got hired in an early Mac — stand, desktop Mac.
And it had two different dies. If you looked down at two different dies, two different heat sinks, two different dies. And each one of them had two different cores on it.
That's pretty neat. So a multiprocessor microprocessor both means multiple dies working on some shared memory area or a single die with multiple cores.
So the second idea and the most recent idea is now is — let's forget. It's too weird and too hard.
People haven't done this in recent years to have multiple dies — multiple dies, each of them has a huge sink, very expensive. You now just have one.
Usually, you just have one die, one CPU in some sense, but it's multicore.
That one die is a single CPU, but it has — and we're going to say — I say, the word "CPU" is a little fuzzy now.
I don't want to get into that, but in the past, they would say two CPUs with two cores on each. Now they actually call one die multiple CPUs.
We'll talk about this a little later because they've fuzzed around the naming of that. CPU used to be a die. So now they have a single CPU with four cores on it.
That's what they call it, okay? And so we'll talk about logical versus physical CPUs. We'll talk about that at later lectures, but that's what we've got.
And the idea is — here I go — if I've got this last slide, we had two cores.
This means two full instruction streams — we'll have some word for that in later slides — instruction streams operated simultaneously. That's it. Pretty exciting.
Let's actually get down to more details of how that works and some more ideas of how does this work in software in the next lecture. We'll see you there.
Đăng nhập để đánh giá học liệu này.
Đăng nhập để bình luận — chưa ai bình luận về học liệu này.
Không có khóa học liên quan.