High Performance Computing For Mac Os X



Step 3: Now that Xcode is fully installed, we can move on to downloading the GNU compilers from the High-Performance Computing for Mac OS X website. The easiest way to get there is to open a web browser, Safari in this case. And type in 'High-performance computing Mac OS X' in the Google search. It should be the top hit. Just as Mac OS X 'Snow Leopard' (10.6) was a refinement of Mac OS X Leopard (10.5) and OS X Mountain Lion (10.8) was a refinement of OS X Lion (10.7), rather than offering radical new features, macOS High Sierra (10.13) is a refinement of macOS Sierra (10.12), too. Is your Mac computer crawling along? It doesn't have to be that way—try these advanced tricks to give macOS its best possible performance.

Computing

gfortran for Mac

DISCLAIMER: I provide this information here to aid my memory and in thehope that others will find it a useful resource based on my experiences of installing a gfortran compiler on Macs. I am not a computer scientist orFortran guru and, as such, am unlikely to be able to help you with Fortran code,compilation or runtime problems.

There are several options available for installing gfortran for Mac OS X,other than installing from source code.

GCC Wiki

I currently choose to use the relevant gfortran installer (.dmg) packagesprovided through the GCC Wiki (opens in new window). Note that the files areinstalled in /usr/local system directories which require the administratorpassword.

HPC

There are also various tar-files of gfortran distributions provided at the High PerformanceComputing web page. There are up-to-date distributions for some systems(only Mac OS X 10.7 (Lion), 10.8 (Mountain Lion), 10.9 (Mavericks) and 10.10(Yosemite) as of the last update of this page).

I recommend not to choose a package containing a version that is not a stable version accordingto the main GCC web site. Furthermore, for simplicity, I would recommendonly to install the relevant 'gfortran only' distributions.

The files are gzip'd tar-files which should be unpacked, for instance byusing the Terminal application, as follows:

sudo tar xvfz[tar-file] -C /

Note that the files are installed in /usr/local system directories whichrequire the administrator password.

The R Project

Previously, I had preferred to use the gfortran packages distributed inassociation with the R Project. These can be found in the 'Apple Xcode gcc-42add-ons' section of their Tools web page (opens in new window) or via the direct linksbelow. These gfortran packages and updates are specifically built to matchApple's own gcc builds. This does mean that the version is back at GCC 4.2,which is undoubtedly where it will stay since GCC changed their licensing andApple has stopped updating their GCC distribution with Xcode. Nonetheless, myexperience shows that this distribution is one that always works.

There are several packages relevant to particular Mac OS X and Xcodeinstallations. Run gcc-v to find out which Apple gcc build is currently installed as part of theXcode tools.

  • Mac OS X 10.7 (Lion) and 10.8 (Mountain Lion):

    One may need to apply a link after installing one of these packages so 'gfortran' may be used as a command, e.g.

    sudo ln -s /usr/bin/gfortran-4.2 /usr/bin/gfortran

    Otherwise, simply use the explicit command 'gfortran-4.2'.

  • Mac OS X 10.6 (Snow Leopard):
  • Mac OS X 10.5 (Leopard):

The files for builds 5564 and 5566 are gzip'd tar-files which should beunpacked, for instance by using the Terminal application, as follows:

sudo tar xvfz[tar-file] -C /

Note that the files are installed in /usr system directories which requirethe administrator password.

Packages for older OS X and Xcode versions are also available on the pagelinked to above.

Compatibility and uninstalling

Note that each of these distributions has different associated libraries andother installed files which may conflict with or be wholly or partiallyoverwritten by one another. It is therefore advisable to ensure that you haveonly one distribution installed at any one time.

It is straightforward to uninstall the GCC Wiki distribution and instructionsare provided on the detailed instructions web page. Simply run the command:

sudo rm -r/usr/local/gfortran /usr/local/bin/gfortran

It is slightly more difficult to uninstall the R Project or HPC distribution. HPC distributes gfortran as a tar-file. Therefore each file contained in thetar-file should be removed. The easiest way to do this is probably to run thecommand:

