G77 Download Mac

Free Fortran Compilers

  1. G77 Download Mac Pro
  2. Fortran G77 Download
  3. G77 Download Mac Operating System
  4. G77 Download Mac Os

Tutorial: Mixed C and Fortranand some LAPACK. A recent question in one of the discussion forum led to the general question of using some of the performance libraries in Mac OS X with a specific emphasis on mixing C and Fortran, as well as implied data types in LAPACK. In this mini-tutorial I’m going to cover some of the basics of mixed C. Aquamacs Emacs is a Mac-native distribution of the powerful Emacs text editor (versions 23+), featuring Plug&Play and a great UI. Aquamacs feels just right on the Mac, interacts well with other apps, while supporting Emacs' keys and Elisp packages. FinkCommander is a graphical user interface for the Fink software packaging system for Mac OS X.

There are a number of free Fortran 77 and 90 compilers available on thenet.The one I have been using in my Fortran courses at York isGNU, which implements Fortran 77 and adds several Fortran 90 features. Thanks to Prof. Clive Page (Dept of Physics & Astronomy, University of Leicester, UK)for providing the compiler and for valuable advice on Fortran in general.

You can download the 1999 version of this compiler (version 2.95 of gcc) along with the SLATEC library (Version 4.1, July 1993), from this page. Thepackage should run under all versions ofWindows.All the needed files are packed in one zipped file(Fort99.zip) of about 6MB.

(If for some reason you need the older DOS/EMX version,which does not include a library and does not run under Windows XP, then youcan download it from my old page.)

DOWNLOAD

  • Create the directory F
    The new folder must be immediately under the root of your hard disk. You can do this by double-clicking MyComputer, then double-clicking your hard drive (usually C:), and then selecting New Folder from the File menu and calling the folder F.
  • Download the file Fort99.zip (5,820,239 bytes).
    You can do this by right-clicking the mouse on the above link, and choosing Save Target As.... In the Save As window that appears, locate the F folder, and save the file in it.
  • Unzip the downloaded file into F.
    Yon can do this by locating the file (starting from MyComputer) and simply double-clicking it to launch the zip/unzip program. Make sure to specify that all files should be extracted immediately under the F folder.
    Note: If the unzip program does not give you the option to specify the extraction location, let it extract the content to anywhere and then move the extracted folders (using cut and paste) to F. When done, you should see the four folders G77, SLATEC, MINE, and YORK appearing in F.
That's it! You use the compiler through CLI, the command-line interface (akaterminal, command prompt, or DOS) after setting two environmentvariables, MacPATH and LIBRARY_PATH, as shown below.

USAGE

You store your programs in the FYork directory, compile themusing: f2exe, and create library object files using f2lib.Here is a very short program to test the compiler and the configuration: Use any editor to create this program (simply copy and paste) and save it as a text file in the FYork directory under the name test.for. Youcan, of course, use any editor you like as long as you can save the filein text format and with the extension you want. Notepad, for example, uses text but insists on using the txt extension (unless you override by double-quoting) while MS-Word insists on its propriety format (unless you explicitly override). I highly recommend using the Crimsoneditor, which can be downloaded from the on-line Lab-1 (see below).

To compile your program, start a CLI session (by launching the command promptprogram, usually in the Accessories group) and issue these two commands:These set the environment so that your computer would know where the compilerand its libraries are located.
Note: these two commands must be issued every time you start a CLI session. Youcan optionally automate this step by adding these two variables to the system-wideenvironment using the Control Panel.
You can now compile and run your program by typing:If the first command returned an error then the directory was not created (ornamed) correctly. If the second command was not recognized, or complained that a library is missing, then the environmentvariables were not set correctly (you can issue the set command without any arguments to inspect all environment variables).

More information on using the compiler can be found in theon-line Labs at theFortran@York site.

LANGUAGE

The FG77doc directory has a detailed reference to the language, which is largly ANSI Fortran-77but with some Fortran-90 features added (see below).

