Getting MPI4py and MPI tutorial- Supercomputing and Parallel Programming in Python and MPI 1
Key Takeaways
This video tutorial covers the installation and testing of MPI4py, a Python implementation of the Message Passing Interface (MPI) for supercomputing and parallel programming, using tools such as Putty, SCP, and MPIRUN on a Raspberry Pi and other nodes.
Full Transcript
hello and welcome to the next step in supercomputing SLP parallel programming slh high performance Computing uh in the previous videos I showed you all how you could build your own extremely cheap supercomputer out of raspberry pies to do these videos you won't have to have built that same supercomputer so this is just going to be super Computing with python uh and NPI 4 Pi it just so happens I'm going to be doing it on my Raspberry Pi two node superc computer you can do it on anything you actually don't even need more than one node you can kind of do it pseudo with one node but just reference it multiple times um so yeah so anybody can go through this we won't be doing calculations uh at least at the beginning that are so large that uh there's any necessity to use a supercomputer for them so if you did follow along with the how to build a supercomputer of Raspberry Pi's tutorial series you've got an extremely simple example of MPI and supercomputing at work but chances are you're feeling rather fuzzy since we really just did some setting up some installing of things uh and you're probably longing for a better understanding of what's going on if you didn't follow the previous series basically all we did was we just used raspberry pies uh and used a simple message passing interface uh script that calculated Pi but we didn't do any of the program in in there uh so it's a lot more enjoyable if you do it yourself so in order to continue along we're going to require a programming language to do it ourselves most often you're going to see people use like C++ or Fortran being used for super Computing and I'm going to mix it up a bit I I personally enjoy python so that's what we're going to be using for it Python's also very Noob friendly it's what you call an upper level language um so you don't really need to know too much about inner work works and also uh the terminology syntax and all of that it's just so simple to use C is not and Fortran is really limited to uh numbers basically um definitely limited compared to what you can do with python so python it is so next up we're going to need to decide on what NPI implementation that with python that we want to use so for that we're going to use NPI for pi so what we're going to do is we're going to go ahead and install and test NPI for pi in this video uh it's going to be eerily similar to the installation of npic and testing npic so if you did do that uh you will still want to follow along because basically what we're doing now is instead of using npic and for Tran all that we're going to be using uh python so uh let's go ahead and get started so if you're if you have a Raspberry Pi you've got python already installed there might there's some Linux in instances you're not going to have python pre-installed I'm assuming everyone here has python 27 pre-installed on the raspber berry pie uh I'm also going to be opening up everything in putty but then I'll also probably just use SCP to move files over um as I edit them so I'm going to edit them instead of using the editor in um you know in Nano let's say instead of using that I'm going to use the editor on my main computer so we get uh colored text and all of that you can do it however you want if you want to edit it straight into your Pi uh that is fine too so I'm going to open up my uh putty instances here extra putty and for me uh my one my my main node is this your main node address might be different but whatever your uh local address is if you don't know what your local address is you'll have to um I have config it but um I know what mine is you could also have yours hooked up to a monitor or something but I'm going to use putty um so I'm going to go in now I'm going to log in all right I'm in on my master node now I'm going to log in on my uh worker and again 192 1680 and this one was [Music] 21 okay so now I'm logged in on both of them and so now what we're going to want to do is we're going to want to uh install the uh MPI for pi on here um and we need to install it on both of the machines so and every node that's going to run NPI for pi it obviously has to be installed there so the first thing that we're going to want to grab is we're going to want to do pseudo app get install python MPI 4 Pi run that and I'm going to do the same thing over here AP get install python np4 pi and so we'll be installing these do want to do that yes and yes and so we'll wait for all this uh to install this one's pretty quick you won't have to wait for how long uh doing the whole NPI on the other if anybody came from the other tutorials where we were doing it it took a really long time and basically after we're done with this we're going to want to we're still kind of following uh this would be like the last part where we kind of follow the same structure as that uh University of Southampton paper went through uh so the next thing that we are going to do though is we're going to CD um we're just going to put this in home slpy and we're just going to make a directory there um for NPI for pi that's interesting this one finished before the other one it started first anyway so we are already in that directory but just to make sure yes uh so then we're going to do makeer MPS 4 Pi enter and now we want to CD into NPI 4p and now what we want to do is do uh get HTTP colon slmi 4. gooogle code.com filmi 4 pi- 1.3 tar.gz and in fact I'm going to copy this for myself you son of a let's see oh my goodness anyway there we go all right so we'll get that I'll do the same thing here uh cool so now we have it now the next thing we want to do is tar xfz MPI 4 Pi Dash uhoh oh I downloaded I make the directory whoops well I'll just delete that later we'll do makor MPI 4 Pi CD MPI 4 Pi uh now we want to do the W get there done and now we want to run tar xfz MPI 4i- 1.3 tar.gz and then we want to do the same thing here I we didn't do it I don't think no so we want to do tar xfz MPI 4 pi- 1.3 tar.gz same thing again this Pi is like significantly faster than the other one okay so now back on to the master node LS there is our MPI 4- or MPI you get what I'm trying to say MPI 4 pi- 1.3 so let's LS MPI 4i- 1.3 and in here you should see that there's a demo so we need to CD um CD MPI 4 Pi 1.3 LS CD into demo and in here you should see LS this where is you hello.py that's just a very simple script that we're going to run to just make sure it works uh but don't worry I know like I said this feels like the same thing we just did before we just want to test the installation uh and then from there we'll actually uh start writing our own scripts and explaining why this works and all that so to run this what we're going to do is we're going to use mpir run. openmpi and then number uh I think it's number of processors uh we're going to say two and then this is machine file and now you're going to specify the path to the machine file now if you followed us before we already made a machine file and our machine file is located in slome SLP SL mpor testing SL machine file then we're going to use Python to run hello world. hit enter and here we have hello world I'm process Z of two on Master 001 hello world I am process of two on node 002 so uh if you didn't have if you never made your machine file I'm just going to show you what a machine file looks like it's quite simple uh so that was where ours is located so hold on here let me go back here and I'm going to [Music] CD son Beach okay I don't know why it's not letting me do that anyway uh NPI testing slash actually let's just and name machine file so this is the machine file basically the machine file is just a file uh with listed out local IP addresses so you know the M Master node is you know2 the worker node is21 and so on that's all the machine file is just a list of uh IPS so if you don't oh man so if you don't have one uh what you're going to want to do is just make one real quick you can put put it wherever you want uh it might be useful to put it in the same path just in case down the road you're kind of confused on a path or something but for the most part uh what we're going to be doing now is scripting so you know what you put in this line will be the same pretty much every time you're just using the same line to run the script right at the end right uh this is the script here so you might as well just copy and paste whatever line you use so uh as long as you've got it spitting out that information then you've got it going right so if you have any questions or comments leave them Below in the next video what we're going to be doing now is learning how to use MPI for pi so we're going to start scripting our own Python scripts uh basically to do what this one just did here and so we're going to uh start like that and then we'll continue getting into it so um if you're new to you know supercomputing and all of that you know the MPI is just message passing passing interface that's literally all we want to do here is just pass messages uh so it turns out that it's actually pretty easy to do that with NPI for pi um and from there you can do a whole lot of really cool stuff so hopefully that sounds interesting to you guys as always thanks for watching thanks for all the support and the subscriptions and until next time
Original Description
Supercomputer Playlist: http://www.youtube.com/watch?v=13x90STvKnQ&list=PLQVvvaa0QuDf9IW-fe6No8SCw-aVnCfRi&feature=share
In this video, we download and testing MPI4Py, which is an implementation of MPI (Message Passing Interface) for use with Python. Once we're certain that the installation works, the fun can begin.
download link: $ wget http://mpi4py.googlecode.com/files/mpi4py-1.3.tar.gz
http://seaofbtc.com
http://sentdex.com
http://hkinsley.com
https://twitter.com/sentdex
Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from sentdex · sentdex · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
Python Encryption Tutorial with PyCrypto
sentdex
Python's Logging Function
sentdex
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
wxPython Programming Tutorial 4: Panels
sentdex
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
wxPython Programming Tutorial 8: Custom Button Images
sentdex
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
Basic PHP Tutorial 12: Associative Array
sentdex
Basic PHP Tutorial 14: Foreach loop
sentdex
Basic PHP Tutorial 16: Include and Require
sentdex
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
Basic PHP Tutorial 4: Variables and Comments
sentdex
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
Basic PHP Tutorial 1: Intro to PHP
sentdex
Basic PHP Tutorial 3: HTML with PHP
sentdex
Basic PHP Tutorial 9: While Loop
sentdex
Basic PHP Tutorial 10: Switch Statement
sentdex
Basic PHP Tutorial 2: Print and Echo
sentdex
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
Basic PHP Tutorial 19: Finding words in strings
sentdex
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
Basic PHP Programming Tutorial 24: String similarity
sentdex
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
sentdex
Sikuli Tutorial 3: Program visually in python!
sentdex
3D Bar Charts in Python and Matplotlib
sentdex
3D Plane wire frame Graph Chart in Python
sentdex
Raspberry Pi Part 1 Introduction
sentdex
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
Raspberry Pi Part 11: Remote Desktop
sentdex
Twitter Analysis: How to rank a user's influence
sentdex
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex
More on: Tool Use & Function Calling
View skill →
🎓
Tutor Explanation
DeepCamp AI