Breaking News

Install Lapack On Mac Os X

среда 08 апреля admin 56

You can use Homebrew to take care of this for you. Just install Homebrew and then: brew install openblas brew install lapack. But you don't. Mac OS X¶ On Mac OS X, we recommend our users install GCC 8 via Homebrew instead of relying on XCode command line tools installation and the default Apple Clang compilers. Too often we see our users on Mac with issues regarding missing standard includes like wchar.h and others. This is ultimately due to an improper install of XCode (see here.

NOTE: These instructions are for nmatrix 0.2.0 and later. For 0.1.0 and earlier releases, see the previous version of these instructions.

Standard installation procedure

This section covers the standard installation procedure. The rest of the document contains operating system specific information about prerequisites that must be installed before the standard installation.

To install the gem:

The plugin gems nmatrix-lapacke and nmatrix-atlas can be installed similarly.

For developers:

Run:

(For a parallel build you can run MAKE='make -j4' bundle exec rake compile.) Then, if you want to try out the code without installing:

or if you want to install:

The plugins nmatrix-lapacke and nmatrix-atlas can be built/installed/tested by running rake with the nmatrix_plugins=X option, e.g. rake compile nmatrix_plugins=all, rake install nmatrix_plugins=atlas, rake clean nmatrix_plugins=atlas,lapacke. Each of these commands apply to the nmatrix gem and any additional plugin gems specified. For example, rake spec nmatrix_plugins=atlas will test both the core nmatrix gem and the nmatrix-atlas gem.

Linux

Ubuntu/Debian

If you only want to install the main nmatrix gem you can skip directly to the standard installation procedure. If you want to install the nmatrix-atlas and/or nmatrix-lapacke gems, continue reading. These gems depend on external libraries which you must install before installing the gems.

For nmatrix-atlas, you must install the ATLAS library. The easiest way to do this is to use the version in the repository:

and then use the update-alternatives command to set ATLAS as your default provider of liblapack.so and libblas.so libraries:

This step prevents any other versions of LAPACK you might have installed from interfering with ATLAS. (On older Ubuntu versions (12.04), you should replace liblapack.so.3 with liblapack.so.3gf and libblas.so.3 with libblas.so.3gf.) After this you should be able to build nmatrix-atlas (and also nmatrix-lapacke).