For sh/bash:
for file in $(tar tfz[tar-file]); do sudo rm -f /$file; done

For csh/tcsh:
foreach file ( `tar tfz[tar-file]` )
sudo rm -f /$file
end

where [tar-file] is the package, for example gfortran-4.7-bin.tar.gz,gfortran-lion.tar.gz, gfortran-snwleo-intel-bin.tar.gz, etc. This will removeall files but not directories, which may contain other files that are not to be removed. To remove empty directories only, then run the command:

For sh/bash:
for file in $(tar tfz[tar-file]); do sudo rmdir -p /$file; done

For csh/tcsh:
foreach file ( `tar tfz[tar-file]` )
sudo rmdir -p /$file
end

The R Project distribution is a .pkg file and this adds another level ofcomplication. To list the files that were installed from this package, oneneeds to locate the 'receipt', which is a .bom file. On my system (Mac OS X10.8, Mountain Lion) the file is located at/private/var/db/receipts/org.r-project.gcc-42.darwin11.pkg.bom (was/private/var/db/receipts/org.r-project.gnuFortran42.lion.usr.pkg.bom for Mac OSX 10.7, Lion; or /private/var/db/receipts/org.r-project.mac.tools.gfortran.bom for Mac OS X 10.6, Snow Leopard). To find the file, run a command such as:

sudo find / -iname'*fortran*.bom'

Once the appropriate file has been located, a list of files that have beeninstalled can be found by running the command:

lsbom -pF [bom-file]

Therefore, similarly to removing the HPC distribution, the files can beremoved by running commands such as:

For sh/bash:
for file in $(lsbom -pF[bom-file]); do sudo rm -f $file; done
for file in $(lsbom -pF[bom-file]); do sudo rmdir -p $file; done

For csh/tcsh:
foreach file ( `lsbom-pF [bom-file]` )
sudo rm -f $file
end

foreach file ( `lsbom-pF [bom-file]` )
sudo rmdir -p $file
end

Note that these commands should be run from the root directory (cd / first).

Last updated: 2020-09-02, M.Floyd (MIT)
Accessibility

If you want to use your G4/G5 with Mac OS X for some good numerical work .. this could be useful to you. I have here,binaries, source, documentation and instructions to install Fortran, MPI, OpenMP, PVM, Octave, GDL, Cactus, Globus, RNPL, GIMPS, GRAVSIM, FEYNMAN, GNU Java, etc. on Darwin. If you are interested in harnessing the full power of a dual G4/G5, i.e. using AltiVec and both processors,click here.

While most of these packages have been recently recompiled/tested on PANTHER OS X 10.3 and its new Developer Tools, I would expect the binaries included here to work with almost any version of OS X. I've included Jaguar versionsof some binaries at some places as needed. Feel free to contact me with questions or problems! Note: Panther does not include /usr/local/bin in its default PATH. Therefore, assuming you're using the default bash shell, please type (or include in /etc/profile) PATH=/usr/local/bin:$PATH and export PATH before using any of these tools.

The binary install option provided here, will literally take afew seconds! Many consider this the quickest and easiest installfor some of these packages available on the web. If you choose toget the source and compile, be warned that it may take severalhours even when everything goes perfectly!

NEW! Most binaries updated with current CVS source. Screenshots of some of these software packages and a short blurb about Apple's CHUD Tools is now available at this link!

Computation Tools :: Fortran

GCC 4.0 (auto-vectorizing):
Recently compiled using source code from the GNU CVS servers, autovect-branch. This contains beta versions of gfortran (GNU F95) and gcc (GNU C) compilers that can perform limited auto-vectorization (i.e. modify code to take advantage of AltiVec, automatically). Use flags -ftree-vectorize -maltivec to enable that option. For more information, see this webpage. Download my binaries, and cd to the download folder. Then gunzip gcc-vec-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf gcc-vec-bin.tar -C /. It installs everything in /usr/local. You invoke g95 by typing gfortran. Note that you may need to add the flag -lstdc++ for getting it recognize some of the unimplemented standard functions. You will also need to have Apple's Developer Tools installed. They are included on a separate CD in the retail version of OS X and also available as a free download from Apple's Developer Site. Please install the most current version of Developer Tools.
Note: You may need to ranlib some libs after you install. The compiler will tell you which ones when you try to use it. In that case, simply do a sudo ranlib -s on each such library.
Binaries: gcc-vec-bin.tar.gz (Panther), updated January 28th, 2005.
Documentation: click here!

