Difference between revisions of "BBP on OS X Guide"

From SCECpedia
Jump to navigationJump to search
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
The Broadband Platform is compatible with Linux as well as OS X. However, due to some recent changes that Apple has made to their Xcode development tools, users on Mavericks (OS X 10.9) and Yosemite (OS X 10.10) will need to follow some additional steps to make the installation work.
+
The Broadband Platform is compatible with Linux as well as OS X. However, due to some recent changes that Apple has made to their Xcode development tools, users on Mavericks (OS X 10.9) and Yosemite (OS X 10.10) will need to follow some additional steps to make the installation work. There are several installation issues or limitations related to the BBP on a Mac. The primary target operating system for BBP is Linux. Mac's OS  is somewhat different environment, so installation on a Mac is a bit more complex.
  
== Installation on Mac Yosemite ==
+
The key Mac OS X-specific issues include:
The following section describes one developers experiences installing Broadband Platform on their Mac running Yosemite OS.
 
  
There are several installation issues or limitations related to the BBP on a Mac. The primary target operating system for BBP is Linux. Mac's OS  is somewhat different environment, so installation on a Mac is more complex.  
+
* Mac must have a full Python installation that includes NumPy, SciPy, matplotlib and other packages
 +
* Mac must have a gcc compiler environment, obtained through the XCODE software
 +
* Mac must have a gcc fortran compiler installed, not available in XCODE. If you follow the instructions given in the Mac Ports section below, it will required administrator account privileges because these will be required to install the fortran compiler in the default location.
 +
* Mac must have specialized Python language geographic project module pyproj installed
 +
* Currently, the SDSU BBToolbox software is not compatible with the Mac environment. The code will crash and as a result the SDSU method does not pass all Unit tests when compiled on a Mac. This is a known, Mac-specific issue. The SDSU method passes all tests in the target Linux environment. We will provide a resolution to this know limitation of the Mac-version of the BBP, as soon as one is available.
  
Key Mac Specific Issues Include:
+
== BBP 15.3.0 Installation on Mac OS X ==
* Mac must have a full Python installation that includes bumpy, scipy, matplotlib and other packages
 
* Mac must have a gcc compiler environment, obtained through Max XCODE software
 
* Mac must have a gcc fortran compiler installed, not available in XCODE. If you follow the instructions given in the first section, it will required administrator account privileges because these will be required to install the fortran compiler in the default location.
 
* Mac must have specialized python language geographic project module pyproj installed
 
* SDSU bbptoolbox is not validated for the Mac environment due to use of certain math libraries without Mac environment equivalents. As a result the SDSU does not pass all Unit tests when compiled on a Mac. This is a known, Mac-specific issue. The SDSU method passes all tests in the target Linux environment. We will provide a resolution to this know limitation of the Mac-version of the BBP, as soon as one is available.
 
  
The following section describes the list of steps that we went through to successfully install and run BBP v15.3 on a Macbook Pro with 16GB Ram and 10GB of disk space running OS X v10.10.3 (Yosemite).
+
This section describes the installation of the BBP 15.3.0 distribution on Mac OS X using a package management tool called Mac Ports. Mac Ports simplifies the installation process by automating several of the installation steps, but it will require administrator access unless you want to install it from the source (a few extra steps that we will not cover in this guide). If you prefer not to use Mac Ports in order to have greater flexibility in selecting the packages you would like to install, you can follow the directions provided by one developer who installed BBP 15.3.0 on his Mac OS X laptop without using Mac Ports. Details are provided in the [[BBP_on_OS_X_Guide_Without_Mac_Ports]] page.
  
# The default Mac python does not include all the required scientific python modules. For a well-integrated collection of scientific python modules for a Mac, we Installed anaconda python:
+
The steps below will guide you through the installation of Mac Ports and the necessary C/Fortran GNU compilers in addition to the Python packages required by the Broadband Platform. At the end of this section, we provide information about running the Unit and Acceptance Tests available on the Broadband Platform, along with some Mac OS X-specific details.
  
* http://docs.continuum.io/anaconda/install.html
+
=== OS X 10.9 Mavericks using MacPorts ===
  
# Evaluate the Mac command line environment. Bring up terminal, and run Env and Which python
+
Installing OS X on Mavericks is possible by following these steps:
  
