Skip to content

Commit

Permalink
Merge branch 'release-0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano committed Aug 19, 2015
2 parents 23279c8 + 3d1af11 commit 31c1f86
Show file tree
Hide file tree
Showing 546 changed files with 33,074 additions and 228,814 deletions.
34 changes: 28 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
# Compiler python objects
*.pyc

# OpenMC executable
src/openmc
# Python distribution
dist/
openmc.egg-info/

# Inputs generated from Python API
examples/python/**/*.xml

# emacs backups
*~
Expand All @@ -22,22 +26,40 @@ docs/build
docs/source/_images/*.pdf

# Source build
src/build
build

# build from src/utils/setup.py
src/utils/build

# xml-fortran reader
src/xml-fortran/xmlreader

# Modules built from XML templates
src/templates/*.f90

# Test results error file
results_error.dat

# Test build files
tests/build/
tests/ctestscript.run

# HDF5 files
*.h5

# Build files
src/CMakeCache.txt
src/CMakeFiles/
src/bin/
src/cmake_install.cmake
src/install_manifest.txt

# Data downloaded from NNDC
data/nndc

#Images
*.ppm

# PyCharm project configuration files
.idea
.idea/*

# IPython notebook checkpoints
.ipynb_checkpoints
54 changes: 54 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
sudo: false
language: python
python:
- "2.7"
- "3.4"
addons:
apt:
packages:
- gfortran
- g++
cache:
directories:
- $HOME/mpich_install
- $HOME/hdf5_install
- $HOME/phdf5_install

before_install:
# ============== Handle Python third-party packages ==============
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy h5py
- source activate test-environment

# Install GCC, MPICH, HDF5, PHDF5
- ./tests/travis_install.sh
- export FC=gfortran
- export MPI_DIR=$HOME/mpich_install
- export PHDF5_DIR=$HOME/phdf5_install
- export HDF5_DIR=$HOME/hdf5_install

install: true

before_script:
- cd data
- git clone --branch=master git://github.com/bhermanmit/nndc_xs nndc_xs
- cat nndc_xs/nndc.tar.gza* | tar xzvf -
- rm -rf nndc_xs
- export CROSS_SECTIONS=$PWD/nndc/cross_sections.xml
- cd ..

script:
- cd tests
- export OMP_NUM_THREADS=3
- ./travis.sh
- cd ..
164 changes: 59 additions & 105 deletions src/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@ endif()

option(openmp "Enable shared-memory parallelism with OpenMP" OFF)
option(profile "Compile with profiling flags" OFF)
option(petsc "Enable PETSC for use in CMFD acceleration" OFF)
option(debug "Compile with debug flags" OFF)
option(optimize "Turn on all compiler optimization flags" OFF)
option(verbose "Create verbose Makefiles" OFF)
option(coverage "Compile with flags" OFF)
option(coverage "Compile with coverage analysis flags" OFF)
option(mpif08 "Use Fortran 2008 MPI interface" OFF)

if (verbose)
set(CMAKE_VERBOSE_MAKEFILE on)
endif()

# Maximum number of nested coordinates levels
set(maxcoord 10 CACHE STRING "Maximum number of nested coordinate levels")
add_definitions(-DMAX_COORD=${maxcoord})

#===============================================================================
# MPI for distributed-memory parallelism / HDF5 for binary output
#===============================================================================

set(MPI_ENABLED FALSE)
set(HDF5_ENABLED FALSE)
if($ENV{FC} MATCHES "mpi.*")
if($ENV{FC} MATCHES "mpi[^/]*$")
message("-- Detected MPI wrapper: $ENV{FC}")
add_definitions(-DMPI)
set(MPI_ENABLED TRUE)
Expand All @@ -52,11 +56,24 @@ elseif($ENV{FC} MATCHES "h5pfc$")
set(HDF5_ENABLED TRUE)
endif()

# Check for Fortran 2008 MPI interface
if(MPI_ENABLED AND mpif08)
message("-- Using Fortran 2008 MPI bindings")
add_definitions(-DMPIF08)
endif()

#===============================================================================
# Set compile/link flags based on which compiler is being used
#===============================================================================

if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
# Make sure version is sufficient
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_LESS 4.6)
message(FATAL_ERROR "gfortran version must be 4.6 or higher")
endif()

# GNU Fortran compiler options
set(f90flags "-cpp -std=f2008 -fbacktrace")
if(debug)
Expand Down Expand Up @@ -116,7 +133,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")

elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "XL")
# IBM XL compiler options
set(f90flags "-WF,-DNO_F2008 -O2")
set(f90flags "-O2")
add_definitions(-DNO_F2008)
if(debug)
set(f90flags "-g -C -qflag=i:i -u")
set(ldflags "-g")
Expand All @@ -143,78 +161,6 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")

endif()

#===============================================================================
# PETSc for CMFD functionality
#===============================================================================

set (PETSC_ENABLED FALSE)
if(petsc)
set(PETSC_ENABLED TRUE)
find_package(PETSc REQUIRED HINTS $ENV{PETSC_DIR}/conf)
find_library(libpetsc petsc $ENV{PETSC_DIR}/lib)

# If libfblas wasn't found, search the PETSc lib directory
if(PETSC_FBLAS_LIB STREQUAL "PETSC_FBLAS_LIB-NOTFOUND")
find_library(PETSC_FBLAS_LIB fblas $ENV{PETSC_DIR}/lib)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_FBLAS_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_FBLAS_LIB})
endif()

# If libflapack wasn't found, search the PETSc lib directory
if(PETSC_FLAPACK_LIB STREQUAL "PETSC_FLAPACK_LIB-NOTFOUND")
find_library(PETSC_FLAPACK_LIB flapack $ENV{PETSC_DIR}/lib)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_FLAPACK_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_FLAPACK_LIB})
endif()

# If libdl wasn't found, search /usr/lib64
if(PETSC_DL_LIB STREQUAL "PETSC_DL_LIB-NOTFOUND")
find_library(PETSC_DL_LIB libdl.so /usr/lib64)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_DL_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_DL_LIB})
endif()

# If libm wasn't found, search /usr/lib64
if(PETSC_M_LIB STREQUAL "PETSC_M_LIB-NOTFOUND")
find_library(PETSC_M_LIB libm.so /usr/lib64)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_M_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_M_LIB})
endif()

# If libpthread wasn't found, search /usr/lib64
if(PETSC_PTHREAD_LIB STREQUAL "PETSC_PTHREAD_LIB-NOTFOUND")
find_library(PETSC_PTHREAD_LIB libpthread.so /usr/lib64)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_PTHREAD_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_PTHREAD_LIB})
endif()

# If librt wasn't found, search /usr/lib64
if(PETSC_RT_LIB STREQUAL "PETSC_RT_LIB-NOTFOUND")
find_library(PETSC_RT_LIB librt.so /usr/lib64)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_RT_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_RT_LIB})
endif()

# If libssl wasn't found, search /usr/lib64
if(PETSC_SSL_LIB STREQUAL "PETSC_SSL_LIB-NOTFOUND")
find_library(PETSC_SSL_LIB libssl.so /usr/lib64)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_SSL_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_SSL_LIB})
endif()

# If libcrypto wasn't found, search /usr/lib64
if(PETSC_CRYPTO_LIB STREQUAL "PETSC_CRYPTO_LIB-NOTFOUND")
find_library(PETSC_CRYPTO_LIB libcrypto.so /usr/lib64)
list(REMOVE_ITEM PETSC_PACKAGE_LIBS PETSC_CRYPTO_LIB-NOTFOUND)
list(INSERT PETSC_PACKAGE_LIBS 0 ${PETSC_CRYPTO_LIB})
endif()

message("-- Using PETSC: ${libpetsc}")
add_definitions(-DPETSC)
include_directories($ENV{PETSC_DIR}/include)
set(libraries "${libpetsc};${PETSC_PACKAGE_LIBS};${libraries}")
endif()

#===============================================================================
# git SHA1 hash
#===============================================================================
Expand All @@ -234,21 +180,29 @@ endif()

# Only initialize git submodules if it is not there. User is responsible
# for future updates of fox xml submodule.
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/xml/fox/.git)
message("-- Initializing/Updating FoX XML submodule...")
execute_process(COMMAND git submodule init
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
execute_process(COMMAND git submodule update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/xml/fox/.git)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
message("-- Cloning FoX XML git repository...")
execute_process(COMMAND git clone https://github.com/mit-crpg/fox.git src/xml/fox
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND git checkout bdc852f4f43d969fb1b179cba79295c1e095a455
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/xml/fox)
else()
message("-- Initializing/Updating FoX XML submodule...")
execute_process(COMMAND git submodule init
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND git submodule update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
endif()
add_subdirectory(xml/fox)
add_subdirectory(src/xml/fox)

#===============================================================================
# Build OpenMC executable
#===============================================================================

set(program "openmc")
file(GLOB source *.F90 xml/openmc_fox.F90)
file(GLOB source src/*.F90 src/xml/openmc_fox.F90)
add_executable(${program} ${source})
target_link_libraries(${program} ${libraries} fox_dom)
set_target_properties(${program} PROPERTIES
Expand All @@ -260,24 +214,16 @@ set_target_properties(${program} PROPERTIES
#===============================================================================

install(TARGETS ${program} RUNTIME DESTINATION bin)
install(PROGRAMS utils/statepoint_cmp.py
DESTINATION bin
RENAME statepoint_cmp)
install(PROGRAMS utils/statepoint_histogram.py
DESTINATION bin
RENAME statepoint_histogram)
install(PROGRAMS utils/statepoint_meshplot.py
DESTINATION bin
RENAME statepoint_meshplot)
install(FILES ../man/man1/openmc.1 DESTINATION share/man/man1)
install(FILES ../LICENSE DESTINATION "share/doc/${program}/copyright")
install(DIRECTORY src/relaxng DESTINATION share/openmc)
install(FILES man/man1/openmc.1 DESTINATION share/man/man1)
install(FILES LICENSE DESTINATION "share/doc/${program}/copyright")

find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
install(CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE} setup.py install
--prefix=${CMAKE_INSTALL_PREFIX}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/utils)")
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
endif()

#===============================================================================
Expand All @@ -288,15 +234,7 @@ endif()
include(CTest)

# Get a list of all the tests to run
file(GLOB_RECURSE TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_*.py)

# Check to see if PETSC is compiled for CMFD tests
if (NOT ${PETSC_ENABLED})
file(GLOB_RECURSE CMFD_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_cmfd_jfnk.py)
foreach(cmfd_test in ${CMFD_TESTS})
list(REMOVE_ITEM TESTS ${cmfd_test})
endforeach(cmfd_test)
endif(NOT ${PETSC_ENABLED})
file(GLOB_RECURSE TESTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_*.py)

# Check for MEM_CHECK and COVERAGE variables
if (DEFINED ENV{MEM_CHECK})
Expand Down Expand Up @@ -349,6 +287,22 @@ foreach(test ${TESTS})
WORKING_DIRECTORY ${TEST_PATH}
COMMAND $<TARGET_FILE:openmc> -p ${TEST_PATH})

elseif(${test} MATCHES "test_filter_distribcell")

# Add each case for distribcell tests
add_test(NAME ${TEST_NAME}_case-1
WORKING_DIRECTORY ${TEST_PATH}/case-1
COMMAND $<TARGET_FILE:openmc> ${TEST_PATH}/case-1)
add_test(NAME ${TEST_NAME}_case-2
WORKING_DIRECTORY ${TEST_PATH}/case-2
COMMAND $<TARGET_FILE:openmc> ${TEST_PATH}/case-2)
add_test(NAME ${TEST_NAME}_case-3
WORKING_DIRECTORY ${TEST_PATH}/case-3
COMMAND $<TARGET_FILE:openmc> ${TEST_PATH}/case-3)
add_test(NAME ${TEST_NAME}_case-4
WORKING_DIRECTORY ${TEST_PATH}/case-4
COMMAND $<TARGET_FILE:openmc> ${TEST_PATH}/case-4)

# If a restart test is encounted, need to run with -r and restart file(s)
elseif(${test} MATCHES "restart")

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 31c1f86

Please sign in to comment.