.. _software_installation: ============================================================= Downloading and installing software for this class ============================================================= It is assumed that you are on a Unix-like machine (e.g Linux or Mac OS X). For some flavors of Unix it is easy to download and install some of the required packages using *apt-get* (see :ref:`apt-get`), or your system's package manager. If you must use a Windows PC, then you should download and install [VirtualBox]_ for Windows and then run the :ref:`vm` to provide a Linux environment. If you are using a Mac and want to install the necessary software, you also need to install `Xcode `_ developer tools, which includes necessary compilers and *make*, for example. Some of this software may already be available on your machine. The *which* command in Unix will tell you if a command is found on your *search path*, e.g.:: $ which mpif90 /opt/openmpi/bin/mpif90 tells me that when I type the mpif90 command it runs the program located in the file listed. Often executables are stored in directories named *bin*, which is short for *binary*, since they are often binary machine code files. If *which* doesn't print anything, or says something like:: $ which xyz /usr/bin/which: no xyz in (/usr/bin:/usr/local/bin) then the command cannot be found on the *search path*. So either the software is not installed or it has been installed in a directory that isn't searched by the shell program (see :ref:`shells`) when it tries to interpret your command. See :ref:`unix_path` for more information. Individual packages ------------------- .. _installing_gfortran: gfortran ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GNU fortran compiler (see :ref:`fortran`). You may already have this installed, try:: $ which gfortran See ``_ .. _installing_mpi: Open MPI ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Message Passing Interface software for parallel computing (see :ref:`mpi`). See ``_ Some instructions for installing from source on a Mac can be found at `here `_. .. _installing_lapack: LAPack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Linear Algebra Package, a standard library of highly optimized linear algebra subroutines. LAPack depends on the BLAS (Basic Linear Algebra Subroutines); it is distributed with a reference BLAS implementation, but more highly optimized BLAS are available for most systems. See ``_ ScaLAPACK is a parallel version of LAPack. See: ``_ .. _apt-get: Installing software with *apt-get* (Debian or Ubuntu Linux) ------------------------------------ On a recent Debian or Ubuntu Linux system, most of the software for this class can be installed through *apt-get*. To install, type the command:: $ sudo apt-get install PACKAGE where the appropriate PACKAGE to install comes from the list below. NOTE: You will only be able to do this on your own machine or a computer on which you have super user privileges to install software in the system files. (See :ref:`sudo`) You can also install these packages using a graphical package manager such as Synaptic instead of *apt-get*. ======================== ================= Software Package ======================== ================= gfortran gfortran OpenMPI libraries libopenmpi-dev OpenMPI executables openmpi-bin LAPack liblapack-dev ScaLaPACK libscalapack-mpi-dev ======================== ================= Many of these packages depend on other packages; answer "yes" when *apt-get* asks you if you want to download them. Some of them may already be installed on your system, in which case *apt-get* will tell you that they are already installed and do nothing. The script below can be used to install software in Ubuntu (or on a Ubuntu virtual machine running with VirtualBox: .. literalinclude:: install.sh For other versions of Linux, *apt-get* will not be available, and you will need to use the appropriate native package manager (*e.g.* rpm for Red Hat Linux). If you are using a new installation of Linux (say, on a virtual machine), you may want to install a text editor like gedit: *sudo apt-get install gedit*. Installing software on Mac OS X ------------------------------- As noted above, you will first need to install `Xcode `_ developer tools. Then, download the gfortran tarball, `gfortran-4.9-bin.tar.gz `_ (40 MB, Mavericks or Yosemite). For more information, or to get files for earlier OS X versions, got to ``_. The rest of the installation process can be done from the terminal (go to Applications --> Untilities --> Terminal to open a terminal). **Installing gfortran** First, install XCode command-line tools:: $ xcode-select --install Then, install/extract gfortran:: $ sudo tar -xvf gfortran-4.9-bin.tar.gz -C / Now, typing:: $ which gfortran should output:: /usr/local/bin/gfortran **Installing MPI**:: $ curl http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.5.tar.gz -o openmpi-1.8.5.tar.gz $ tar zxf openmpi-1.8.5.tar.gz $ cd openmpi-1.8.5 $ ./configure --prefix=/opt/openmpi 2>&1 | tee config.out [...lots of output...] $ make -j 4 2>&1 | tee make.out [...lots of output...] $ sudo make install 2>&1 | tee install.out [...lots of output...] $ export PATH=/opt/openmpi/bin:$PATH $ ompi_info [...see output from newly-installed Open MPI...] Now, typing:: $ which mpif90 should output:: /opt/openmpi/bin/mpif90 **Lapack and Scalapack** Lapack is included with OS X, but scalapack is not. For scalapack:: $ curl http://www.netlib.org/scalapack/scalapack-2.0.2.tgz -o scalapack-2.0.2.tgz $ tar zxf scalapack-2.0.2.tgz $ cd scalapack-2.0.2 $ cp SLmake.inc.example SLmake.inc $ make all The final step will take a few minutes, but at the end you should have the scalapack library file, *libscalapack.a* in the directory. Installing software for Windows ------------------------------- The author of these notes does not use windows, so please be aware that you may have to figure some things out for yourself. There are two options. The first, using cygwin, is easier, but will be mostly unsupported by the class instructor. The second is more complicated, but will give you a working linux virtual machine on your computer which you can use for many things outside of this class. **Cygwin** The gfortran binary can be downloaded `here `_. Openmpi packages can be found `here `_. To obtain lapack and scalapack libraries, see ``_. **Virtual Machine** The basic steps are: 1. Download and install virtualbox 2. Download XUbuntu (linux) operating system (~900mB) 3. Create a XUbuntu virtual machine within virtual box using the XUbuntu download 4. Run the XUbuntu vm, open a terminal, and install gfortran and openmpi using *apt-get* as described above: :ref:`apt-get`. Instructions for steps 1-3 can be found `here `_. Overall, you will need about 6 gB on your hard drive.