BBP on OS X Guide Without Mac Ports

From SCECpedia
Jump to navigationJump to search

This page describes an installation method does not require the use of Mac Ports. Once you follow the steps below, you can follow the link at the end of the page to go to the main BBP 15.3.0 Wiki User's Guide and continue the set up from there. Also, at the end of this page, you can find information about running the Unit and Acceptance Tests available on the Platform, along with a few Mac OS X-specific details.

Installation on Mac Yosemite

The following section describes one developers experiences installing Broadband Platform on their Mac running Yosemite OS. Here is 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).

  1. 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:
  2. Evaluate the Mac command line environment. Bring up terminal, and run "env" and "which python":
    $ env
    TERM_PROGRAM=Apple_Terminal
    SHELL=/bin/bash
    TERM=xterm-256color
    TERM_PROGRAM_VERSION=343.7
    TERM_SESSION_ID=177D5090-D37D-4EFD-998D-9290C7DD789B
    USER=maechlin
    PATH=/Users/maechlin/anaconda/bin:/opt/local/gmt/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
    PWD=/Users/maechlin
    LANG=en_US.UTF-8
    XPC_FLAGS=0x0
    XPC_SERVICE_NAME=0
    SHLVL=1
    HOME=/Users/maechlin
    PYTHONPATH=/Users/maechlin/anaconda/lib
    
    and
    
    $ which python
    /Users/maechlin/anaconda/bin/python
    
  3. Check Xcode on Mac Yosemite, the latest version is Xcode Version 6.3
  4. Update the Mac Python installation. Use Anaconda because it includes many of the packages, such as numpy and matplotlib that are required by the BBP. Also, this version can be installed without root access, which I did in my Mac account user Maechlin
  5. At command line which gcc, gcc -v
    $ which gcc
    /usr/bin/gcc
    
    $ gcc -v
    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
    
  6. A BBP Issue is that Xcode does not install a gcc fortran compiler. Details to install fortran: Download the gcc compiler for Yosemite to the downloads direction. Then run as sudo to install gcc and gfortran.
    gunzip gcc-4.9-bin.tar.gz
    sudo tar xvf gcc-4.9-bin.tar -C /
    
    This installs things in root, in /usr/local/…
  7. Install pyproj Go to pyproj, download, build and install
    python setup.py build 
    python setup.py install (with sudo if necessary).
    

    To test, run python -c "import pyproj; pyproj.test()"

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