scecadms-MBP:~ maechlin$ env
+
# Install Xcode from the Mac App Store
TERM_PROGRAM=Apple_Terminal
+
# Install the Xcode command line tools. To do this, in your Terminal window, please type:<br />$ sudo xcode-select --install<br />A dialog box will pop-up asking if you want to install the command line tools. Please choose "OK" on this box.
SHELL=/bin/bash
+
# Accept Xcode license by typing:<br />$ sudo xcodebuild -license<br />Scroll to the end and then type 'agree'.
TERM=xterm-256color
+
# Then install MacPorts from http://www.macports.org. MacPorts helps install the requirements to compile the Broadband Platform. The version of MacPorts we used was 2.3.3, please make sure you install the package for OS X 10.9 Mavericks
TERM_PROGRAM_VERSION=343.7
+
# Install GCC 4.8 using the following command:<br />$ sudo port install gcc48
TERM_SESSION_ID=177D5090-D37D-4EFD-998D-9290C7DD789B
+
#​​​​ Select the new compiler as the default compiler using the command:<br />$ sudo port select gcc mp-gcc48
USER=maechlin
+
# Install the PIP package manager for Python, using the command:<br />$ sudo easy_install pip
PATH=/Users/maechlin/anaconda/bin:/opt/local/gmt/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
+
# Install PyProj, using the command: <br />$ sudo pip install pyproj
PWD=/Users/maechlin
+
# Compile the Broadband Platform by going into the src directory and typing "make"
LANG=en_US.UTF-8
+
# Continue the Installation Instructions on [[Broadband_User_Guide_v15.3.0#User_Account_Setup|Broadband User Guide v15.3.0]]
XPC_FLAGS=0x0
 
XPC_SERVICE_NAME=0
 
SHLVL=1
 
HOME=/Users/maechlin
 
PYTHONPATH=/Users/maechlin/anaconda/lib
 
 
scecadms-MBP:~ maechlin$ which python
 
/Users/maechlin/anaconda/bin/python
 
  
#Download the minimum set of required BBP files (6 file required currently) from the BBP web site:
+
=== OS X 10.10 Yosemite using MacPorts ===
*bbp-dist-15.3.0.tar.gz
 
*bbp-dist-15.3.0.tar.gz.md5
 
*labasin-velocity-model-15.3.0.tar.gz
 
*labasin-velocity-model-15.3.0.tar.gz.md5
 
*northridge-validation-15.3.0.tar.gz
 
*northridge-validation-15.3.0.tar.gz.md5
 
  
# MD5 checksum is different on Mac than on Linux. Here's a way to do md5 sum check like this on a Mac:
+
In order to install the Broadband Platform on Yosemite, you must follow these steps:
scecadms-MBP:bbp_2015 maechlin$ cat bbp-dist-15.3.0.tar.gz.md5
 
24d88c5a22543409e89a22d64b451f85  bbp-dist-15.3.0.tar.gz
 
scecadms-MBP:bbp_2015 maechlin$ md5 bbp-dist-15.3.0.tar.gz
 
MD5 (bbp-dist-15.3.0.tar.gz) = 24d88c5a22543409e89a22d64b451f85
 
scecadms-MBP:bbp_2015 maechlin$ cat labasin-velocity-model-15.3.0.tar.gz.md5
 
f24dc01a6b1bf533b83067fbaa75c9d3  labasin-velocity-model-15.3.0.tar.gz
 
scecadms-MBP:bbp_2015 maechlin$ md5 labasin-velocity-model-15.3.0.tar.gz
 
MD5 (labasin-velocity-model-15.3.0.tar.gz) = f24dc01a6b1bf533b83067fbaa75c9d3
 
scecadms-MBP:bbp_2015 maechlin$ cat northridge-validation-15.3.0.tar.gz.md5
 
d4f396be3b29082841ddd4622f39cabb  northridge-validation-15.3.0.tar.gz
 
scecadms-MBP:bbp_2015 maechlin$ md5 northridge-validation-15.3.0.tar.gz
 
MD5 (northridge-validation-15.3.0.tar.gz) = d4f396be3b29082841ddd4622f39cab
 
  
# Check xcode on Mac. Yosemite. XCODE Version 6.3
+
# Install Xcode from the Mac App Store
 +
# Install the Xcode command line tools. To do this, in your Terminal window, please type:<br />$ sudo xcode-select --install<br />A dialog box will pop-up asking if you want to install the command line tools. Please choose "OK" on this box.
 +
# Accept Xcode license by typing:<br />$ sudo xcodebuild -license<br />Scroll to the end and then type 'agree'.
 +
# Then install MacPorts from http://www.macports.org. MacPorts helps install the requirements to compile the Broadband Platform. The version of MacPorts we used was 2.3.3, please make sure you select the package for OS X 10.10 Yosemite
 +
# Install GCC 4.9 using the following command: <br />$ sudo port install gcc49
 +