nmatrix-lapacke is designed to work with any implementation of LAPACK and BLAS, rather than just working with ATLAS. If you limit yourself to packages in the repositories you have three choices: ATLAS (see above), the reference implementations of LAPACK and BLAS (sudo apt-get install liblapack-dev) and OpenBLAS (sudo apt-get install libopenblas-dev, doesn't work in Ubuntu <14.10). As above, you must use the update-alternatives command to select the correct variety of LAPACK and BLAS, before you attempt to install. The switch_lapack_ubuntu.rb script is designed to help with this (but has only been tested on Ubuntu 15.04).

Which flavor of LAPACK should you use? The reference implementation will be the slowest by far, but it is most likely to be already installed on your system as many other programs depend on it. ATLAS and OpenBLAS will be faster, and even faster if you build them from source. The OpenBLAS package in the repository (Ubuntu 15.04) is built with multi-threading enabled, while the ATLAS package is not, so this could make a big difference on multi-core machines.

It also should be possible to build nmatrix-lapacke with the Intel MKL (non-free, not available in repositories), but this is not officially supported. This might be helpful.

Archlinux

If you want to install the nmatrix-atlas gem, you should install the atlas-lapack package from AUR. If you use yaourt:

Or you can get the tarfile from [https://aur.archlinux.org/packages/atlas-lapack/ (https://aur.archlinux.org/packages/atlas-lapack/) and install it manually (untar it, makepkg, sudo pacman -U pkg.tar.xz).

A few notices

Installing atlas-lapack will require removing the packages blas, cblas and lapack, because they are integrated into atlas-lapack.

Mac OS X

You will need to install the Command Line Tools and Homebrew.

The one tricky step is that you will need a recent version of gcc. One easy way to install this is thru homebrew-versions (note that nmatrix doesn't yet support gcc >=5.0):

gcc will now be available at /usr/local/bin/gcc-4.8 and /usr/local/bin/g++-4.8. nmatrix will automatically detect these versions of gcc.If this newly installed version(gcc-4.8) is not detected, means you haven't added this line in your .bash_profile :

export PATH=/usr/local/bin:$PATH$

Add it in your .bash_profile and then run $ source .bash_profile. Another way is running this command in your terminal :

so now you can proceed with the standard installation procedure.

OS X comes pre-installed with liblapack.dylib and libblas.dylib, so you should be able to install the nmatrix-lapacke with no extra work.

Installing ATLAS

The version of ATLAS provided by Apple doesn't include CLAPACK, which means that many useful features will be missing from the nmatrix-atlas gem. For this is reason it is recommended to use nmatrix-lapacke instead of nmatrix-atlas. However if you really want to use nmatrix-atlas, here is one way to set up ATLAS:

First you will need an older version of XCode (5.1.1 or lower), available for download here. This is because newer version of XCode don't include ATLAS.

Then you will need to set up a few symlinks for the relevant files

After this it should be possible to build nmatrix-atlas

Notes

  • There is a bug with backports 3.6.0 and Ruby 2.1.x -- in close': Bad file descriptor @ fptr_finalize. The fix is to update the gem to 3.6.3+ via bundle update backports`.

This page describes the steps involved in compiling R-devel on a Mac operating system (macOS, formerly known as OS X), with an emphasis on non-standard build configurations that can significantly improve computing performance compared to a standard build.

Preliminaries

First we need to install some libraries and tools.

  • Get Xcode from the App Store. (The page should look something like this.) The latest version of Xcode should install the command line tools by default.
    • Open a terminal window—search spotlight for 'terminal' if you've never used terminal/bash before—and run:
    • You should see something similar to
  • Download and install XQuartz. (A computer restart might be required to complete the installation process.)
  • Download and install the Java SDK. (No need for the 'demos and samples' pack.)

Most of the following items are from the R-devel optional library list.

  • Unfortunately, Xcode does not include a Fortran compiler, which we will need. The simplest way to obtain an R-compatible version of gfortran is to open a terminal window and type:
  • The 'sudo' command will require your system password because we are placing files into areas that are password restricted (/usr/local).

    Note: that you are free to choose a more recent distribution of gfortran, which may be obtained via MacPorts or Homebrew.

  • We also need pkg-config, xz, and pcre:
  • Finally, for creating images, we need JPEG, PNG, and TIFF libraries:

Download and Unpack

Create a folder to work in. For example,

Then download and unpack the latest development version of R:

Alternatively, to obtain R via SVN:

Update when needed using

Basic Configure

Open the 'config.site' file in '~/Desktop/R/R-devel' and change the contents to the following (but see the next section for alternative configurations):

Open a terminal window and switch to the R-devel folder:

Set the pkg-config path as follows:

Alternative Configure: Optimization and OpenMP

It is possible to use an updated version of gfortran while also enabling architecture-specific optimizations such as Intel's AVX instructions.

If you've installed gcc7 using MacPorts, then create a symbolic link to the LLVM assembler in the default install directory:

Hardware Drivers in OS X are typically in the form of Kernel Extensions and the primary location is /System/Library/Extensions/ however they can also be within an Application Bundle. You can use kextunload to unload a Kernel extension. Tally t6045 driver for mac.

Then add -Wa,-q to the Fortran flags to use LLVM's (Clang integrated) assembler:

Note: Without the -Wa,-q option, -march=native instructions will result in an unknown symbol error.

To utilise OpenMP features we need to switch from Apple's version of LLVM. Install Clang v6.0 via MacPorts:

and modify the config.site file:

Note: If you receive a 'library not found for -lomp' error, add a symbolic link to libomp.dylib under /usr/local/lib:

Select a BLAS and Lapack Distribution

R includes a single-threaded BLAS and Lapack distribution, but we are free to choose an external, multithreaded library.

To link against the Accelerate framework (pre-installed with macOS) run

If you want to link against the OpenBLAS library run

Build and Install

To build R-devel, run make:

The build checks are run using:

Finally, we need to choose an install location for R-devel; I use /Users/${USER}/Desktop/R-devel; I recommend installing to somewhere that does not require sudo privileges.

Tool

Calling R-devel

For easy access to R-devel from a terminal window, add the following lines of code to your bash profile:

For example,

To run R-devel with sudo privileges, you need to add

To run R-devel from RStudio, use