본문 바로가기

카테고리 없음

Installing Lapack On Mac Os X



Importantly, it is open source. After a great deal of time and trouble, I managed to get in working on my laptop which is running the Mac OS X operating system. 1 In the following, I detail my experiences in installing the IPOPT package. Succinctly put, the configure script did not work for IPOPT, so I had to install everything from scratch. This video explains how to install Basic Linear Algebra Subprograms, Linear Algebra Package, and Automatically Tuned Linear Algebra Software on Macbook (Mac. 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 Software available through apt-get ), or your system’s package manager. On Ubuntu, such libraries can be made available by installing liblapack-dev. Other Linux distributions typically also offer a way to install Blas and Lapack via its package manager. On Mac OS X, Ipopt's build system should pick up the Blas and Lapack from the Accelerate framework.

  1. Installing Lapack On Mac Os X 10.13
  2. Mac Os X El Capitan
  3. Lapack Download Windows
  4. Installing Lapack On Mac Os X 10.8

Windows¶

Here is a step-by-step guide to installing CVXPY on a Windows machine.

  1. If you have Python installed already, it’s probably a good idea to remove it first. (Sorry!)
  2. Download the latest version of Python(x,y).
  3. Install Python(x,y). When prompted to select optional components, make sure to check cvxopt and MinGW, as shown below.
  1. We need to set the default compiler as mingw32. Open Notepad and type the following, save the file at C:Python27Libdistutilsdistutils.cfg. (This is the default location. If you installed Python somewhere else, use the appropriate location.)
Mac os x el capitan
  1. Open Python(x,y) and launch the interactive console (highlighted button in the picture). This will bring up a console.
  1. From the console, run “pip install ecos” to install ecos.
  2. We need to install BLAS and LAPACK libraries, and make the scs package use them. Go here to download the win32 version of the dll and lib files of both BLAS and LAPACK. Put them under some directory, say C:blaslapack, as shown below.
Lapack download
  1. The system needs to know where to find the libraries. Right click on This PC (or My Computer), click Properties, Advanced system settings, then Environment Variables. Under the System variables list, find a variable named Path, and press Edit. Then, at the end of the list, put the address to the directory where you put the library files. All paths must be separated by semicolons.
  1. Download the SCS package as a zip file and unzip it.
  2. Browse to scs-master directory, and edit line 48 of the file scs.mk to “USE_LAPACK = 1”. Without this, scs won’t be able to solve SDPs.
  1. Browse to the src directory, and open the file cones.c. Edit lines 11 and 13 to look like the following.
  1. We have to change the numpy settings so that it knows where to find the libraries. Open C:Python27Libsite-packagesnumpydistutilssite.cfg and add the following lines to the end of the file:

You can remove what’s already in there, and replace the file with just the six lines above.

  1. Go back to the Python(x,y) terminal, and browse to the python directory of scs-master. From there, type “python setup.py build” to build scs. (If this step results in some error, remove the build directory and try again.) After the build is successful, run “python setup.py install” to install.
  2. After scs is installed, run “pip install cvxpy” to install CVXPY.
  3. Reboot your computer so that the path environment variable we set in step 8 takes effect.
  4. CVXPY should work now. You can use the Spyder IDE from the Python(x,y) home window. Click on the Spyder button to launch it. This IDE allows you to code, run, and view the console all in the same window. In order to check if the installation was successful, open a terminal, browse to C:Python27Libsite-packagescvxpy, and run “nosetests tests”. This runs all unit tests and reports any error found.

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.

Download

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

Lapack download windows

In the end, I had installed the following files:

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

Installing Lapack On Mac Os X 10.13

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.

Mac Os X El Capitan

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:

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).

Lapack Download Windows

Footnotes

Installing Lapack On Mac Os X 10.8

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.