# Select the new compiler as the default compiler using the command:<br />$ sudo port select gcc mp-gcc49
 +
# Install the PIP package manager for Python, using the command:<br />$ sudo easy_install pip
 +
# Install PyProj, using the command: <br />$ sudo pip install pyproj
 +
# Compile the Broadband Platform by going into the src directory and typing "make"
 +
# Continue the Installation Instructions on [[Broadband_User_Guide_v15.3.0#User_Account_Setup|Broadband User Guide v15.3.0]]
  
# Check on Mac Python installation.Use anaconda because it includes many of the packages, such as numpy and matplotlib that are required by bbp.
+
=== Unit and Acceptance Tests for Mac OS X ===
  
Also, this version can be installed without root access, which I did in my Mac account User Maechlin
+
==== Running Unit Tests ====
  
https://store.continuum.io/cshop/anaconda/
+
In order to run the unit tests, users should go to the tests directory and type:
  
# At command line which gcc, gcc -v
+
$ ./UnitTests.py
  
scecadms-MBP:~ maechlin$ which gcc
+
The tests should begin and will take between 30-60 minutes to run, depending on your computer speed. At the end of each test, a "ok" should be printed if the test was
/usr/bin/gcc
+
successful. At the end, the program will print the number of tests that passed and the number of tests that failed. If a test has failed, first check that you have built the executables.You can rerun just the specific test that failed (test_<module>.py). If the test is still failing, also verify that you have the ref_data directory, since it contains the input and reference files. If you're looking for more information about the failure, you can consult the Unit Tests log file in $BBP_DATA_DIR/logs/unit_tests.log .  If you can't determine the reason for the failure, contact [mailto:software@scec.org support].
  
scecadms-MBP:~ maechlin$ gcc -v
+
Please note that one of the SDSU components, BBToolbox, does not pass its Unit Test when running on a Mac OS X system. This is a known limitation of the current BBP release. You will see a message similar to:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
 
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
 
Target: x86_64-apple-darwin14.3.0
 
Thread model: posix
 
 
# A BBP Issue is that XCODE does not installs a gcc fortran compiler. Details to install fortran
 
https://wiki.helsinki.fi/display/HUGG/Installing+the+GNU+compilers+on+Mac+OS+X
 
  
Download the gcc compiler for Yosemite to the downloads direction. Then run as sudo to install gcc and gfortran.
+
test_bbtoolbox (test_bbtoolbox.Test_BBToolbox) ... /bin/sh: line 1:  6027 Abort trap: 6
 +
/Users/maechlin/Documents/dev/bbp_2015/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
 +
/Users/maechlin/Documents/dev/bbp_2015/bbp_data/tmpdata/9642805/bbtoolbox_test_stat/parfilename_test_stat >>
 +
/Users/maechlin/Documents/dev/bbp_2015/bbp_data/logs/9642805/9642805.bbtoolbox_test_stat.log 2>&1
 +
ERROR
  
gunzip gcc-4.9-bin.tar.gz
+
This reduces the available number of ground motion methods that can be run on the Mac. On Linux, there are five methods available (GP, SDSU, UCSB, EXSIM, CSM). On a Mac, there are four methods available (GP, UCSB, EXSIM, CSM).
sudo tar xvf gcc-4.9-bin.tar -C /
 
  
This installs things in root, in /usr/local/…
+
After running the unit tests, users can proceed to the acceptance tests below.
  
# Create the data structure defined in the installation guide.
+
==== Running Acceptance Tests ====
  
/Users/Maechlin/Documents/dev/bbp_2015/15.3.0
+
To run the acceptance tests, users should:
../bbp_gf
 
../bbp_val
 
../bbp_data
 
  
# Now, in the BBP src directory, the make file builds without error.
+
$ ./AcceptTests.py
  
# At this stage, the compiled BBP code has been built. However, we have not confirmed that the python environment has been setup correctly.  
+
There will be one test for each method in the platform, for both the validation mode (historical events) and the scenario modes (hypotethical earthquakes). These tests will take somewhere between 2 and 3 hours to run, depending on how fast the computer is.
  
We can test the installation by running the Unit Tests. The ./UnitTests.py fails, unable to find pyproj
+
Since the acceptance tests can take a long time to run, you may wish to resume where you left off. This feature is supported automatically. If you do not wish to resume, delete the resume file in $BBP_DATA_DIR/logs/resume.txt. If there are any failure or errors while running the acceptance tests, consult the Troubleshooting section at the end of this user guide for known issues and their solutions.
  
