We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

1.1 Introducing the Rappture Toolkit

00:00

Formale Metadaten

Titel
1.1 Introducing the Rappture Toolkit
Serientitel
Teil
1.1
Anzahl der Teile
12
Autor
Lizenz
CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
00:09 Introducing the Rappture Toolkit 00:15 Take a trip back to 1985... 01:35 Now back to the present... 04:22 Introducing: The Rappture Toolkit 05:26 Used to deploy hundreds of tools 06:05 Three parts 08:47 Rappture Builder 10:14 Demo: Hello, World! 32:21 Assignment #1: Build a simple Addition tool
OISCDatenflussMetropolitan area networkPolareMehrwertnetzLokales MinimumAbstrakter SyntaxbaumMagnetbandlaufwerkDisk-ArrayOffene MengeStandardabweichungAppletGammafunktionInklusion <Mathematik>RFIDMAPWort <Informatik>Demo <Programm>Wechselseitige InformationEinfacher RingZeiger <Informatik>BinärdatenLoopPersönliche IdentifikationsnummerMenütechnikAdditionSpezialrechnerEmulationLogarithmusGravitationsgesetzGroße VereinheitlichungZoomSpeicherbereichsnetzwerkFächer <Mathematik>E-MailSimulationAutonomes SystemTypentheorieStrömungswiderstandGanze ZahlDeskriptive StatistikProgrammBootenFunktion <Mathematik>CASE <Informatik>ZahlenbereichFontRechenschieberBrowserUngleichungGamecontrollerGarbentheoriePhysikalisches SystemInterface <Schaltung>Rechter WinkelPlug inResultanteFehlermeldungDateiformatVerzeichnisdienstMultiplikationsoperatorElektronische PublikationProgrammierspracheEin-AusgabeZeichenketteMathematikSchlussregelWeb SiteObjekt <Kategorie>SoftwaretestBildgebendes VerfahrenEnergiedichteWeb-SeiteBoolesche AlgebraHilfesystemMaterialisation <Physik>KurvenanpassungProzess <Informatik>Demoszene <Programmierung>PunktLaufzeitfehlerDefaultTouchscreenPlotterMAPProgrammbibliothekSpieltheorieMereologieStatistikProgrammfehlerDifferenteFunktionalCodeLineare RegressionProjektive EbeneInformationCheat <Computerspiel>TropfenGrenzschichtablösungVariableGraphSystemaufrufHochdruckGeradeFlächeninhaltVersionsverwaltungPhysikalismusVirtuelle MaschineFormale SpracheBenutzerfreundlichkeitSchnittmengeNatürliche ZahlVerschlingungDruckverlaufTermBitBefehl <Informatik>Arithmetisches MittelSoftwareMultigraphArithmetische FolgeRuhmasseKugelkappeMessage-PassingSummierbarkeitKategorie <Mathematik>GraphfärbungCompilerResonatorQuick-SortOktave <Mathematik>Baum <Mathematik>Kartesische KoordinatenSkeleton <Programmierung>MaßerweiterungUmsetzung <Informatik>StörungstheorieDatenfeldLesezeichen <Internet>Weg <Topologie>WasserdampftafelEinsTwitter <Softwareplattform>FreewareNP-hartes ProblemInternetworkingKlon <Mathematik>Jensen-MaßKonfiguration <Informatik>Generator <Informatik>PunktgitterOrdnung <Mathematik>SkriptspracheStrömungsrichtungWellenpaketMetropolitan area networkÜbersetzer <Informatik>QuaderGroße VereinheitlichungBruchrechnungRechenwerkMagnetbandAppletFortsetzung <Mathematik>QuantenmechanikOpen SourceGraphische BenutzeroberflächeComputerspielGüte der AnpassungReelle ZahlMathematische LogikDelisches ProblemWort <Informatik>AuszeichnungsspracheEinschließungssatzQuantisierung <Physik>AnalysisWikiGebäude <Mathematik>Mailing-ListeMaschinenspracheStandardabweichungShape <Informatik>Rhombus <Mathematik>ZweiStochastische MatrixApp <Programm>Data MiningVererbungshierarchieExistenzaussageWindkanalPolynomialzeitalgorithmusPhysikalischer EffektMehrrechnersystemObjektorientierte ProgrammierspracheEigentliche AbbildungOffene MengeAlgebraischer ZahlkörperDemo <Programm>FehlererkennungComputeranimationProgramm/Quellcode
Transkript: Englisch(automatisch erzeugt)
Alright, in this first section, we're going to take a look at this Rapture toolkit, and to help you understand why, why we're bothering, let me take you on a little trip back through
time. The year is 1985, Back to the Future was just out in the box office, Don Henley was singing the Boys of Summer, and the Super Bowl was going on, it was the 49ers vs. Miami back in the day. I'm sure you all remember, right?
How many of you were born then? Alright, hooray! So Tetris was really big, this is what video games looked like back in the day, little bit of a history lesson. And, I was working on a program at Purdue at the time, which was called SQL 2.1, Semiconductor
Electrostatics with Quantum Analysis, that was my program, and it was written in Fortran, Fortran 77, it was supposed to simulate a resonant tunneling diode, which is actually what it is a sandwich of material layers, really really thin nanometer size material
layers, and it turns out if you make a sandwich of different materials like that and apply a bias to it, it does really funny things because there's quantum physics involved. If you get the quantum physics right, you get some interesting characteristics out of this thing. So here's this program that I had, it was written in Fortran 77, look at all the
ASCII art, nicely formatted output, I spent a lot of time doing that, again back in the day that was what we call graphics. And, these are the guys in the machine room, not really, but pretty close back in the day, and it turns out if you wanted to get a copy of that program, you could write to
my advisor, you could send him a letter along with like a $10 bill, and he would send you a magnetic tape, probably bled off by those guys, that had the software on it. So when I graduated, that's what happened, they gave me a cap and gown and said congratulations, and we set up this agreement that anybody that wanted the software could send in a $10 bill and get a tape.
That was back in the day, right? So nowadays, the same program is available on NanoHub, and this is what it looks like. Same thing, the only thing that we did was we put a graphical user interface on top of it, so it runs the same engine, the same code, but instead of looking like that, it's like this. And instead of a $10 bill, you just log on to NanoHub and push the button, and it comes
up and starts running. And it's pretty easy to use, you just fill in the number fields and then click simulate and boom, you've got a resonant tunneling diode at your fingertips. So it turns out, back in the day, nobody ever did this. I graduated thinking that I was going to make a million dollars, that would be the next Bill Gates, because everybody wants my resonant tunneling diode program, and
all I'd have to do is sell 100,000 copies, and I'd be rich. But nobody did this, because nobody wanted to go through the bother of $10 and the magnetic tape. But on the other hand, this now on NanoHub has thousands of users. People are using the code because it's free and it's easy and it's available.
So that's the point for all of you. You guys can do the same thing. You can take your code or your advisor's code, you can put a graphical interface online, put it out on NanoHub, and thousands of people will find it and use it. In fact, if you look at the stats, you can see that. NanoHub does a really great job of tracking stats, statistics, like how many people
have accessed this, how many questions are out there, how many citations and academic literature. I hardly ever got citations when I was doing this, but now it's actually starting to get some citations, because it's out there and people find it. So the bottom line, the story, the moral of this story, I guess, is the magnetic
tape was $10 and the live simulation tool is priceless, like the MasterCard commercial. So that's what we're trying to do here. For the next three days, I want to show you guys how to do this, how to take your advisor's stinky MATLAB code and make it look fantastically beautiful and live on
NanoHub. Don't tell them I said it was stinky. So here's what it is. The Rapture toolkit takes that code and moves it into a graphical interface, sits in between the two, and basically manages all of the inputs and the outputs to your program. Rapture stands for the Rapid Application Infrastructure.
Came out a long time ago in 2005, and we've been sort of working on it a little at a time ever since. It's available as open source on rapture.org. You have to spell it with the two P's. It's kind of an internet thing. So the two P's makes it cool. And it basically creates standard desktop apps.
The best thing about it is that it works with your favorite programming language. So all kinds of languages. You may say, well, I don't like Fortran, I don't know Fortran. Well, that's fine. Maybe you know Java, or Ruby, or Python, or Perl, or any of those, MATLAB. So we've even added R and a few others recently. So whatever programming language you like to use, you can take that code and
you can put a Rapture interface on it. It'll work pretty much the same way. And so far we've used it to deploy hundreds of tools on NanoHub and on other hubs. So NanoHub has about 230, 40 tools right now. Almost all of them are written in Rapture, not because we require it.
You don't have to use Rapture to put tools on NanoHub. Some people use other things. But it turns out it's a whole lot easier to build the tools in Rapture than it is to roll your own interface with QT or MATLAB. A lot less work, so people like it. And it's used for other hubs, too. PharmaHub has about a dozen tools. Nice has a couple of tools. You look at all the different hubs,
there's at least a few on a lot of the hubs written in Rapture. So there are really three parts to the Rapture. And we're going to start today, this morning, with the Builder. But let me walk you through all the parts. By the time we get to Thursday, we'll get all the way here to the Tester.
So you start with the Rapture Builder. And you can kind of drag and drop controls and fill in information and push a button. And it saves the information into a file that we call tool.xml. It's an XML description. XML is the extensible markup language. It's like HTML. So it's just an information description of everything you told it when you were
dragging and dropping your interface. So we save this description. Everything we need to know about your tool is in the tool.xml. Then when you want to run the tool, when you say Rapture or Rapture-run, it will read the tool.xml that was generated by the Builder. And it will generate the interface based on the description.
So if you told Rapture, I've got a number, and I've got a Boolean control, and a curve comes out, then the Rapture runtime reads that tool description and renders the graphical interface. And when you push the button to run your tool, it'll write out a run file. The run file will have all the information about the inputs and the outputs and everything you need to know about that run.
And then finally, the last part is a tester. The tester takes the description of your tool and a bunch of test cases that you've written in the past. So you can get your tool working perfectly, and you can generate a bunch of test cases and set them aside. And then let's say your advisor comes back and says, I want you to add this,
I want you to change that, I want you to fix this, fix this bug. So then you go to publish again, you want to make sure everything's correct. At that point, you can run the tester, and the regression tester will run through all of the previous test cases you've generated and make sure everything matches up. If there's a problem all of a sudden, if you fixed a bug but actually broke something else in the process, the tester will catch that.
It'll tell you something's wrong, and then you can go back and take another look and fix it. So those are the three parts to Rapture. The builder, to build your tool. The runner, this is where, when the tool's running on NanoHub, it's mostly running in this area. And then the tester, whenever you go to put out a new version of the tool,
you can test it and then deploy it. And you know, these tools aren't once and done. I mean, you may put up a first version of your tool and add some stuff and put up a second version, 1.1, 1.2, 1.5, 1.5.7.1. You can have a lot of fun with numbers. But anyway, you put up a lot of different versions of your tool as you keep adding features, and that's typically a healthy thing to do.
But along the way, you want to test and make sure it's working. All right, so let me show you what the Rapture builder looks like. When you bring this up, which you guys will be doing in just a minute, you get a graphical kind of interface like this.
Over here, on the left here, there are a bunch of different control types. So things that you can choose from, curves and Boolean values and strings. And what you do is grab one of those and drag them over. Drag them into the input section and it becomes an input.
Drag it to the output section, it's an output. So you drag these little objects around and you build up the inputs and the outputs for your tool. Then, for each one, you highlight a particular one, like this Boolean value that's highlighted in the bluish purple color. And it'll show you all its properties, so you fill in the properties.
You change its label, its description, give it a default value. You keep doing that for all the different controls to configure them. And then you can click on that Preview tab, and the Preview tab will show you what your interface is going to look like. And you can check it, if it doesn't look right, you can go back and you can edit some more, look at it again, preview it again.
And then finally, there's a Save button up at the top. And you click on that and you can save out your tool.xml file. That's it, that's the builder. If you've done that much, you built something, hooray. So what I want to do next is kind of walk you through that, show you what it looks like in real life, not just PowerPoint.
Because you guys will be doing it in just a minute. So watch, watch and learn. This is what I'm going to build. I want a simple tool, it's like a Hello World application. So it's got two inputs. One input is who I'm going to say hello to. I can put in any name there, Fred or whatever.
Another one is a Boolean control, which is whether or not I want enthusiasm, add an exclamation point to the output. So I have two inputs coming into my tool, and then it's going to generate some output. And the output it's going to generate is just a string, the Hello World message, right? So that's my very simple tool that I'll build.
And I'm going to build it with two different languages, just to kind of show you how it works. I'll build it in Python, and I'll build it in Fortran. All right, so let me flip and bring up my web browser. I'm going to work on hub zero.
And when you're doing this work and you log into a hub, one of the tools that you'll find either on the all tools list or somewhere, maybe it's on your recent tools, one of the things you'll see is something called a workspace. A workspace is like a Linux desktop that you can access through the hub,
anytime, anywhere. And it's where we'll be doing most of our work today, inside of a workspace. So you find this workspace tool, and there's a little button right here that you can click on to launch it. If I click here on workspace, it'll just take me to the description of the workspace, which I can also click here to launch it. So either way, you can click on the big black button to launch the workspace, or
you can click on this little launch button. And what it does is, you may have to allow Java to do its thing. It launches a workspace section back on hub zero, and mine didn't go so well.
It says something about inactive plugin right here, so I'm going to try it again.
Okay, restart my browser after enabling, ah, great, hold on.
Hooray, all right, so that's the way it's supposed to work. Let me bump up my font size so you guys can see what I'm doing.
All right, so this is what it looks like when your workspace comes up. And if you have any problems with Java, you gotta maybe fuss with it, make sure Java's enabled, because if Java's disabled, you'll have all the problems I just did. So now I'm in a workspace, and I have a command line here where I can type stuff.
You can see I have a bunch of files here. These are all on the hub zero side. And I'm going to go into my boot camp 2012, into the lectures. And I'm going to make a directory called hello for hello world.
Okay, so now I'm in my directory. I can say rapture-builder, and it'll bring up the builder program. All right, so this is what you guys are going to do. You're going to rapture-builder, and you get this screen. You can browse through all the objects on the side and see what's there.
And I'm going to start by grabbing a string and dragging it over to the input and dropping it. So now I have a string there, right? And I also wanted a boolean value, and I'm going to drag that in. So now I have those two values, and I can kind of configure them. This name right here is the name we'll use inside our program.
We'll see that in a minute. Rather than call it value one, that's what rapture calls it by default, I'm going to give that a little better name. I'm going to call that name. That's the name of the person. And I'll label it on the GUI, say hello to. So that's who I'm going to say hello to. Of description, you can say this is who we say hello to.
And there's some other stuff that we'll talk about later. And I can put in a default value, like world. So by default, I've got the string control now. It's labeled say hello to, and the default value is world, right?
Hello world. Now I'm going to look at the boolean value the same way. And this one I'm going to call, in my program, I'll call it exclaim. So that's the name it'll have. I don't want to just call it boolean, I'll call it enthusiasm.
And the description is add an exclamation point. And down in the default value, I'll set it to false. So you have to ask for enthusiasm to turn it on. Now one other thing, I want to produce some output.
So I can grab a string control and drop it over here on the output side. And the output, I'll give it the name result and hello output. And this is the output generated by hello world.
All right, so now I've got an interface. I've got two inputs, the string and the boolean value. And it's going to produce a string called result as the output. So I pretty much described my interface. And I want to take a look at it so I can click on Preview.
And when I click on Preview, it tells me, uh-oh, there's a couple of things wrong. There are three warnings for the current tool definition. You want to take a look at them? Yeah, all right, let's take a look and see what I messed up. Say yes, and it'll show you up here each warning. It says, first of all, I should have a title that describes the tool. Oh yeah, I forgot completely, I didn't even look at the tool part
when I was explaining all this to you. So let's make up a title. This is, I'll call this Simple Hello World.
And then I click Next. And it gives me a description. OK, it says you should have a brief description of the tool. This usually pops up when you're first doing it. So the description is demo app for boot camp 2012. OK, and then Next. And then it says, oh, you've got to set the program type
down here. So if you click, and you notice it's highlighted, you click on that, it'll show you, these are all the different languages that Rapture supports. And depending on how I want to do the demo, I can pick any one of these. So for right now, I'm going to start off with Python. Any of you guys know Python? Seen Python before?
Yeah, all right, well, it'll make sense to a few of you, I guess. So let's see what it looks like. And there's no more warnings, so I'm all done here now. So I can click on Preview again. And now it shows me the preview. So I get a sense of, this is what the program's going to look like in a minute when I start to run it. And you can very quickly take a look and see, does everything look right?
Did I forget to label something? Did I have a good description? You notice all the descriptions that I gave will show up as tool tips. So if I mouse over, say hello to world, and then the little pop-up message is, this is who we say hello to, right? And similarly, the Boolean value, add an exclamation point.
So if I flip back, you can see again, if I want to change the message, then I can just change any of these input, or the default value, and so forth. All right, so all that looks good to me. I'm going to go ahead now and save this. So I'll click Save As, and I can
choose to save it to any file. You notice by default, it says tool.xml. That's kind of the Rapture conventions, that we always save it into a file called tool.xml. You can change it if you want to, but I'll just keep that. And I can also have it generate a program for me, a skeleton program that I'm going
to fill in with the logic for my program. And that's a good thing. It's probably a good way to get started, especially if you're just getting started with Rapture. So I'll choose this main.py, or I can give it a different name too. If I click Choose, I can change whatever name I want, main.py, or whatever. That's fine. I'll leave it alone. And then I'll say Save, and then I can quit the program.
OK, now if I look around, you notice that my builder generated two files. It generated main.py and tool.xml. Let's start quickly with the tool.xml, just curiously, to see what's in it. And you can see it's an XML file. XML has the little diamond braces and a bunch of markup
that explains all the bits and pieces. And you can pretty much see what we did in the interface here. You can see, for example, this part right here says that we're defining a string whose ID is name and AME. It has a label, say hello to. It has a description, this is who we say hello to,
and a default value of world. So pretty much everything you saw in the builder you're seeing here, except it's saved out now in this XML format. All right, so that's the XML file. Now, let's take a look at the main program. This is the main program that got generated by the Rapture builder, and it has some gobbledygook that's all,
in this case, all set up for Python. This is what you need to say in Python. In Python, you start out by importing the Rapture package. And you might want to bring in other things, too, like sys and map. Those are common libraries. And then it starts off with some stuff to open Rapture, rapture.library. And then it says io.get and io.get and all that. So this stuff, these statements are actually
reaching inside that XML and getting the value of the thing called name. And this reaches inside the XML and gets the value of the Boolean control called exclaim. So now I have these two variables, name and exclaim, that represent my two inputs. That's what I'm trying to get out of the interface.
And if I scroll down a little bit, you notice it says right here, add code here for the main body of your program. So I generate the skeleton. I've got a skeleton of a program now. I need to fill in the middle with the stuff that I want to do. And then at the very end, you can see that it's doing io.put and it's saving that result variable.
It's saving out the string called result. So what I'm going to do is I'm going to fix up the middle part here. We'll just get rid of the progress stuff. And I'm going to add in some code here, basically. So the Hello World application, the whole point of it is to build a result string. And the result string is basically Hello plus my name variable.
Hello World or Hello Fred. So that's basically it. But I added a wrinkle to make it just a little more fun, that if the exclaim is turned on, then I want to add on an exclamation point.
So when exclaim is set, we'll add an exclamation point to the set and to the end. So that's the guts of my program. And you notice I'm using all those variables that I declared in the Rapture Builder. My inputs are the variables name and exclaim. And my output is the variable result, which was automatically set up here to be saved as an output.
So those names we defined earlier are important. They become the variable names in your program. So now I can save this. And now my program is all set to go. So if I want to run it, I can just say Rapture. And Rapture, by default, if you say nothing else,
will look for the tool.xml file in the current directory, will read the tool.xml, and will generate the whole interface. You notice it's got the title that we set for the application. It says Simple Hello World App. And it says Demo App for Boot Camp 2012. So that's the description stuff that we sent on the tool page. You notice that it's got Say Hello to
and the enthusiasm control here. And I really don't have to, with the way Rapture is normally set up, everything has good default values. I don't have to mess with it. I can just click the button. All your tools should be set. Most users don't know what to do, believe it or not, when confronted with a page like this. So the best thing is if they can at least click the button and it works, then you're in good shape.
So we clicked the button. It went off and it ran my Python program. And it gave me back the result Hello World. Now let me try it again. I can try something else. I can give it a different name, like Fred, and I can turn on the enthusiasm and I can run it again. And now it generates Hello Fred with an exclamation point. And the way Rapture is built, you
can run lots of cases like this. And you can actually flip back and forth between the results. So we can try lots of different things. So now we have three different results, the original Hello World, the Hello Fred with enthusiasm, and Hello Bootcamp.
So I've got all those different results that I can browse in the Rapture interface. It's actually a lot cooler when you have graphs and stuff because then you can actually flip back and forth between the graphs instead of just messages. All right. And if I want to make changes, I can go back into the builder, rapture-builder,
and I can load up. I can open that existing tool.xml file and everything's right back where I left it. So I can make changes to name and exclaim and all of that. So maybe I want the default value to be true for the exclaim. I can do that and I can save it. Now when I go to save it again,
I may just want to change the tool.xml file. If I regenerate the skeleton program at this point, it'll actually overwrite the changes that I made. So if I regenerate main.py, it'll basically wipe out the body that I had stuck in there and that's no good. So if you do regenerate the skeleton program, you want to probably regenerate it in a different file.
Otherwise, you're going to wipe out the work you did. But in this case, I'm not going to do that. I'm not going to generate the skeleton. I'll just change the tool.xml and I'll save it. And then now if I run rapture again, you notice now enthusiasm is on by default because that's what I did. I changed it. So you can kind of go back and forth with the builder,
make changes, test it. And when you get to a point like I am now where everything is working properly, then your tool is ready to go on nanoHUB. You can actually deploy it and put it out and other people can use it. All right, so that was my demo,
taking the two inputs and producing a string output. Oh, I showed it to you in Python. I got to show it to you in Fortran too, right? Yeah, how many people use Fortran? How many people's grandfathers have used Fortran?
A few? Nobody? Come on. I know your grandfathers used Fortran. Let me go back into the rapture builder. And I'll leave everything just as it was. Oh yeah, I got to open my file again. So everything is just as it was, except now I'm going to go into the tool section and I'm going to change the language to Fortran.
Click on it. So now it's Fortran 77 and I'm going to save it. And I'm going to save the tool.xml. I'm going to have it generate a main program for Fortran, main.f. And I'm also going to generate something called a makefile. When you have Fortran, Fortran is an old man's language.
You have to compile it down to machine code so that you can run it, right? And when you want to compile it, there's a certain thing called a makefile that makes it easy to compile. And in fact, rapture makes it even easier because it generates the makefile for you. So if you just click on that button, I'll get a makefile where I can use to build Fortran. So I'm going to build all three. I'm going to get the tool definition, the skeleton
program, and the makefile and click Save. Now if I take a look, you can see there's a makefile there. Oops, right there. The makefile shows these are the rules that I would use to build rapture and to build my program main.f. So it's showing all of that.
And I also have the program main.f that I need to fix up too. And again, this is the skeleton that rapture generates. Gets you most of the way there. It does the Fortran way of managing rapture. It defines some stuff that rapture needs. And so variables at the top. And it does some stuff to kind of open up.
You notice it's doing roughly the same thing. It's still trying to get the variable called name. And it's producing something called name. And it's still trying to get the Boolean value for exclaim. And it's setting that variable to exclaim as well. Has to do a little bit more stuff. There's still a middle part in here where you need to add your code. And then there's a part at the end where it's saving the string result.
And so pretty much the same as Python. Just a little different language in terms of how it works. Again, the recipe is I'm going to get rid of the stuff in the middle. And I'm going to put in my own stuff in here. So I'm going to add if statement, if exclaim.
Then result is hello concatenated with the name. Concatenated with the exclamation point. Otherwise, just take hello
and concatenate it with the name. So that's it. I just added in that little bit of code to kind of produce the string that I want, result.
And now I have to compile it. So I type make. And what make does, oops. Just gives me a couple of warnings for unused variables. Ah, I'll clean them up. I don't like having warnings there. So back into my program,
I've got the variable okay and RPE units convert double that weren't really being used. Okay, when you say make, it invokes the compiler rule with all the right libraries to build everything and link it all together. And at the end of that now, I have an executable program. The executable program that we call main F77.
And if I look, sure enough, there's a program there, main F77. So that's the actual executable that Rapture's gonna run when you're doing your simulation. And I'll type Rapture. And it looks like the same program. It's the same interface, world and exclaim and enthusiasm and all that.
When I click simulate, it goes off and it runs the Fortran version now. And it builds that result. Probably wouldn't believe me unless I proved it to you. But we can take main.F and change it to instead of hello,
I'll just make it F77. And then I'll remake. Whenever you change your program in Fortran, you always have to rebuild, remake it and then run Rapture. See, it says F77 world, which makes no sense.
But at least you know, it's the Fortran program that it's running now under the hood. So that's how it works. And again, the tool.xml is something that you figure out once and it doesn't matter what language you're using. In the builder, you can choose whatever language you want. And then you build a skeleton program and then you go from there to kind of connect it up to the guts of whatever you're trying to do.
We have some programs on nano hub that aren't even one thing. It'll be Rapture calls the Python program. The Python program execs the Fortran program and Matlab and half a dozen other things, takes all the results, puts them together and produces the final result. So you can build really complicated systems if you want to with all of this, but it all works pretty much that way.
All right, so now that was my demo. Build a simple interface and show you two different programs, Python and Fortran. So now I want you guys to try it. I want you to get into a workspace. Now you should be, everybody authorized for workspace?
All right. So you should be good to go being able to get into nano hub or hub zero into a workspace. And what I want you to do is build a program, whatever your favorite language is, whether it's Python or C or Fortran, whatever you feel comfortable with, Perl, Tcl, I don't care. But pick a language that you're comfortable with
and I want you to build a program that has two integers coming in and you can sum them and produce an integer result. So for example, you could have two plus two and you get the answer four, right? Because two plus two is four. So your program when you're running it should look like this. Should have two integers on the input side
and when you click the button, you're gonna get a number result, an integer result on the output side. Don't be surprised when Rapture shows you an integer value, it'll show it to you like this on a graph, which is kind of weird. You might think it would just print out the value like four, but it's actually more useful to see it on a graph
because again, you can simulate again and again and again, you can stack up a bunch of results and you can see them all on the same plot. So it's kind of more useful to have it on a plot, but this is what the final program will look like. It's two integers on this side and an integer on this side, which shows up as a plot when you're running it. So if you do everything correctly, that's what you'll see.
Now, when you're getting into workspaces, how many of you guys have used Linux before? You like Linux gurus? Good, for those of you who have never seen Linux before or a command line prompt, don't worry, we'll help you out. Derek here has got some sheets that he's gonna pass around, the workspace reference.
And let me also show you, we have all the materials for this on the website too. If you can't remember anything else and you're trying to figure out, where do I go for documentation? If you can just remember Rapture with two P's, rapture.org with two P's,
it will take you to the Rapture website with all the documentation. And if you search on there for bootcamp, you have to spell it right, you'll find, see bootcamp 2012, right?
That's us, bootcamp 2012. And on this page on rapture.org and on bootcamp 2012, you'll see the outline and you'll see all the materials and you'll also see this workspace reference that Derek has here, he's passing out. So the workspace reference will kind of help you
get started, logging into a workspace, how you launch it and all of that. And it gives you kind of a cheat sheet of various things that you wanna do. What I'm gonna suggest for each lab assignment, start with a fresh directory. So for this first lab assignment, use the mkdir command, M-K-D-I-R, right?
mkdir assignment one, whatever, lab one, whatever you wanna call it. Make yourself a fresh directory. And then you can use the cd command, change directory. So you mkdir lab one and then cd into lab one and then launch the builder and go from there. Each lab assignment,
you're gonna wanna have a separate directory. Otherwise, when you start the next lab assignment, it's gonna overwrite the tool.xml from the first lab assignment and everything's gonna get all balled up, right? So go ahead and log into a workspace the way it shows on the left-hand side here. And from there, use some of these commands like mkdir and cd. Make yourself a lab one directory,
change into that directory, and then you can go ahead and launch the rapture builder. And if you're like, dang it, I wish I was listening when he was telling me all that stuff about the builder, if you're thinking that, don't panic because you can just go back onto bootcamp and you can find right there all the slides that we just looked at, right? So remember rapture.org, rapturewith2ps.org.
Go onto that, search for bootcamp 2012 and on the bootcamp 2012, by the way, there's earlier bootcamps 2011, 29. Don't get confused because the older labs or the older bootcamps are not so good. They're not so up to date. So look for bootcamp 2012, the fresh stuff.
And there's all the slides for introducing rapture right there. So you can pull up the PDF and use that as your cheat sheet and also the sheet that Derek passed around. And if you have any questions, we're gonna spend like the next half an hour working our way through the lab assignment.
I'll put it back up on the screen here. And if you have any questions, I want you to work through it and call people over. We got George here, we got Ben, we got Derek, and I'll be walking around too. We're all happy to help you guys with questions. So give it a try and see what you can come up with. All right, let me show you what my solution is
for this particular lab assignment. So you remember, we're trying to build this program that takes two integer values and produces an integer result. And it's real important that we use integers so that rapture can kind of enforce the interface. So here I am over on my workspace on hub zero,
I'll go into bootcamp 2012. I have all these directories that I use like file folders to keep everything separate. So you can see I got a lot of stuff here on hubzero.org. I'm working on a lot of different projects. And the easiest way to keep things straight is to make directories.
So I've got this directory and you notice I'm such a lazy typer. I can just type B O and hit tab and it'll type everything else for me. Hey, that's pretty handy. So it types as much as it can and then it waits for me to finish the rest. Was it 2009, 2011, 2012? So I can go into bootcamp 2012 and look around
and I've got these three assignments, lectures and solutions folders. So I'll go into solutions and again, I type S O tab and it fills in the rest for me. And I can look around and then I can go into exercise one. If I wanted to, I could make a new directory.
I've got three solutions here, one for C language, one for Fortran and one for Python. But let's say I'll just make a new solution directory, new. So I say make dir new and now I can CD to new. And now I have a nice fresh clean directory where I can keep all my stuff. Cause you remember when you run the builder,
it's going to generate a tool.xml and a make file and a main program and all that stuff. And you don't want that to get lost with everything else you're doing. So make yourself a clean directory. Then I run rapture-builder to bring up the builder. And out of all these different controls, I try to pick the most specific one.
You know, you could grab, for example, a string over here and use a string as an input value. But that means that anybody could type in whatever string they want. They don't have to use integers. They could type in XYZ or hello world. And when you get into MATLAB or C and you're trying to add hello to world as numbers, it's not going to work, right? You're going to get trouble.
So forget about the string, cause that'll mess you up. When you got a control you don't want, there's a little delete button here over to the side. I can click delete and that goes away. So instead I'm going to grab an integer and I'll put that over here. You notice there's also a number in rapture. The number in rapture lets you have fractional values.
So if you wanted to have a number like 2.17 or 3.14159, you can use a number for that. Number also has physical systems of units and we'll be learning more about it as we go along. So you have to ask yourself in this case, am I supposed to use, can I allow number values with fractional values, double values with units
or is it an integer? The assignment here was integer. So I'm going to stick with integers but there's a subtle difference. If you're trying to have a number of grid points, for example, you can't have 2.7 grid points, right? That has to be an integer, like 100 grid points or 1,000 grid points. You can't have fractional values.
So think about the controls as you're dragging them over. Make sure you got the right ones. Again, I could always produce string output but I don't want a string output. I want an integer output so I can plot it. So I've got two integers coming in and I'm going to rename the first one N1 and I'll prompt the user by saying add this
and give it a default value. You should always give a default value. In fact, if I don't, when I go to save this or do something, preview it, Rapture is going to yell at me and tell me there's errors and warnings I have to fix up. So I'm going to give it a default value, whatever you think makes sense. I'll say zero. And then the other one, I'm going to rename it to N2.
That'll give it a nice variable name in my program N2 and I'll label it to this and I'll give it also a default value of zero. And then finally on the output side, I'm going to rename that to sum and this is, I'll call it sum,
sum of the two inputs. All right. So now I can try to preview and see what I'm going to get. Uh oh, five warnings for the current tool definition. Do I want to take a look? Yeah, I might as well take a look. Again, it's telling me I should have a title.
I'll call it lab, oops, number one, number one. All right. And then next, and it'll tell me a description, solution or lab number one. And next, and it'll tell me I need to choose my program.
Okay. So a lot of you guys, I noticed we're using MATLAB. That's good because it's easy and you may know it already. I'm going to choose, you could choose MATLAB. I'm going to choose Octave and I'll tell you why. It's the same as MATLAB, like 99% the same. It's the same language, the same everything.
It doesn't quite have as fancy a GUI but it also doesn't take as long for the whole program to start up. When MATLAB starts up, man, it takes a long time for that GUI to come up and that's nice when you're sitting there working with it interactively but it's not so nice when you have a program that you're trying to run and debug as some of you found out. So you may not be able to tell the difference between Octave and MATLAB as far as Rapture is concerned
because it's running your script under the hood and it's just the same programming language, basically. Plus if you like free software, go GNU free software. Then you might as well use Octave and support them. So anyway, and because it's not licensed software, you'll actually find it on a lot more places. When we deal with MATLAB, we have to be careful.
We have to make sure Purdue people are using MATLAB and nanoHUB and all this stuff which is why we ran into the permission problems with some of you guys which we sort of worked around for now but there's a better fix. So with MATLAB, there's all these headaches that deal with commercial software and all of that. All the other hubs, you'll find Octave. It's a standard thing.
It's in Linux. It's on all the other hubs. So when you run into a roadblock with MATLAB, just switch to Octave because chances are you won't notice the difference. The syntax is all pretty much the same unless you're using the toolboxes and stuff. All right, let me keep working through my, get down off my soapbox and keep working through my notes. It's asking me for a description and another description
and that's pretty much it. So I didn't bother with those two descriptions. If I try to preview now, it still says there are two warnings but I'll just say don't look at those problems. Go on ahead. So if the warnings are benign or you don't want to fix them or whatever, Rapture will keep nagging you about it but don't worry, just move on.
So now I've got an interface where there are two integers coming in, default value zero and it'll produce an output integer which is the sum. So I can save all this. So I'm gonna go ahead and save it and still nagging me about all those warnings.
I really should fix them. I'm gonna choose a tool definition file in this directory, tool.xml and I'll have it generate the skeleton program and there's no need for a makefile with Octave. So I'll just have it generate that, save it and quit now. So now you can see my two files there.
My tool.xml has all the XML code in it with the integers and all that and this is my main program generated by the Rapture Builder and you can see that it's basically pulling out the variable n1 here and the variable n2 and then at the very bottom of the program, it's saving out the variable sum right here,
converting it to a number and then a number to a string basically and then saving it back out. So my job is to fix up where it says add your code here. That's your marker, that's where your code goes. If your program runs for a long time, you can put out all these progress messages. You can say my program's starting,
don't give up on me, don't give up on me, 10% done, hang on, hang on, 20% done. So if your program takes a long time to run, it's a good idea to put out these progress messages so the user isn't like, why is it hung up? So you can say what's happening in your program. In this case, the program runs so quickly, it's not even worth putting out the progress messages so I'll get rid of them.
And what I say instead is sum equals n1 plus n2. So that's what I wanted to do basically. You know, two plus two is four and then write out the sum. So that's the whole body of this particular program. You notice, this all looks like MATLAB syntax, right? I mean, if you know MATLAB, this is basically the same stuff.
All the stuff you can do in MATLAB, you can do here in Octave. It's a clone of MATLAB. All right, so I save that out and now I can run Rapture and it'll prompt me now, oops, for the two values. So I can plug in two plus two and simulate. Oh, and it's giving me a hard time.
It's given me a hard time. Sometimes it gives you a hard time because you haven't got the right use thing. So if I say, you have to make sure, what, yeah, but I do. So you have to make sure that you're using the right program, right?
A lot of you guys ran into this because you got right to where I did and it was like, dang it, it doesn't work. And in the next section, I'm gonna show you how it all works under the hood and how to debug all of that. But one of the first things that you can run into is the fact that Octave may not be working. So you gotta make sure you've got the use thing set up. If it is set up, you should see a star there.
So I've got Octave set up and if there's any doubt, you can say use again and make it persistent. Let me see, beyond that, I must have some kind of syntax error in what I did. On Octave?
So you say, you say just int? What are you saying? Into a double, right?
Try Derek's solution. We'll see if Derek got it. Two plus two, four, hooray! So int32 used to work in older versions of Octave in order to convert to an integer.
So the skeleton must be generating something a little funny or something. Yeah, check on that. And we'll talk a little bit more about debugging in the next section. I didn't want to get too far into the debugging stuff because we're gonna do that to death in the next section. Let me show you quickly one more solution because some of you guys did C language. So again, I can do rapture-builder
and I can open my tool.xml and again, preview it. Same interface, but this time under the tool section, I'm gonna choose something else. I'm gonna choose C language as my target language.
And when I go to save it, I've got a tool.xml and I can have it generate a skeleton program and a makefile. Make sure you do the makefile. I saw some people generating the skeleton program but just trying to compile it by hand. It's too hard to compile it by hand because you gotta get all the right libraries and the include files and everything.
So when you're dealing with something where there's an option to generate a makefile, make sure you generate the makefile. That's very handy. So again, I'm gonna save this now and I can get in and edit my program. So here's the program that it generated for me in C. And again, you can see it grabbing the value for N1
and the value for N2 and producing the sum. So again, I'm gonna say sum equals N1 plus N2. That's basically the body of my program in C language and I'll save that out.
And now that's not enough. I have to actually make it. I generated this nice makefile that explains how to build my program and now that I've got it, I can just say make. It's giving me a warning about an unused variable. I can go in and clean that up.
Line 18, I think it said error. So it didn't like that. That wasn't used. So I can say make. Now it builds cleanly and you notice there's all the libraries and everything. At the end of that, there's a program there. The program it builds is called main C and so we're ready to run. Now I can run rapture
and give it a value like three and five and simulate and it gives me the sum eight. You notice if I give it different values like three and seven, then it'll give me 10 and if I give it three and 12, it'll give me 15.
And I can go back through all of the different values and I can also click on the all button to kind of plot them all at once. So when you simulate a bunch of cases in rapture, you can actually get a bunch of plots. This feature is actually more handy not when you're dealing with something like two plus two equals four but imagine that you're simulating something
as a function of temperature and you want to try a bunch of different temperatures and at each temperature, you get a number and then by trying a bunch of temperatures, you can plot them all. You can actually sort of build a curve of how it varies versus temperature or how it varies versus pressure, all the different things that you can change. So this is kind of a handy feature, this plotting thing
and that's the reason it's set up that way. You notice also because I used an integer value here, if I try to type in X, Y, Z, it gives me an error. So rapture does all this built-in error checking. If you try to type something funny, then it's gonna give you an error. Even if I try to type 2.2, one, four, seven,
two, four, whatever, it gives me a problem with it. So if you, and the integer control also has little buttons built in, so you can just click the buttons to change the value, which is another little feature. So if you use the right control, for the type that you're trying to deal with,
it'll give you a better version. It'll do all the error checking properly. It'll give you built-in things like the little buttons. So you should always be the most specific you can with all the rapture controls and what you're intending to do. So that's it for this talk.