High Performance Computing For Mac Os X 10.12

g95 4.0:
Recently compiled using source code from the GNU CVS servers. This contains gfortran (g95) version 4.0 compiler. This is an beta version of the much awaited, free, open source, F95 compiler! Download my binaries, and cd to the download folder. Then gunzip g95-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf g95-bin.tar -C /. It installs everything in /usr/local. You invoke g95 by typing gfortran. Note that you may need to add the flag -lstdc++ for getting it recognize some of the unimplemented standard functions. You will also need to have Apple's Developer Tools installed. They are included on a separate CD in the retail version of OS X and also available as a free download from Apple's Developer Site. Please install the most current version of Developer Tools. Finally, note thatthere is an alternate g95 project, that is not part of GCC. They seem to have recently released their own official version of g95 for OS X which you may wish to try. Again, note that that g95 is not the same as this version here.
Note: You may need to ranlib some libs after you install. The compiler will tell you which ones when you try to use it. In that case, simply do a sudo ranlib -s on each such library.
Binaries: g95-bin.tar.gz (Panther), updated January 28th, 2005.
Documentation: click here!

g77 3.4 :
Recently compiled using source code from the GNU CVS servers. This is the FINAL release of g77 (version 3.4.2 compiler). Future versions of GCC will have g95 (see above). Download my binaries, and cd to the download folder. Then gunzip g77v3.4-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf g77v3.4-bin.tar -C /. It installs everything in /usr/local. Try it! You will need to have Apple's Developer Tools installed. They are included on a separate CD in the retail version of OS X and also available as a free download from Apple's Developer Site. Please install the most current version of Developer Tools.
Note: You may need to ranlib some libs after you install. The compilerwill tell you which ones when you try to use it. In that case,simply do a sudo ranlib -s on each such library.
Binaries: g77v3.4-bin.tar.gz (Jaguar/Panther), updated September 17th, 2004.
Documentation: click here!

High Performance Computing For Mac Os X 10.7

Commercial Fortran:
ABSOFT: A commercial option for Fortran on OS X. It works very well, I have used it extensively. It optimizes better than g77. Includes f77, f90, f95 and a rather nice IDE. It also includes AltiVec optimized Math and BLAS libraries. Moreover, along with CBS VAST it canvectorize and parallelize your Fortran codes! In otherwords, it can automatically optimize your code for AltiVec and dualprocessors! More details about this feature available at this link. For more information, try the Absoft OS X product page.
NAG: A commercial f95 for OS X. I recently played with it. Does excellent optimization .. yielding much faster executables compared with g77. Very affordable commercial solution. For information, try the NAG Fortran page.
IBM: A f90, C, C++ suite for OS X. IBM released its highly optimized PPC compilers (including Fortran!) for OS X. On initial tests they seem to provide a speed gain of upto 2X on current G4/G5's over other compilers.
Absoft website: clickhere!
IBM: clickhere!
NAG website: clickhere!

F2Cbased Fortran:
This is the oldest Fortran compiler available for OS X. Its beenaround since OS X was in a public beta state. Download this shellscript: buildf2c, type chmod +xbuildf2c and then sudo ./buildf2c. The script will grabf2c source from Netlib repositories and install a f2c basedcompiler in /usr/local/. You aredone! The compiler can be envoked by the commands fc orf2c.
Install script: buildf2c
Documentation: click here!