# Install pyproj
+
When they're complete, the console will either print "OK" or how many tests failed. Acceptance test failures indicate that the modules are not integrated correctly. On Mac OS X, the SDSU codebase is not yet fully supported and will cause the 3 SDSU acceptance tests to fail. For the other tests, if a certain acceptance test fails, you can get more information by consulting the acceptance test logs in $BBP_DATA_DIR/logs/acceptance_test_logs/<test that failed>.log.  If you can't determine the reason for the failure, contact [mailto:software@scec.org support].
  
https://github.com/jswhit/pyproj
+
Here's the expected output when running on a Mac OS X, showing the three SDSU tests failing (which is expected for this release):
  
Go to pyproj, download, build and install
+
  -bash-4.1$ ./AcceptTests.py  
 
+
  Number of tests to run: 12
  python setup.py build
+
test_user-CSM (__main__.BBP2G_Acceptance_Tests) ... ok
  python setup.py install (with sudo if necessary).
+
test_user-EXSIM (__main__.BBP2G_Acceptance_Tests) ... ok
 
+
test_user-GP (__main__.BBP2G_Acceptance_Tests) ... ok
To test, run python -c "import pyproj; pyproj.test()"
+
test_user-SDSU (__main__.BBP2G_Acceptance_Tests) ... /
 
+
  /bin/sh: line 1: 56574 Abort trap: 6          /Users/fsilva/Work/svn/temp/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
#Now ./UnitTests.py gives deprecation warnings, and one of the UnitTests fails on a Mac. This reduces the available number of ground motion methods that can be run on the Mac. On Linux, there are five methods available (GP, SDSU, UCSB, EXSIM, CSM). On a Mac, there are four methods available (GP, UCSB, EXSIM, CSM).
+
/Users/fsilva/Work/svn/temp/bbp_sims/tmpdata/4047777/bbtoolbox_northridge_3_sta/parfilename_northridge_3_ sta >>
 
+
  /Users/fsilva/Work/svn/temp/bbp_sims/logs/4047777/4047777.bbtoolbox_northridge_3_sta.log 2>&
  scecadms-MBP:tests maechlin$ ./UnitTests.py
+
FAIL
  /Users/maechlin/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py:137: MatplotlibDeprecationWarning: The matplotlib.mpl module was deprecated in version 1.3. Use `import matplotlib as mpl` instead.
+
  test_user-UCSB (__main__.BBP2G_Acceptance_Tests) ... ok
  warnings.warn(message, mplDeprecation, stacklevel=1)
+
test_valid-northridge-CSM (__main__.BBP2G_Acceptance_Tests) ... ok
  test_runprog (test_bband_utils.Test_bband_utils) ... ok
+
  test_valid-northridge-EXSIM (__main__.BBP2G_Acceptance_Tests) ... ok
  test_runprog2 (test_bband_utils.Test_bband_utils) ... ok
+
  test_valid-northridge-GP (__main__.BBP2G_Acceptance_Tests) ... ok
  test_runprog3 (test_bband_utils.Test_bband_utils) ... ok
+
  test_valid-northridge-GP_seis (__main__.BBP2G_Acceptance_Tests) ... ok
  test_execute_platform_bbp (test_python_code.Test_PythonCode) ... /Users/maechlin/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py:137:  MatplotlibDeprecationWarning: The matplotlib.mpl module was deprecated in version 1.3. Use `import matplotlib as mpl` instead.
+
  test_valid-northridge-SDSU (__main__.BBP2G_Acceptance_Tests) ...
  warnings.warn(message, mplDeprecation, stacklevel=1)
+
/bin/sh: line 1: 58755 Abort trap: 6          /Users/fsilva/Work/svn/temp/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
  ok
+
/Users/fsilva/Work/svn/temp/bbp_sims/tmpdata/4049707/bbtoolbox_northridge_3_sta/parfilename_northridge_3_sta >>
 
+
/Users/fsilva/Work/svn/temp/bbp_sims/logs/4049707/4049707.bbtoolbox_northridge_3_sta.log 2>&1
test_bbtoolbox (test_bbtoolbox.Test_BBToolbox) ... /bin/sh: line 1: 6027 Abort trap: 6          /Users/maechlin/Documents/dev/bbp_2015/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe < /Users/maechlin/Documents/dev/bbp_2015/bbp_data/tmpdata/9642805/bbtoolbox_test_stat/parfilename_test_stat >> /Users/maechlin/Documents/dev/bbp_2015/bbp_data/logs/9642805/9642805.bbtoolbox_test_stat.log 2>&1
+
  FAIL
 