The above Fortran@York sitecontains a quick reference guide, lab, and SLATEC usage examples.If you are already familiar with Fortran then the following points may beall you need to know about this compiler:

  1. Control Structures
    You can use either the old (goto-based) or the new (structured) control flow (or mix them in the same program). Support of the 'ugly goto' is meant for existing code only, and any new development should avoid it.
  2. Style
    You can write your source using either the old style code (column 7) or the newer free-form.
  3. Compilation Command
    The above f2exe command is just a batch file that invokes g77, the 'real' compilation command. The command: directs the compiler to compile the file prog.for and stores the output in the file prog.exe. The -ffree-form switch indicates free-form style (remove it if you are using the old style).
  4. Comments
    In free-form style, use ! for both full-line and in-line comments. In the old style, use a 'C' in column-1.
  5. Statement Continuation
    In free-form style, you can continue a statement on the next line by ending it with an ampersand '&'. In the old style, put a character in column-6.
  6. Path Separator
    When referring to files (e.g. in the file=' ' parameter of the OPEN statement) use a forward slash '/' or two consecutive backslashes ' rather than a backslash to delimit directories. This is because the backslash ' denotes an escape sequence in strings.
  7. I/O Unit Numbers
    Not all unit numbers are allowed in the OPEN statement. In particular, unit 5 is 'pre-connected' to the keyboard. Units 10 through 99 seem to work well with disk files.
  8. Fortran-90 Features
    These include: Automatic arrays in subprograms, zero length strings, character constants may be enclosed in double quotes (') as well as single quotes, cycle and exit, the DOUBLE COMPLEX type, DO WHILE, the END decoration, KIND, IMPLICIT NONE, INCLUDE statements, list-directed and namelist I/O on internal files, binary, octal, and hex constants, `O' and `Z' edit descriptors, NAMELIST, OPEN specifiers STATUS='REPLACE', the FILE= specifier may be omitted in an OPEN statement if STATUS='SCRATCH' is supplied, relational operators <, <=, , /=, > and >= may be used instead of .LT., .LE., .EQ., .NE., .GT. and .GE. respectively, SELECT CASE (but not for character types).
  9. Separate Compilation of Subprograms
    Your main program is recognized by the program statement, as in the Convert program above. The subprograms (functions and subroutines) can be included in the same file as the main program (in which case you can compile everything in one shot) or can be stored in separate file(s). It is recommended that you store general reusable subprograms in separate files so that you can reuse them (without recompiling them) in future projects. To compile a file that contains only subprograms (no program statement), use the f2lib command, which generates object files, one per sub, in the mine directory, e.g. will compile (without linking) the subprogram in util.for and store the output (an object file) in the file util.o. f2lib is just a batch file that invokes the g77 command with the -c (compile-only) switch, viz.A program that uses pre-compiled object files can be compiled (and linked to them) by simply referring to them in the compilation command: The above command searches all object files in mine to resolve any missing reference in prog.for.
  10. Separate Compilation of Subprograms, automated
    The supplied f2exe and f2lib batch files take care of separate compilation and delayed linking with object files and with the SLATEC subprograms. You don't have to directly issue the g77 command unless you use the old columnar style or you want to change one of the switches or directories.
  11. Assembly Listing
    The -S (capital S) switch allows you to see a listing of the generated assembly code.
F@Y/HR/S03URL

My experiences in installing IPOPT on Mac OS X

by Peter Carbonetto
Dept. of Computer Science
University of British Columbia

IPOPT is asoftware package for solving nonlinear objectives subject to nonlinearconstraints. It uses primal-dual interior pointmethodology. Importantly, it is open source.

After a great deal of time and trouble, I managed to get in workingon my laptop which is running the Mac OS X operating system.1 In the following, I detail myexperiences in installing the IPOPT package.

Succinctly put, the configure script did not work for IPOPT, so Ihad to install everything from scratch. While this was really quite alabourous process, I didn't know any other way of installing thepackage. On the bright side, I learned a lot about compiling fortranand C++, and linking object code, libraries and executables

1. Installing the Fortran compiler

The first problem I encounter is that I do not have a Fortran 77compiler installed on my machine. I do have the GNU C and C++compilers installed on my computer already (the programsgcc and g++), but the Fortran 77 compiler isalso needed to compile the BLAS, LAPACK and HSL routines. A lot ofpeople are upset that the GNU Fortran compiler g77 wasnot included with the AppleDeveloper Tools because installing it ourselves causes many extraheadaches. But we'll have to make do.

There are several ways I can install a Fortran compiler. One is bydownloading GNU Fortran compiler from the High Performance Computingwebpage. Another route is to install g77 via Fink. Instead, I'm going tofollow the route that gives me the most control: I will download andbuild the entire GNUCompiler Collection (GCC), then put the necessary files in theappropriate places. Even though this route is considerably morecomplicated, it will allow me to ensure that I have the correctversion of the compiler. You see, since I'm running Mac OS X 10.3.9 Ialready have gcc 3.3 installed on my computer in the/usr/bin/ directory. (It is easy to check the version bytyping gcc --version.) It is important that the compilersI'm using all belong from the same collection otherwise it is verylikely that I will undercover linking errors. I've decided todownload GCC 3.3.6 from my local university FTP mirror.

It is crucial that I do not follow the default installationfor GCC, because I may end up overwriting important files. The GCCinstallation instructions advise the same thing. Suppose that I'vechosen to install to the directorygcc-install. I've done so simply by passingthe option --prefix=gcc-install to theconfigure script. After following the correctinstallation steps and waiting a couple hours for the entire packageto be built, I now have a whole bunch of files and subdirectories ingcc-install. I'm only really interested inthe programs and libraries necessary for compiling and linking Fortrancode. I start by installing the Fortran 77 compiler with thecommand

In the end, I had installed the following files:

G77 Download Mac Pro

2. Building the BLAS, LAPACK and HSL libraries

Now that I have a Fortran 77 compiler installed on my system, Iproceed to build the libraries needed by IPOPT from scratch. First, Idownload the latest BLAS and LAPACK tarballs from the Netlib FTP repository. The BLASpackage just consists of a bunch of Fortran files. I compile each ofthe individual files into object code, starting with the filecaxpy.f:

This creates an object file caxpy.o. The rest of thefiles are compiled similarly. If you want to produce a shared library,you will want to include the -fPIC option. Also, I'venoticed that the -fexceptions option should not be usedas it causes linking errors down the road. Once I've compiled all theFortran code, I create a static library via the following commands:

I create the LAPACK library in precisely the same fashion, with thesame options passed to g77. The only difference is thatthe files in the LAPACK tarball are strewn about in varioussubdirectories. In brief, the quickest way to build the LAPACK libraryis to use the existing Makefile and type

at the command prompt with lapack/SRC being thecurrent directory. Before we do that, however, we need to modify a fewof the options passed to the Makefile. First, I movelapack/make.inc.example tolapack/make.inc. Looking at this file, I see that itspecifies among other things the program used to compile the Fortrancode, which is g77, exactly as I want it. Near the bottomof this text file, I change the variable LAPACKLIB to

Now, I can type the make command in theSRC subdirectory and it should proceed to automaticallycreate the library (this takes about ten minutes on my computer).

Lastly, I create a library with the HSL subroutines. Afterfollowing the instructions in the IPOPT document for downloading thecode from the HSL Archive, I create the library with the followingcommands:

Now I'm ready to create the IPOPT library.

3. Building the IPOPT library

I will elect not to follow the standard installation instructions(since they didn't work) and instead build the IPOPT library byhand. Basically, I'm going to follow almost the same steps as I didbefore. The trickiest part is that I need to modify the fileIpopt/inc/config_ipopt.h manually; the configure scriptdoes this automatically. My file looked like

Next, I compile the C and C++ source files into object files. Forinstance, a create the object file IpAdaptiveMuUpdate.owith the command

where ipopt-include-dir is the directory containingall the .h and .hpp header files. And soon. Once I've compiled all the source files, I create the staticlibrary with the commands

Note that in most cases it will not make sense to archiveall the object files into the library. For instance, youshould not include IpMa57TSolverInterface.o unless youhave downloaded that solver (I didn't). By the same token, I didn'tinclude the code for interfacing with the AMPL and CUTEr.

4. Testing the installation with an example

I can't be positive that we built the libraries correctly withouttrying to run a program that actually uses IPOPT. I try the Hock andSchittkowski nonlinear programming test example no. 71, which isincluded with the IPOPT tarball. After copying all the staticlibraries to libhome, I compile and link the codewith the following sequence of commands:

Fortran G77 Download

Now have a program which is executed by typing./hs071. Note that the order in which I included theobject files and libraries in the above lines is important. Theg2c library helps us link the Fortran object code to theC++ object code (recall that I placed this library in/usr/lib).

G77 Download Mac Operating System

Footnotes

G77 Download Mac Os

1 More precisely, I'm using MacOS X version 10.3.9 (Panther), and I have a PowerPC G4 processor. Youmay find that the steps I follow apply to your system, even if itisn't the same process or version of the operating system.