ADAPTOR (High Performance Fortran) Compiler:
Note: You will also need g77 3.4 and MPICH.
This is a compiler wrapper that converts high performance fortrancode (.hpf) to F77 with MPI parallelization. Download the sourcewith binaries. You will need to choose and installation directory and assign the environmental variable PHOME its name. Then gunzip adaptor.tar.gz (if your browser didn't do so already) and tar -xvf adaptor.tar in this directory. Remember to add the bin directory to your PATH. You may need to add the flag -lcc_dynamic for your hpf source to compile, depending on what version of GCC you're using.
Source and Binaries: adaptor.tar.gz, updated Spring 2004.
Documentation: clickhere!

Computation Tools :: MPI and OpenMP

MPI (Message Passing Interface):
MPI is the most widely used framework for parallel computing. Withthis you can parallel compute over almost any kind of cluster ..Mac's, SGI's, SUN's, Linux .. even over a hybrid or heterogeneouscluster. If you want to use MPI with ssh try this link for instructions.
MPICH: Get the source from the MPICH website, configure, make and install. Use a UFS filesystem if you want to compile the C++ extensions. Should have no problems! Or get my binaries, gunzip mpich-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf mpich-bin.tar -C / and you are done! It installs in /usr/local/mpich/.
LAM MPI: OS X is now officially supported! Download their binaries for OS X from their site. If you're looking for Fortran support as well, then use my binaries below. An initial release of XMPI for OS X has recently appeared. XMPI graphical user interface for running, debugging and visualizing MPI programs.
There is also UCLA's AppleSeed and MacMPI for Mac ONLY clusters that has been a big success. It indeed is a very easy way to build and run a cluster. In that sense it is very mac-like in spirit! Running distributed simulations is also very easy using their GUI based Pooch Application. They also provide useful tutorials and detailed documentation on writing and running parallel codes. Check those out at this link.
Source: LAM MPI,MPICH
Binaries: lam-bin.tar.gz, mpich-bin.tar.gz, updated Spring 2004.
Documentation: LAMMPI, MPICH

OpenMP(Shared Memory Multiprocessing):
These tools compile code optimized for dual processors based onOpenMP directives. SMP is much easier to learn, compared to MPI ..so this could be useful to some. Get the latest version (1.6) of Omni MPcompiler source and install. You should have no problems. Or get my binary distribution. To install, gunzip openmp-bin.tar.gz (if your browser didn't do so already) and then sudo tar -xvf openmp-bin.tar -C / and you are done! It installs OpenMP in /usr/local/openmp/. If you are interested in a tool that auto-parallelizes your code, click here.
Source: clickhere!
Binaries: openmp-bin.tar.gz, updated Spring 2004.
Documentation: clickhere!

PVM(Parallel Virtual Machine):
An alternate infrastructure to run a cluster of computers. PVM compiles on OS X with minimal modifications to the current source. Just get my source and binary distribution. To install, gunzip pvm3.tar.gz (if your browser didn't do so already) and then tar -xvf pvm3.tar and you are done! It installs PVM in your current directory. You'll need to set the environmental variable PVM_ROOTbefore you start to use it.
Source and Binaries: pvm3.tar.gz, updated Spring 2004.
Documentation: click here!

Computation Tools :: Octave

Octave:
OCTAVE: Octave is an open source, Matlab-like numerical analysissoftware package that is very popular among scientists andengineers. I compiled Octave 2.1.57 with octave-forge extensions using Apple's GCC and the g77 3.4 above. Download my binaries, gunzip octave-forge-bin.tar.gz (if your browser didn't do so already) and then sudo tar -xvf octave-forge-bin.tar -C / and you are done! It installs in /usr/local/. Note that this Octaveinstallation does NOT install gnuplot. I recommend installing AquaTerm and gnuplot on OS X, using this link. For the octave-forge extensions, remember to create a file called .octaverc with these lines in it and place it in your home directory.
OCTAVE-MPI: I was also able to compile the source for Octave-MPI! This version of Octave can run in parallel over a cluster ofmachines and/or multiple processors using MPICH MPI. For Octave-MPI, downloadmy binaries, gunzip octave-mpi.tar.gz (if your browser didn't do so already) and then sudo tar -xvf octave-mpi.tar -C / and you are done! It installs in/usr/local.
Source: Octave, Octave-MPI
Binaries: octave-forge-bin.tar.gz, octave-mpi.tar.gz, updated October 9th, 2004.
Documentation: clickhere!

SciLab:
Scilab is a scientific software package for numerical computation providing a powerful open computing environment for engineering and scientific applications. For OS X binaries, visit Jean-Phillippe's site on installation options.
Source: click here!
Binaries: click here!
Documentation: clickhere!

GDL:
Gnu Data Language (GDL) is an open source implementation of Interactive Data Language (IDL) which is an expensive commercial software package developed by Research Systems Inc. To find out more, visit the GDL website. To downloadmy binaries, gunzip gdl-bin.tar.gz (if your browser didn't do so already) and then sudo tar -xvf gdl-bin.tar -C / and you are done! It installs in/usr/local.
Source: GDL
Binaries: gdl-bin.tar.gz, updated December 21st, 2004.
Documentation: Refer to IDL's documentation.

Computation Tools :: Cactus, Globus, etc.

CactusCode (Numerical Computing Toolkit):
Cactus is an open source problem solving environment designed forscientists and engineers. Its modular structure ('thorns') easilyenables parallel computation across different architectures andcollaborative code development between different groups. It ismainly used for solving complicated PDE's. It highly portable, andhas some really remarkable features like observing and even'controlling' or 'steering' a running simulation using an ordinaryweb browser! Here is a link to a perpetual demo running inAlbert-Einstein-Institute, MPG, Germany: Cactus Demo. Check it out!Cactus compiles and runs great on OS X with GCC 3.3. Get the 'laststable release' source. Remember to use the make optionsARFLAGS='ruc' USE_RANLIB='yes' CC=gcc CXX=g++. The C and F77'thorns' compile with no trouble. For the Fortran 90 ones, you will need a commercial Fortran compiler, like the one from Absoft. The above MPI distributionsare fully compatible with Cactus! For some more info, check outCactusCode's recent OSX compatibility web page.
Source: clickhere!
Documentation: clickhere!

Note: If you are interested in other advanced PDE solvingenvironments, try PETSc from ANL. They now officially support Mac OS X!

For

Globus(Grid Computing Infrastructure):
The Globus project is about developing technology to build gridsfor high performance computation. Grids are environments thatenable software applications to integrate instruments, displays,computational and information resources that are managed by diverseorganizations in widespread locations. As an example, look at thiswebpage that has information on a Cactus based grid computation ofthe collision of two black holes. The OS X implementation of theGlobus framework, is based on Java, called Java Commodity Kit.There arevarious efforts underway, attempting to port the entire C based Globus Toolkit to OS X. Update! Finally, intructions for a complete port ofC-based Globus Toolkit 2.2.4 are available here. Get my binaries for Panther below. They'll install in /usr/local/globus in the usual way, sudo tar -xvf globus-2.4-bin.tar -C /.
A batch system for Globus, called the Grid Engine is an open source project sponsored by SUN. They have a functioning OS X port!
Source and Binaries: Java CoG, Grid Engine, Globus 2.4, updated Spring 2004.
Documentation: Java CoG, Grid Engine

Condor (HTC):
Condor is a software system developed at the University of Wisconsin that promises to expand computing capabilities through efficient capture of cycles on idle machines. The software, operating within an HTC (High Throughput Computing) rather than a traditional HPC (High Performance Computing) paradigm, organizes machinesinto clusters, called pools, or collections of clusters called flocks, thatcan exchange resources. Condor then hunts for idle workstations to run jobs.When the owner resumes computing, Condor migrates the job to another machine.The Condor Project now officially supports Mac OS X!
Binaries: click here!
Documentation: click here!

RNPL (Rapid Numerical PrototypingLanguage):
This is a great tool that takes as input details about the form ofan equation (usually a partial differential equation), and someparameters .. and then spits out a C or FORTRAN Code that solvesthe equation numerically using established iterative numericaltechniques. RNPL can also be used for producing skeleton programsand for converting existing programs. Download the source, compileand install. This source has been modified to compile with OS X. Orget my binary distribution. You probably want to install this in/usr/local .. to do so, gunzip rnpl-bin.tar.gz (if your browser didn't do so already) and then sudo tar -xvf rnpl-bin.tar -C / and you are done! You will need to use the F77 flag: -fno-second-underscore, for RNPL generated F77 codes to compile properly.
Source: rnpl.tar.gz
Binaries: rnpl-bin.tar.gz, updated 2003.
Documentation: click here!

Apple's Xgrid:
This is a new tool that Apple's ACG is developing that makes it incredibly easy to run a cluster of Macs by using Apple's technolgies like Rendezvous, etc. It can automatically seek available resources and execute your simulation appropriately. Learn more about it at their site. The current version does not support message passing, but I understand that they are working on it.
Xgrid Site: click here!

Computation Tools :: Other Miscellaneous

GreatInternet Mersenne Prime Search:
These are OS X clients for the internet based, distributedcomputing project, GIMPS. The clients are based on the GLUCAS and MLUCAS source codes.They benchmark quite well. The sources compile without any specialmodifications. The GLUCAS binaries for OS X are available from this link (including dual processor versions), while you canget the MLUCAS binary (compiled statically using IBM's XL compilers) from this link. Keep your Mac crunching!
Source and Binaries: MLUCAS, GLUCAS

The GRAVSIM Package:
GRAVSIM is a package that contains an ever evolving and hopefully growing set of gravitational N body solvers. These solvers attempt to track the motion of a set of bodies moving under the influence of gravity. They are used in many areas of astrophysical study including planetary motion, star cluster formation and stability and galactic formation, stability and interactions (i.e. colliding galaxies). This package is highly AltiVec and DP optimized!
Source and Binaries: click here!
Documentation: click here!

The FEYNMAN Java Framework:
The framework provides the infrastructure every scientist or engineer needs to develop simulations using the Java programming language. The framework eliminates numerous code writing tasks by allowing the developer to focus on the physical aspects of the simulation and the type of numerical algorithm being implemented. This is a new package and still under development, but has considerable promise.
Source and Binaries: click here!
Documentation: click here!

gcj 3.4 :
GNU Java recently compiled using source code from the GNU CVS servers.This contains java compiler (gcj) version 3.4.2 compiler. Download my binaries, and cd to the download folder. Then gunzip gcj-bin.tar.gz(if your browser didn't do so already) and sudo tar -xvf gcj-bin.tar -C /.It installs everything in /usr/local. You will also need to have Apple'sDeveloper Tools installed. They are included on a separate CD in the retailversion of OS X and also available as a free download fromApple's Developer Site.Please install the most current version of Developer Tools.
Note: You may need to ranlib some libs after you install. The compilerwill tell you which ones when you try to use it. In that case,simply do a sudo ranlib -s on each such library.
Binaries: gcj-bin.tar.gz (Jaguar/Panther), updated October 9th, 2004.
Documentation: click here!

PIXELGLOW Software's MACSTL:
This is a high performance, (mostly conforming) implementation ofthe Standard Template Library and associated numerics classes, optimizedfor the Altivec execution engine on the Power Macintosh G4, G5and other PowerPC machines. How fast? Just take a look here.More on this soon!
Binaries: click here!
Documentation: click here!

High Performance Computing For Mac Os X 10.8

Some Useful Commercial Tools:
Altair's PBS Pro: Workload management system.
BioTeam's iNquiry: Cluster configuration tool.
Dauger Research's Pooch: Running parallel simulations using a GUI based application.
Grid Iron's XLR8: An infrastructure to simply the task of parallelization.
Platform LSF: Clustering and workload management solution.
Scientific Paradise: Parallel and distributed computing environment.

Vectorizing and Parallelizing:
If you are interesting in harnessing the full power of a dual G4/G5,i.e. using AltiVecand both processors, click here.

If you need more, try these links: fink, gnu-darwin.org and osxgnu.org. Good Luck! By theway, if you are looking for a nice, easy to use, 2D and 3D,plotting package for OS X, try pro Fit. It works great. Theyhave a free trial version, that is not time-limited and isfull-featured. It just has some restrictions on the volume of datayou can make it handle. Even the full version is veryinexpensive!