+
test_valid-northridge-SDSU_seis (__main__.BBP2G_Acceptance_Tests) ...
The BBPToolbox does not pass all 26 UnitTests, but this is a known limitation of the BBP installation. At the end of the tests, the BBP will print the following message:
+
/bin/sh: line 1: 58788 Abort trap: 6          /Users/fsilva/Work/svn/temp/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
 
+
/Users/fsilva/Work/svn/temp/bbp_sims/tmpdata/4050735/bbtoolbox_northridge_3_sta/parfilename_northridge_3_sta >>  
ERROR
+
/Users/fsilva/Work/svn/temp/bbp_sims/logs/4050735/4050735.bbtoolbox_northridge_3_sta.log 2>&1
test_amp_fac (test_amp_fac.Test_Amp_Fac) ... ok
+
FAIL
Ran 26 tests in 1171.378s
+
test_valid-northridge-UCSB (__main__.BBP2G_Acceptance_Tests) ... ok
 
+
FAILED (errors=1)
+
======================================================================
 
+
FAIL: test_user-SDSU (__main__.BBP2G_Acceptance_Tests)
Once your Mac can successfully complete 25 of the 26 Unit tests, you are ready to run the acceptance tests. Now, you can refer to the material in the main BBP Users Guide, describing how to run the acceptance tests to confirm that for of the methods pass their acceptance tests. Once these methods pass their acceptance tests, they can be used for engineering and research purposes. These tests take overnight to run. At the end, however, you should receive a message like this:
+
----------------------------------------------------------------------
 
+
Traceback (most recent call last):
  TBD
+
  File "./AcceptTests.py", line 111, in permutation_test
 
+
    self.failIf(rc != 0, "Acceptance test failed to execute")
At this point, the BBP is ready for use on the Mac. We do not recommend us of the SDSU method on a Mac. However, the other methods work as expected on a Mac, produce results equivalent to a Linux installation.
+
  AssertionError: Acceptance test failed to execute
 
+
== Mac Port Installation Approach ==
+
======================================================================
A software tool called Mac Ports is designed help install software on a Mac. The following steps below describe alternative way to install the BBP on a Mac using Mac Ports. Mac Ports helps you install all the needed Python and GNU packages on your Mac. However, you only need one of the methods, the one above, or one described below using Mac Ports. You do not need both.
+
FAIL: test_valid-northridge-SDSU (__main__.BBP2G_Acceptance_Tests)
 
+
----------------------------------------------------------------------
== OS X 10.9 Mavericks using MacPorts ==
+
Traceback (most recent call last):
 
+
  File "./AcceptTests.py", line 111, in permutation_test
Installing OS X on Mavericks is possible by following these steps:
+
    self.failIf(rc != 0, "Acceptance test failed to execute")
 
+
AssertionError: Acceptance test failed to execute
1) Install Xcode from the Mac App Store.<br />
+
2) Install the Xcode command line tools. To do this, in your Terminal window, please type in <span style="font-family: Courier, serif">sudo xcode-select --install</span>. A dialog box will pop-up asking if you want to install the command line tools. Please choose "OK" on this box.<br />
+
======================================================================
3) Then install MacPorts from http://www.macports.org. MacPorts helps install the requirements to compile the Broadband Platform. The version of MacPorts we used was 2.3.3. Please note that to install MacPorts you must agree to the Xcode license terms. After running the MacPorts installer, please go to your Terminal and run the command <span style="font-family: Courier, serif">sudo xcodebuild -license</span>.<br />
+
FAIL: test_valid-northridge-SDSU_seis (__main__.BBP2G_Acceptance_Tests)
4) Install GCC 4.8 using the following command: <span style="font-family: Courier, serif">sudo port install gcc48</span><br />
+
----------------------------------------------------------------------
​​​​5) Select the new compiler as the default compiler using the command: <span style="font-family: Courier, serif">sudo port select gcc mp-gcc48</span><br />
+
Traceback (most recent call last):
6) Install the PIP package manager for Python, using the command: <span style="font-family: Courier, serif">sudo easy_install pip</span><br />
+
  File "./AcceptTests.py", line 111, in permutation_test
7) Install PyProj, using the command: <span style="font-family: Courier, serif">sudo pip install pyproj</span><br />
+
    self.failIf(rc != 0, "Acceptance test failed to execute")
8) Compile the Broadband Platform by going into the src directory and typing "make"<br />
+
AssertionError: Acceptance test failed to execute
 
+
== OS X 10.10 Yosemite using MacPorts ==
+
----------------------------------------------------------------------
 
