New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Opal Bernhard


Opal Bernhard
GPA 3.72

Michael Kupferschmid

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Michael Kupferschmid
Class Notes
25 ?




Popular in Course

Popular in Engineering and Tech

This 27 page Class Notes was uploaded by Opal Bernhard on Monday October 19, 2015. The Class Notes belongs to ENGR 4962 at Rensselaer Polytechnic Institute taught by Michael Kupferschmid in Fall. Since its upload, it has received 75 views. For similar materials see /class/224816/engr-4962-rensselaer-polytechnic-institute in Engineering and Tech at Rensselaer Polytechnic Institute.

Similar to ENGR 4962 at RPI

Popular in Engineering and Tech




Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/19/15
ENGR74962 Eortran Programming Spring 2012 Course Organization revised 03 Nov ll Instructor Michael Kupferschmid PhD PE adjunct faculty office Amos Eaton 404 class days before or after class phone 27971606 at home any day but no later than 8PM please email kupfem3rpiedu read only class days after class files in httpswwwrpieduAEShome51kupfem3EP Textbook Classical Eortran Second Edition Description This course provides a practical introduction to computer programming in classical Eortran emphasizing selected language features useful for numerical calculations It is intended mainly for graduate students in engineering and science who need to use Eortran in research projects and other courses Learning Outcomes At the end of the course you should be able to write and run Classical Eortran programs of modest complexity Classes Each class will analyze in depth one or more example programs and present a brief summary of the week s reading READING THE TEXT IS AN ESSENTIAL PART OF TAKING THIS COURSE Please read each chapter before the class in which it is discussed A large part of each class will consist of student questions and answers so you should come prepared to actively participate Grading Your grade will be based on my appraisal of your Eortran programming for the project Your attendance and participation in class and your adherence to the deadlines for project approval and progress reporting will affect my decision about close calls between letter grades in the course Projects The project can be for thesis research or another course or just for this course Each student must submit an individual Project Agreement form BY CLASS 5 Each student must give me a progress report explaining what he or she has done so far BY CLASS 9 Two or more students may work on a single project together if desired but each team member must take responsibility for a different part of the program You may consult with other students or with people from outside the class but not collaborate with them take nothing away in writing or in files You may search the web for information relevant to your project I will too but copying a program you find there does not meet the requirements for this course You may use language features or a programming style different from those I teach but if so you should be prepared to tell me how they work The purpose of the project is to convince me and yourself that you have learned how to program in Eortran so each student must personally invent the code described on his or her Project Agreement Computing Environment The language covered in this course is platformiindependent and should work on any machine with a Eortran compiler You may do the computing for your project anywhere you like but you must explain your plans on the Project Agreement form This course is about the Eortran language not a particular program development environment It will include basic information about the Linux g77 and gfortran compilers but will not discuss other compilers noniUnix operating systems or text editors ENGR74962 Eortran Programming Spring 2012 Course Schedule revised 05 Apr 12 Classes meet Wednesdays 140071520 in CII 3045 A fire alarm pullboX is in the hallway In the event of a medical emergency call Public Safety at 27676611 READING THE BOOK IS AN ESSENTIAL PART OF TAKING THIS COURSE Please read each chapter before the class in which it is discussed If possible review the material with other students in the course and help each other understand what you have read Homework will not be graded but I will post solutions to the listed exercises date class topic read try 25 Jan 1 introduction 01 10513 01 Feb 2 expressions and assignment statements 2 20910 08 Feb 3 conditionals and branching 3 30817 15 Feb 4 scalar data types 4 41017 22 Feb 5 arrays and DO loops 5 508 19b 29 Feb 6 subprograms 6 608 22 07 Mar 7 adjustable dimensions and EXTERNAL 7 70421 14 Mar spring vacation 21 Mar 8 COMMON 8 80810 28 Mar 9 input and output 9 91011 04 Apr 10 character variables 10 100923 11 Apr 11 memory management techniques 11 110932 18 Apr 12 design documentation and coding style 12 120840 25 Apr 13 scalar performance optimization 15 02 May 14 parallel processing with MPI 162 Course projects must be approved by class 5 You must report to the instructor by class 9 about your progress on the project you should have at least made a good start Students who miss either deadline will be notified via the SIS Early Warning System Project final reports must be on paper NOT via email description source code listing and sample output Projects may be turned in to Amos Eaton 301 or 404 from 1530 330 PM on Wed 25 Apr 12 class 13 till 1700 500 PM on Fri 27 Apr 12 Late projects will be penalized as follows Eri 1701 7 Mon 1000 1 letter grade Mon 1000 7 Mon 1700 2 letter grades Mon 1701 7 Tue 1000 3 letter grades Tue after 1000 or not at all 4 letter grades Graded projects may be picked up at class or from the Math office Amos Eaton 301 thru 18 May ENGR 4962 FORTRAN Programming Project Agreement student major status D undergraduate D master7s D doctoral D other other programming languages you know project title project description SOURCE OF PROJECT check all that apply D another course number name D doctoral master s or undergraduate research advisor D an extant program written in that I will translate into FORTRAN the project can include timing experiments see textbook 151 to compare the performance of the two Versions D student s idea just for this course D instructor s suggestion COMPUTING ENVIRONMENT D RCS UNIXTM server compiler editor D RCS Windows PC compiler editor D my own UNIXTM PC compiler editor D my own Windows PC compiler editor D other describe compiler editor I understand that my grade for this project will be based on a a complete source listing of a working program that I wrote myself this term to t the description given above b brief written documentation for the program explaining its purpose and use and c sample output showing results produced by the program I will get approval of this project before class 5 and will describe my progress on this project to the instructor before class 9 lfl discover that I cannot carry out the project described here I will promptly meet with the instructor to complete a new Project Agreement form I know how to edit compile and execute a FORTRAN program in the computing environment described above student signature date instructor approval date 22 Feb 12 How to Waste This Course Google fortran and read the rst page of hits instead of studying the textbook or coming to class Anonymous strangers are always the best source of technical advice and downloadable code Teach yourself Modern Fortran instead and use it for the project rather than learning Classical FORTRAN with the help of the text and the instructor By writing a C program in a slightly different syntax you can skip the FORTRAN culture altogether and avoid having to actually master a new language Pick a project that has nothing to do with numerical computing By using FORTRAN for an application it was not designed for you can amaze us both with your resourcefulness and con rm your suspicion that the language really is useless Use an environment that prevents programming There must be some way to write code and run it without ever leaving Microsoft Word and if you gure out what that is you could be famous on Facebook Start late and dont tell me about any problems you encounter That way we can both be surprised when you run out of time and get a bad grade after doing everything else right Let someone else write the code If a teammate does the project your pristine theoretical understanding of the language need never be challenged by the experience of actual programming How to Succeed in This Course Do the textbook reading before each class try exercises the ones I suggest and others write down questions to ask in class report any errors you nd in the Second Edition correct known errors if you use the First Edition Come to class and participate ask questions volunteer answers take notes Try FORTRAN in the environment you will use learn how to use a text editor Word is not one install a compiler if necessary edit compile and run a trivial program Start your project as soon as you can this should be possible in a month you should make good progress by end of spring break meet the deadlines for approval and progress report Contact me if you need help those with no programming must see me Textbook Cost Breakdown publisher s share 6398 66 bookstore markup 2424 25 manufacturing cost 485 5 author s royalty 388 4 your cost 9695 100 Textbook Reading Chapter pages 1 5 2 7 3 9 4 18 5 9 6 16 7 10 8 8 9 20 10 21 11 13 12 39 15 33 208 If you read 17 pages each week you will always be ahead Errata for quotClassical Eortranquot first edition page 1 corrections front151 Move BLOCK DATA above the line 25 1 Change quotfooterquot to quotheaderquot in line 12 up from the 1 bottom of the page 33 1 Change quotvestagequot to quotvestigequot in line 9 up from the 1 bottom of the page 65 1 Change quotfar away at statement 3quot to quotfar away at 1 statement 1quot in line 8 down from the top of the page 71 1 ln Exercise 3812 change the last sentence to quotWhich 1 version of the code do you think is easier to 1 understandquot 78 1 Replace lines 543 up from the bottom of the page with 1 this text quotA floatingipoint number is said to be 1 normalized when p gt 0 or unnormalized when p 0 and f 1 is nonzeroquot 80 1 Replace the second sentence of Section 43 with this one 1 quotConversely the decimal equivalent of a binary 1 floatingipoint value might be truncated when it is 1 written out using a fixed number of digitsquot 81 1 On lines 32 up from the bottom of the page replace the 1 beginning of the sentence with quotOn a decimal computer 1 where the smallest representable value greater than zero 1 is 001quot 99 1 ln Exercise 4108 delete b and make the first sentence 1 quotThe bit pattern 10111101110000000000000000000000 defines 1 a normalized REAL4 guantityquot 100 1 Change Exercise 41011 to read quotFind the bit pattern 1 that represents 55 as a normalized lEEE REAL4 numberquot 103 1 ln Exercise 41030 the recursion should read 1 i i i 1 x lt7 x x 7 xi 1 i 145 1 Change quotIf any of the listed functionsquot to quotIf any of the 1 floatingipoint functionsquot in line 4 below the table 156 1 In the first line change quotthenquot to quotthanquot 156 1 ln Exercise 6836 write a program to compute 1 gammaerflnx and use it to verify that 1 gammaerflnpi 10730819520232482 165 1 In the middle of the page the length of each array 1 element is 4 because L was explicitly declared lNTEGER4 corrections In S2 of Exercise 887 remove the C the lowericase text is supposed to represent a segment of code Near the bottom of the page change quotattaches plotfile to unit 7quot to quotattaches plotfile to unit 9quot In the last paragraph quotbelowquot replace quoton the next pagequot by Change quotWhat happens ofquot to quotWhat happens ifquot in line 2 up from the bottom of the page In Exercise 10940 replace quoton the next pagequot by quotbelowquot replace the floor symbols by ceiling symbols and replace the natural log by the log base 2 For n2O Sturges rule calls for 6 cells not 4 as shown in the example Change Y2 to Y3 in these two places quotY3 will be the sum of three termsquot quotby hand if we were finding Y3 and skippedquot Exercise 13131 should refer to 47 not 50 nonblank characters identified in Chapter 1 as legal in Classical Eortran source code outside of character strings In Exercise 13138 the file stufff should declare REAL8 YI and the INCLUDE statements should put the file names in single forward quotes as stufff and bodyf In Exercise 131321 DATA Y1000 add below the DIMENSION statement In Exercise 131324 replace STOP by PRINI IJK and replace END by to denote additional code and change quotprogramquot to quotcode segmentquot In Exercise 14812 make the code read like this CALL SUBXEX STOP END SUBROUIINE SUBXEX CALL EX REIURN END In the last line on the page change quot56quot to quot64quot In the first line on the page change quot44quot to quot52quot In the table replace entries as follows quotEXRONENIR p1 for real Rquot quotERACIIONR 1f2 for real Rquot page corrections Replace the second paragraph with this one quotIn terms of the IEEE floatingipoint representation of an argument value EXPONENT and FRACTION return p1 and 1f2 In our example 375 is positive so the sign bit s is zero p1 6 and 1f2 05859375 representing 20p X 1f 2Ap1 X 1f2 2A6 X 05859375 or 375 quot In the last paragraph the sentence beginning quotIn ourquot should read quotUsing DISTRIBUTE CBLOCK above we send both rows of A and 2 columns of B to each processor 24 elements altogether but using DISTRIBUTE CBLOCK we send one row of A and all 4 columns of B to each processor 30 elementsquot The second set of EORALL statements should specify indeX limits of 1N not 1N In the second paragraph the indeX pairs are on and above the diagonal not on and below The loops should say I13 and J15 The last paragraph should say that result elements are distributed with columns of S Delete 7 lines starting with CALL REPORT and Observation number 6 VAL is dynamically allocated and DISTRIBUTEd so it cannot be adjustably dimensioned in a subprogram In EXercise 1743 change PRMPT12 to PRMPT9 12A1 to 9A1 and replace the PRINT statement by 1 WRITE6902 TOTAL 902 EORMAT total E50 change In EXercise 17411 delete b In EXercise 17423 change the code to read like this WRITE6901 375000000000000030D0 901 EORMATE191 STOP END In EXercise 17427 make the first line of code X7BDSQRTB274D0AC this is the numerator In EXercise 17438 the DISTRIBUTE directives should say ONTO instead of ON In the second program add ALIGNAJ1 WITH BJ under the ALIGN that is already present In EXercise 17440 make the first line of code INTEGER4 K100010000 In EXercise 17441 make the third line of code IEDEXPXILT0D0 XI10D0 page corrections In Exercise 17442 change c to read quotCan you add directives to translate your Classical Eortran program to HPE If possible run it on the same test cases In Exercise 17443 change the wording to quotIf so is synchronization required between the processorsquot In Exercise 17447 change the wording as follows quotIf K is initially a vector of zeros the effect of the loop is to assign KLL for all elements after the first if and only if the value read for K1 is positive a Write HPE code to show how this process can be parallelized after all using a an INDEPENDENT DO loop or b a EORALL statement In Exercise 1886 the CALL SHIEIL is on line 59 of subroutine SIRINS the final stanza is lines 56762 In Reference Gandalf 166 the wizard s name should be spelled Henry and Henrietta Henrietta was a world traveler and her husband Henry insisted on coming along even though he would really rather have stayed at home In each exotic place they visited Henrietta learned the native customs sampled the local cuisine and immersed herself in the culture of the country She made many friends had a wonderful time and learned a lot about the world But all Henry could do was complain and nd fault Whenever he didnt understand someone he snapped Whats the matter with you people Speak EnglishV7 Whenever someone offered him a local delicacy he said Whats the matter with you people Dont you even have a McDonalds Where I come from we have food people can actually eat In England he fumed Look at these morons driving on the wrong side of the roadl77 In Canada he told everyone he met This currency you call a dollar isn7t really a dollar at all Now this is a dollar77 as he waved a greenback in their faces Henrietta found Paris in the springtime delightful but all Henry could do was complain about the traf c and point out the countless little things that we do better in Cleveland77 At the end of their travels Henrietta decided that there7s no place like home but she returned there with a deep understanding and appreciation for the wide world and she cherished her memories ofthe fascinating places they had seen Henry was happy to get back too just because it was more comfortable to be surrounded by things he found familiar and he rushed down to the barber shop to tell all his friends just how screwed up those foreigners really are When they heard Henry7s stories about world travel they all congratulated themselves on having had the good sense never to leave the town where they were born and grew up C and its many derivatives including Modern Fortran are very similar to each other and quite different from Classical FORTRAN If you are com fortable with one of those languages you might be tempted to adopt Henry7s attitude as you explore the foreign territory of Classical FORTRAN program ming but you will probably have more fun and learn more about the world if you act like Henrietta instead In the end you might decide as she did that there7s no place like home but while you are traveling you should try to keep an open mind and enjoy the scenery You might even nd that you like some of the quaint local customs once you get to know them Please try to remember the story of Henry and Henrietta as we go through the course and have a nice trip Running Programs vs running programs someone else wrote Writing Programs writing your own programs Maple7 Excel7 Matlab buy or download the program learn the user interface use it to do what the vendor wants generic costs money source code is proprietary bugs xed in next release maybe big calculations slow7 memory hogs requires remembering tricks requires relatively less skill passenger oriented easy7 anybody can do it ideal environment is Windows FORTRAN7 C7 C7 Python7 et al learn how to program design and write a program use it to do what you want custom costs time and effort source code is open bugs xed by you right now big calculations faster7 smaller requires creativity and imagination requires relatively more skill pilot oriented harder7 much more fun ideal environment is Unix Modern Fortran invented in 1988 by a committee Fortran 90 Fortran 95 Fortran 2000 Fortran 2003 Fortran 2008 new versions outpace compiler developers free compilers g95 and gfortran are different the largest programming language ever made includes most of the features ever devised a separate language from Classical FORTRAN contains Classical FORTRAN as a subset Classical FORTRAN can be compiled With g95 most Modern Fortran won t compile With g77 can look like C code only more obscure introduction in 17 1 of Classical FORTRAN for more see Fortmn 952003 Emmian maybe a good topic for a 4 credit CS course you Will not learn it here if you really need object orientation use C Classical FORTRAN invented in 1957 by an engineer gradual improvement gt stable since 1977 rectangular data structures of a few types no recursion static memory allocation very little operator overloading side effects are considered bad simple intuitive easy to learn close to algebra convenient for numerical work case insensitive small character set source is xed form verbose easy to get code wrong if careless run time array subscript checking ef cient vectorizable parallelizable modular separate compilation standard widely available portable so far outlived Algol PLl Pascal Modula enormous installed base of legacy code Classical FORTRAN statement description C This program comment 11 REAL8 X declare X a real variable 45 INTEGER4 P declare P an integer variable 45 COMPLEX16 Z declare Z a complex variable 461 LOGICAL4 L declare L a logical variable 462 CHARACTER1 LTR declare LTR a character variable 101 IMPLICIT NONE require all variables to be typed 1244 PARAMETERT2 DO replace each T by 2 D0 45 EQUIVALENCEXJ overlay J on X in memory 463 COMMON BLKQR de ne shared memory 82 BLOCK DATA initialize variables in COMMON 86 EXTERNAL FCN declare name FCN a parameter 72 this is the last source line 11 ABC DE FG assignment 26 IFALT0 AB logical IF 32 IFALTO THEN ELSE IFTHEN block 33 ENDIF GO TO 1 unconditional branch 32 STOP return to operating system 11 DO 1 I1N 1 CONTINUE DD 100p 5392 CALL SUBIJ invoke subroutine SUB 61 SUBROUTINE SUBIJ de ne subroutine SUB 61 FUNCTION FCNXY de ne function FCN 63 RETURN return to subprogram caller 61 READ B free format input 27 PRINT A A free format output 11 READ5 901 X formatted input 91 WRITE6 901 X formatted output 91 901 FORMATF73 format speci cation 911 OPEN7FILE fyle open a le 941 CLOSE7 close a le 941 REWIND7 rewind a le 96 INQUIREUNIT1EXISTOK nd out about a le or unit 142 2 C Code by Michael Kupferschmid C C C This program says hello C PRINT Hello world STOP END N131 HIII I nzzzz 3333 3 tti 55 5 6 H1111 IBCI Un t 1 l l ii H 3 3 3 I S 5 quot ITRIQHGLE ll 11 1114i 1 II I I IFORII RAI serTtMENT Imp announlnooalnnullooononooal 9009000 1 I I llllIIIJMQMIIIIIIIIHIIal nlll nlla lIIuquEIIVCIIQI BSISISUIIII IIIDIIIIIIIINquotn 755111 IIIIIIIIIIIIIIIIlitllillivltllli11111311111I1111111111IIIIIIIIIIIIIIIII 22222222222Izz2222222222222222zzzlz22222222222222222222222222222222222 1333JI3333I333333333333333333333333333333393333333333333333333333333933333I3 44t44 44444444444444444444t4t44444 ttt44444444444444444644144 55I5 55555555555555555555555555555555555555555555555555555555555555555I55I 5856BE36555655655i556665586553 5556855 55565539556i iiiiSIBSSSEi iiiiii EERT E I 717111717111777717717171117111111777117117111777111711171177117111 IlculllalcIllnlcllaalulslllltaoulnlullnslulllIllslaaanaunsaasIsaac 711173911 BBBISIII EIDSSSSSSISSSSSSQ5999llBUIIIOIIOIIIQIOISISSISSSOSDIISSSSSSQS I Q nunumsunquotnirvana1511111933nnIUIIIOIOOIOWIIHlulusulsuuunuau uu ouls39r sssEIlslI1I 707172 N hillOJ system library source code gt translation gt Object gt linkage gt executable prog f code ed1t1ng a out Free FORTRAN at Rensselaer This document describes six different ways to compile and run Classical FORTRAN programs without having to buy a compiler The information it contains was current as of 06 Nov 11 1 Use Public RCS UNIXTM or Linux machines Connect remotely such as by using SecureCRT from a Windows lab PC to an RCS server such as rcs sunrpi edu or rcs linuxrpi edu In a UNIXTM window7 use commands like these 77 program aout If you want to avoid having to prepend to the name of an executable le7 you can edit your bashrc le and add this UNIXTM command including the nal period export PATHPATH 2 Install Linux on a PC you own You can get help doing this from Academic and Research Computing ask at the VCC Help Desk or by going to one of the installfests that are periodically conducted by the student chapter of the ACM Linux can be installed as the only operating system replacing Windows or in such a way that you can decide when you boot the machine whether you want to run Linux or Windows Linux includes the gfortran compiler and the UNIXTM program development utilities You can open an xterm and use commands like these g ortran noautomatic norangecheck program aout You can customize your PATH on Linux just like you would on RCS 3 Use cygwin This is a UNIXTM emulator that runs as a Windows application Student laptops come with cygwin already installed If cygwin is not already on your computer you can download it for free by following the instructions on the next page Depending on the version of cygwin you have7 it might include a FORTRAN compiler named 77 or g77 or gfortran If it is 77 you can use commands like these in a cygwin window 77 program aexe If you want to avoid having to prepend to the name of an executable le7 you can edit as the administrator the le etcpro ile and append to the de nition of the PATH variable Installing cygwin You can install cygwin on your Windows machine by following these steps Now Open a browser and go to httpwwwcygwin com Click on Install Cygwin now This downloads the setupexe program You can override the default location suggested for this program if you wish7 or change its name to avoid con ict with setup exe programs you might have for other applications7 but do not put it on your desktop Click Save and wait for the download to nish If any User Account Control Prompts appear7 click on Yes Open setupexe A copyright page appears click Next Select Install from Internet and click Next You should see a panel with an entry for Select install root directory Accept the default root directory location Czcygwin7 the default text le type of Unix 7 and the Install For setting of All Then click Next Now you will see a Local Package Directory screen Accept the default directory and click Next Now you will be given several choices how to download cygwin settings or Use Direct Connection and click Next Select either Use IE5 At Select download site select ftpmirrorskernelorg or http mirrors kernel org Now you will see a page asking you to mark what packages to install Categories are listed on the left Find the category Devel and click on the word to expand it into a list of packages 7 Packages are listed on the right Scroll down until you nd the package gcc g77 7 and click on the word Skip to change it into a version number This selects the package for downloading 7 Find the package make and select it for downloading 7 Find the package gdb and select it for downloading Repeat the process to select vim or xemacs or both from the Editors category Do not select emacs Repeat the process to select util linux and time from the Utils category The util linux package includes the more program Repeat the process to select bc a desk calculator and gnuplot a plotting program from the Math category Click Next and wait while everything is downloaded and installed Then click Next again At Installation complete press OK to close the installer Start cygwin This opens a terminal window in which you can type commands At the command prompt type and enter cygcheck c egrep v OK and con rm that the output is only headings cygwin should be ready to use If the process did not work you can contact Mohammed Benghanem7 bengthrpiedu7 CII 31597 for help 4 Install the g77 mingw32 compiler on a Windows PC Map sambasrvsoftware as a network drive and copy the g77 mingw32 folder to the local C drive of the PC Then add the g77 mingw32bin folder to the PATH On a Windows machine in a public lab you can open a Command Prompt Window and enter PATH oPATH o C g77mingw32bin to reset the PATH temporarily On your own Windows machine you can use the same method or follow the instructions on the next page to change your PATH permanently You can use notepad to prepare a le containing your FORTRAN source code Then use commands like these in a Command Prompt window to compile and run the program g77 fnoautomatic ftypelessboz programf aexe 5 Install the g95 compiler on a Windows PC The g95 compiler is available for several operating systems To install it on Windows use your web browser to go to httpwwwg95 org and click on Downloads More buttons appear under neath click on Binaries A new page appears Scroll down to the section marked G95 Binaries current snapshot Find the line in that section that says Selfextracting Windows x86 and click on the http link The installation program g95 MinGwexe will download Open the le and con rm to Windows that you want to run it You will need to give permission several times for the installation to complete You can use notepad to prepare a le containing your FORTRAN source code Then use com mands like these in a Command Prompt window to compile and run the program g95 0 program programf program The executable produced by g95 in the example above is named program exe 6 Install the gfortran compiler on an Apple Macintosh computer Install or update the Xcode Tools on your computer The package is on your Mac OS X Installation DVD under Optional Installs but that version might not be up to date You can download the latest version from Apple if you register for a free ADC membership The whole package uses about 1GB of disk space but the only component you need to install is Unix Development Support To get the compiler use a web browser and go to httphpcsourceforgenet Click on the link to download the OS X style installer package for gfortran Find the download in your Downloads folder If the lename ends in mpkg double click on it if it ends in zip double click on it to get a mpkg le and then double click on the mpkg le Then follow the standard installer process to install the compiler Once the compiler is installed you can open a UNIXTM window and proceed as described above for Linux If you need help installing or invoking the compiler you can contact Garance Drosehn drosehn rpiedu VCC 306 Changing the PATH on your own Windows machine PATH is an environment variable containing the list of folders that Windows searches for programs you ask it to run You will probably nd it most convenient to use the g77 mingw32 compiler if you add the folder containing it to your PATH If you are running Windows Vista 7 you can change the PATH as follows 0 left click on StartHControl Panel 0 in the Control Panel window double click on User Account o in the User Account window click on Change my environment variables in the Environment Variables window look for a PATH variable for your account if PATH is present click on Edit add Cg77 mingw32 to the front of the variable value click on OK 0 if PATH is missing click on New in the New User Variable window enter PATH for the variable name and Cg77 mingw32 for the value click on OK 0 close the Environment Variables window 0 close the User Account window When you are nished open a Command Prompt window and type PATH to verify that the PATH has been changed If you are running another version of Windows ask at the VCC Help Desk for help changing your PATH You can install the g77 mingw32 compiler in any folder on any local hard drive of your PC by appropriately modifying the instructions given above If you pick a hard drive other than C make sure it is a local drive not a network mapped drive What if you don t know UNIXTM Options 173 and 6 require that you know at least a little about UNIXTM Extensive tutorial infor mation is available on the web and excellent introductory textbooks are published inexpensively by O7Reilly www ora com What if you have trouble If you have trouble installing cygwin or g77 mingw32 or g95 ask for help at the VCC Help Desk bring these instructions and if your machine is a laptop bring it If you have trouble using cygwin or a compiler or need help with the FORTRAN language or if you discover errors in this document contact Mike Kupferschmid adjunct faculty by calling 279 1606 no later than 8PM please or visiting Amos Eaton 404 I am in on days that I teach or sending email to kupfemSQrpi edu What if your machine is offcampus You can install the g77 mingw32 compiler on an off campus Windows 7 machine that has a network connection by following these steps 0 install the VPN software on Windows 7 go to https vpnnet rpi edu log in with your RCS userlD and password installation starts for Cisco AnyConnect VPN client when prompted about installing an add on7 click on Download instead click on Windows Vista64XP2000 save the le anyconnect win 2 2 0133 web deploy k9 exe on your PC double click on anyconnectwin2 2 OlSSwebdeploykg exe this installs the VPN client 0 start the VPN software on Windows 7 select StartHAll ProgramsgtCiscogtCisco AnyConnect VPN Client enter vpnnetrpi edu in the Connect to eld and click on Select enter your RCS userlD and password when prompted7 and connect when the VPN connection is established the Cisco AnyConnect VPN Client window disappears and a lock icon appears in the system icon tray 0 connect to sambasrv and copy the g77 mingw32 folder enable plain text passwords for information on how to do this7 go to httphelpdeskrpi edu and search for plain text passwords77 right click on the My Computer icon and select Map Network Drive in the Map Network Drive window7 pick a drive letter eg7 Z and enter sambasrv rpi edusoftware or 128 1132215software if the name does not work de select Reconnect at logon left click on Connect using a different user name in the Connect As window enter your RCS userlD and password and click OK in the Map Network Drive window7 click on Finish to map the network drive double click on My Computer to open it double click on the mapped network drive eg7 Z to open it copy g77 mingw32 to your local PC hard disk and proceed as described on page 3 of this handout kupfem 1 f77 progf main End of Compilation 1 1501510 Compilation successful for file prog f kupfem 2 a out Hello world kupfem 3 Printing Your Work on UNIXW listing source code unix1 lpr programf prints le programf on default printer unix 2 lpr Pvclw programf sends printout to VCC output racks unix 3 n1 programf lpr numbers lines on printout printing output from a program unix 4 aout gt fyle puts standard output in le fyle unix5 lpr fyle prints le fyle unix6 aout lpr prints standard output printing the screen unix 7 script puts conversation in le typescript unix 8 aout run your program N 3 answer prompts the answer is 52 print output to the screen want to do more no etc unix9 exit turns off script command unix10 lpr typescript prints screen session Printing Your Work on cygwin The UNIXTM lpr command is not implemented in cygwin so to print a le you must open the le with notepad and use the notepad print function To print the cygwin screen you can use script as described above and then print the le using notepad or you can cut and paste from the screen into a le and print the le using notepad In order to cut and paste you must be using the X window version of cygwin so make sure you select that version when you start cygwin Open notepad from the Windows START menu Then select text from the cygwin window by holding down the left mouse button as you move the mouse pointer across the text you want When you are nished selecting the text release the mouse button move the mouse pointer into the notepad window click the right mouse button and select PASTE This will paste the text that you have cut into the notepad window Now you can use the notepad print function to print the le binsh compile a Fortran program tell how to use the script if ieq 0 then echo quotusage ftn programf sublf quot echo quotcompiles listed routines and links to produce aoutquot exit 0 fi sanityicheck the arguments for fyle in do if l is fyle then echo quotfyle is absent or empty nothing donequot exit 1 fi echo fyle grep 7i quotfquot gt devnull if ne 0 then echo quotfyle does not have a f extension nothing donequot exit 1 fi cat fyle egrep quotA 72quot gt devnull long cat fyle grep 7i quotA END quot gt devnull if long eg 0 7o ne 0 then echo quotfyle has long lines or no END statementquot echo in quotis this really Fortran source quot yesno head l if vvyesnou quoty then echo quotcontinuingquot u 0 Hyesnou quotyesquot 1 fi fi done compile and link rm if aout rm if tmpwarnings usrbingfortran 7g iffixediform ifdollariok istdlegacy 7Wno7tabs ifnoiautomatic ifboundsicheck ifnoirangeicheck 2gt tmpwarnings if 7eg 0 2 more tmpwarnings exit 3 fi


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Amaris Trozzo George Washington University

"I made $350 in just two days after posting my first study guide."

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.