+
Ran 12 tests in 3647.739s
In order to install the Broadband Platform on Yosemite, you must follow these steps:
+
 +
FAILED (failures=3)
  
1) Install Xcode from the Mac App Store.<br />
+
== Potential Additional Steps ==
2) Install the Xcode command line tools. To do this, in your Terminal window, please type in <span style="font-family: Courier, serif">sudo xcode-select --install</span>. A dialog box will pop-up asking if you want to install the command line tools. Please choose "OK" on this box.<br />
 
3) Then install MacPorts from http://www.macports.org. MacPorts helps install the requirements to compile the Broadband Platform. The version of MacPorts we used was 2.3.3. Please note that to install MacPorts you must agree to the Xcode license terms. After running the MacPorts installer, please go to your Terminal and run the command <span style="font-family: Courier, serif">sudo xcodebuild -license</span>.<br />
 
4) Install GCC 4.9 using the following command: <span style="font-family: Courier, serif">sudo port install gcc49</span><br />
 
​​​​5) Select the new compiler as the default compiler using the command: <span style="font-family: Courier, serif">sudo port select gcc mp-gcc49</span><br />
 
6) Install the PIP package manager for Python, using the command: <span style="font-family: Courier, serif">sudo easy_install pip</span><br />
 
7) Install PyProj, using the command: <span style="font-family: Courier, serif">sudo pip install pyproj</span><br />
 
8) Compile the Broadband Platform by going into the src directory and typing "make"<br />
 
  
== Other Required Steps ==
+
One developer needed to run the following commands to make the Mac installation work. These are not needed on a clean installation but could be required to repair or upgrade an existing Mac OS X setup.
One developer needed to run these commands to make the Mac installation work:
 
  
export PYTHONPATH=/Library/Python/2.7/site-packages/:$PYTHONPATH
+
* export PYTHONPATH=/Library/Python/2.7/site-packages/:$PYTHONPATH
sudo pip install scipy --upgrade
+
* sudo pip install scipy --upgrade
sudo pip install numpy --upgrade
+
* sudo pip install numpy --upgrade
sudo pip install matplotlib --upgrade
+
* sudo pip install matplotlib --upgrade
  
 
== Related Entries ==
 
== Related Entries ==
 
*[[Broadband Platform]]
 
*[[Broadband Platform]]
 +
*[[Broadband User Guide v15.3.0]]
 
*[[CME Project]]
 
*[[CME Project]]

Latest revision as of 16:59, 12 June 2015

Introduction

The Broadband Platform is compatible with Linux as well as OS X. However, due to some recent changes that Apple has made to their Xcode development tools, users on Mavericks (OS X 10.9) and Yosemite (OS X 10.10) will need to follow some additional steps to make the installation work. There are several installation issues or limitations related to the BBP on a Mac. The primary target operating system for BBP is Linux. Mac's OS is somewhat different environment, so installation on a Mac is a bit more complex.

The key Mac OS X-specific issues include:

  • Mac must have a full Python installation that includes NumPy, SciPy, matplotlib and other packages
  • Mac must have a gcc compiler environment, obtained through the XCODE software
  • Mac must have a gcc fortran compiler installed, not available in XCODE. If you follow the instructions given in the Mac Ports section below, it will required administrator account privileges because these will be required to install the fortran compiler in the default location.
  • Mac must have specialized Python language geographic project module pyproj installed
  • Currently, the SDSU BBToolbox software is not compatible with the Mac environment. The code will crash and as a result the SDSU method does not pass all Unit tests when compiled on a Mac. This is a known, Mac-specific issue. The SDSU method passes all tests in the target Linux environment. We will provide a resolution to this know limitation of the Mac-version of the BBP, as soon as one is available.

BBP 15.3.0 Installation on Mac OS X

This section describes the installation of the BBP 15.3.0 distribution on Mac OS X using a package management tool called Mac Ports. Mac Ports simplifies the installation process by automating several of the installation steps, but it will require administrator access unless you want to install it from the source (a few extra steps that we will not cover in this guide). If you prefer not to use Mac Ports in order to have greater flexibility in selecting the packages you would like to install, you can follow the directions provided by one developer who installed BBP 15.3.0 on his Mac OS X laptop without using Mac Ports. Details are provided in the BBP_on_OS_X_Guide_Without_Mac_Ports page.

The steps below will guide you through the installation of Mac Ports and the necessary C/Fortran GNU compilers in addition to the Python packages required by the Broadband Platform. At the end of this section, we provide information about running the Unit and Acceptance Tests available on the Broadband Platform, along with some Mac OS X-specific details.

OS X 10.9 Mavericks using MacPorts

Installing OS X on Mavericks is possible by following these steps:

  1. Install Xcode from the Mac App Store
  2. Install the Xcode command line tools. To do this, in your Terminal window, please type:
    $ sudo xcode-select --install
    A dialog box will pop-up asking if you want to install the command line tools. Please choose "OK" on this box.
  3. Accept Xcode license by typing:
    $ sudo xcodebuild -license
    Scroll to the end and then type 'agree'.
  4. Then install MacPorts from http://www.macports.org. MacPorts helps install the requirements to compile the Broadband Platform. The version of MacPorts we used was 2.3.3, please make sure you install the package for OS X 10.9 Mavericks
  5. Install GCC 4.8 using the following command:
    $ sudo port install gcc48
  6. ​​​​ Select the new compiler as the default compiler using the command:
    $ sudo port select gcc mp-gcc48
  7. Install the PIP package manager for Python, using the command:
    $ sudo easy_install pip
  8. Install PyProj, using the command:
    $ sudo pip install pyproj
  9. Compile the Broadband Platform by going into the src directory and typing "make"
  10. Continue the Installation Instructions on Broadband User Guide v15.3.0

OS X 10.10 Yosemite using MacPorts

In order to install the Broadband Platform on Yosemite, you must follow these steps:

  1. Install Xcode from the Mac App Store
  2. Install the Xcode command line tools. To do this, in your Terminal window, please type:
    $ sudo xcode-select --install
    A dialog box will pop-up asking if you want to install the command line tools. Please choose "OK" on this box.
  3. Accept Xcode license by typing:
    $ sudo xcodebuild -license
    Scroll to the end and then type 'agree'.
  4. Then install MacPorts from http://www.macports.org. MacPorts helps install the requirements to compile the Broadband Platform. The version of MacPorts we used was 2.3.3, please make sure you select the package for OS X 10.10 Yosemite
  5. Install GCC 4.9 using the following command:
    $ sudo port install gcc49
  6. Select the new compiler as the default compiler using the command:
    $ sudo port select gcc mp-gcc49
  7. Install the PIP package manager for Python, using the command:
    $ sudo easy_install pip
  8. Install PyProj, using the command:
    $ sudo pip install pyproj
  9. Compile the Broadband Platform by going into the src directory and typing "make"
  10. Continue the Installation Instructions on Broadband User Guide v15.3.0

Unit and Acceptance Tests for Mac OS X

Running Unit Tests

In order to run the unit tests, users should go to the tests directory and type:

$ ./UnitTests.py

The tests should begin and will take between 30-60 minutes to run, depending on your computer speed. At the end of each test, a "ok" should be printed if the test was successful. At the end, the program will print the number of tests that passed and the number of tests that failed. If a test has failed, first check that you have built the executables.You can rerun just the specific test that failed (test_<module>.py). If the test is still failing, also verify that you have the ref_data directory, since it contains the input and reference files. If you're looking for more information about the failure, you can consult the Unit Tests log file in $BBP_DATA_DIR/logs/unit_tests.log . If you can't determine the reason for the failure, contact support.

Please note that one of the SDSU components, BBToolbox, does not pass its Unit Test when running on a Mac OS X system. This is a known limitation of the current BBP release. You will see a message similar to:

test_bbtoolbox (test_bbtoolbox.Test_BBToolbox) ... /bin/sh: line 1:  6027 Abort trap: 6
/Users/maechlin/Documents/dev/bbp_2015/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
/Users/maechlin/Documents/dev/bbp_2015/bbp_data/tmpdata/9642805/bbtoolbox_test_stat/parfilename_test_stat >>
/Users/maechlin/Documents/dev/bbp_2015/bbp_data/logs/9642805/9642805.bbtoolbox_test_stat.log 2>&1
ERROR

This reduces the available number of ground motion methods that can be run on the Mac. On Linux, there are five methods available (GP, SDSU, UCSB, EXSIM, CSM). On a Mac, there are four methods available (GP, UCSB, EXSIM, CSM).

After running the unit tests, users can proceed to the acceptance tests below.

Running Acceptance Tests

To run the acceptance tests, users should:

$ ./AcceptTests.py

There will be one test for each method in the platform, for both the validation mode (historical events) and the scenario modes (hypotethical earthquakes). These tests will take somewhere between 2 and 3 hours to run, depending on how fast the computer is.

Since the acceptance tests can take a long time to run, you may wish to resume where you left off. This feature is supported automatically. If you do not wish to resume, delete the resume file in $BBP_DATA_DIR/logs/resume.txt. If there are any failure or errors while running the acceptance tests, consult the Troubleshooting section at the end of this user guide for known issues and their solutions.

When they're complete, the console will either print "OK" or how many tests failed. Acceptance test failures indicate that the modules are not integrated correctly. On Mac OS X, the SDSU codebase is not yet fully supported and will cause the 3 SDSU acceptance tests to fail. For the other tests, if a certain acceptance test fails, you can get more information by consulting the acceptance test logs in $BBP_DATA_DIR/logs/acceptance_test_logs/<test that failed>.log. If you can't determine the reason for the failure, contact support.

Here's the expected output when running on a Mac OS X, showing the three SDSU tests failing (which is expected for this release):

-bash-4.1$ ./AcceptTests.py 
Number of tests to run: 12
test_user-CSM (__main__.BBP2G_Acceptance_Tests) ... ok
test_user-EXSIM (__main__.BBP2G_Acceptance_Tests) ... ok
test_user-GP (__main__.BBP2G_Acceptance_Tests) ... ok
test_user-SDSU (__main__.BBP2G_Acceptance_Tests) ... /
/bin/sh: line 1: 56574 Abort trap: 6           /Users/fsilva/Work/svn/temp/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
/Users/fsilva/Work/svn/temp/bbp_sims/tmpdata/4047777/bbtoolbox_northridge_3_sta/parfilename_northridge_3_ sta >>
/Users/fsilva/Work/svn/temp/bbp_sims/logs/4047777/4047777.bbtoolbox_northridge_3_sta.log 2>&
FAIL
test_user-UCSB (__main__.BBP2G_Acceptance_Tests) ... ok
test_valid-northridge-CSM (__main__.BBP2G_Acceptance_Tests) ... ok
test_valid-northridge-EXSIM (__main__.BBP2G_Acceptance_Tests) ... ok
test_valid-northridge-GP (__main__.BBP2G_Acceptance_Tests) ... ok
test_valid-northridge-GP_seis (__main__.BBP2G_Acceptance_Tests) ... ok
test_valid-northridge-SDSU (__main__.BBP2G_Acceptance_Tests) ...
/bin/sh: line 1: 58755 Abort trap: 6           /Users/fsilva/Work/svn/temp/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe < 
/Users/fsilva/Work/svn/temp/bbp_sims/tmpdata/4049707/bbtoolbox_northridge_3_sta/parfilename_northridge_3_sta >> 
/Users/fsilva/Work/svn/temp/bbp_sims/logs/4049707/4049707.bbtoolbox_northridge_3_sta.log 2>&1
FAIL
test_valid-northridge-SDSU_seis (__main__.BBP2G_Acceptance_Tests) ...
/bin/sh: line 1: 58788 Abort trap: 6           /Users/fsilva/Work/svn/temp/15.3.0/bbp/src/sdsu/bin/BBtoolbox.exe <
/Users/fsilva/Work/svn/temp/bbp_sims/tmpdata/4050735/bbtoolbox_northridge_3_sta/parfilename_northridge_3_sta >> 
/Users/fsilva/Work/svn/temp/bbp_sims/logs/4050735/4050735.bbtoolbox_northridge_3_sta.log 2>&1
FAIL
test_valid-northridge-UCSB (__main__.BBP2G_Acceptance_Tests) ... ok

======================================================================
FAIL: test_user-SDSU (__main__.BBP2G_Acceptance_Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./AcceptTests.py", line 111, in permutation_test
    self.failIf(rc != 0, "Acceptance test failed to execute")
AssertionError: Acceptance test failed to execute

======================================================================
FAIL: test_valid-northridge-SDSU (__main__.BBP2G_Acceptance_Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "./AcceptTests.py", line 111, in permutation_test
   self.failIf(rc != 0, "Acceptance test failed to execute")
AssertionError: Acceptance test failed to execute

======================================================================
FAIL: test_valid-northridge-SDSU_seis (__main__.BBP2G_Acceptance_Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./AcceptTests.py", line 111, in permutation_test
    self.failIf(rc != 0, "Acceptance test failed to execute")
AssertionError: Acceptance test failed to execute

----------------------------------------------------------------------
Ran 12 tests in 3647.739s

FAILED (failures=3)

Potential Additional Steps

One developer needed to run the following commands to make the Mac installation work. These are not needed on a clean installation but could be required to repair or upgrade an existing Mac OS X setup.

  • export PYTHONPATH=/Library/Python/2.7/site-packages/:$PYTHONPATH
  • sudo pip install scipy --upgrade
  • sudo pip install numpy --upgrade
  • sudo pip install matplotlib --upgrade

Related Entries