Skip to content

Commit

Permalink
Merge pull request pyne#1097 from CNERG/pymoab_cleanup
Browse files Browse the repository at this point in the history
Update PyNE to use PyMOAB instead of PyTAPS with newest MOAB
  • Loading branch information
makeclean authored Mar 19, 2019
2 parents ee05c20 + 8f9f8a8 commit 2517952
Show file tree
Hide file tree
Showing 43 changed files with 3,594 additions and 2,342 deletions.
227 changes: 189 additions & 38 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,206 @@
version: 2
jobs:
build_py3:
docker:
- image: pyne/pyne_ubuntu_17.04:latest
version: 2.1
# Executors:
# Alias the environment on which run the different jobs
# i.e. in this case, docker image in which the jobs will be ran
executors:
py2:
docker:
- image: pyne/ubuntu_18.04_py2_pyne-deps:latest
py2_dagmc:
docker:
- image: pyne/ubuntu_18.04_py2_dagmc_pyne-deps:latest
py2_pymoab:
docker:
- image: pyne/ubuntu_18.04_py2_pymoab_pyne-deps:latest
py2_dagmc_pymoab:
docker:
- image: pyne/ubuntu_18.04_py2_dagmc_pymoab_pyne-deps:latest
py3:
docker:
- image: pyne/ubuntu_18.04_py3_pyne-deps:latest

working_directory: ~/repo

# Commands:
# Define macros that will be used to build and test PyNE.
# Save_container/pull_container:
# used to avoid repeting building PyNE for the testing jobs,
# it will only pull the saved container state...
#
# checkout_build:
# checkout the source code (usually the PR branch, and build
# PyNE, save the state of the container after the build
#
# run_test:
# load the PyNE build (built in checkout_build macro
# run the nose test
commands:
# Save Container change
save_container:
description: "Save container state"
parameters:
build:
type: string
default: "build"
steps:
- checkout
- run: echo $CIRCLE_SHA1 > .circle-sha
- save_cache:
key: v1-repo-<< parameters.build >>{{ checksum ".circle-sha" }}
paths:
- ~/

# Build!
- run:
name: Building PyNE
command: |
python3 setup.py install --user \
--moab $HOME/opt/moab --clean
# Pull Container change
pull_container:
description: "Load container state"
parameters:
build:
type: string
default: "build"
steps:
- run: echo $CIRCLE_SHA1 > .circle-sha
- restore_cache:
keys:
key: v1-repo-<< parameters.build >>{{ checksum ".circle-sha" }}

# Test!
- run:
name: Running PyNE Tests
command: |
cd ~/repo/tests
./travis-run-tests.sh python3
# Checkout and build PyNE
checkout_build:
description: "Checkout PyNE, build with the provided flags"
parameters:
flags:
type: string
default: ""
build:
type: string
default: "build"
steps:
- checkout
- run: python setup.py install --user --clean << parameters.flags >>
- run: cd ../ && nuc_data_make ;
- save_container:
build: << parameters.build >>

build_py2:
docker:
- image: pyne/pyne_ubuntu_16.04:latest
# Run PyNE test
run_test:
description: "Run tests"
parameters:
flags:
type: string
default: ""
build:
type: string
default: "build"
steps:
- pull_container:
build: << parameters.build >>
- run: |
cd ~/repo/tests
./travis-run-tests.sh << parameters.flags >>
# Jobs part:
# Define the different job that will be ran this separate building form
# testing for each configuration allowing to get more information out of the CI
jobs:
# Python 3 jobs
py3_build:
executor:
name: py3
working_directory: ~/repo

steps:
- checkout
- checkout_build:
flags: ""
build: "python3"
py3_test:
executor:
name: py3
working_directory: ~/repo
steps:
- run_test:
flags: "python3"
build: "python3"

# Build!
- run:
name: Building PyNE
command: |
python setup.py install --user \
--moab $HOME/opt/moab --clean

# Test!
- run:
name: Running PyNE Tests
command: |
cd ~/repo/tests
./travis-run-tests.sh python2
# Python 2 jobs
# without optional depedencies
py2_build:
executor:
name: py2
working_directory: ~/repo
steps:
- checkout_build:
flags: ""
build: "python2"
py2_test:
executor:
name: py2
working_directory: ~/repo
steps:
- run_test:
flags: "python2"
build: "python2"

# With PyMOAB
py2_pymoab_build:
executor:
name: py2_pymoab
working_directory: ~/repo
steps:
- checkout_build:
flags: "--moab $HOME/opt/moab"
build: "python2_pymoab"
py2_pymoab_test:
executor:
name: py2_pymoab
working_directory: ~/repo
steps:
- run_test:
flags: "python2"
build: "python2_pymoab"

# With PyMOAB & DAGMC
py2_dagmc_pymoab_build:
executor:
name: py2_dagmc_pymoab
working_directory: ~/repo
steps:
- checkout_build:
flags: "--moab $HOME/opt/moab --dagmc $HOME/opt/dagmc"
build: "python2_dagmc_pymoab"
py2_dagmc_pymoab_test:
executor:
name: py2_dagmc_pymoab
working_directory: ~/repo
steps:
- run_test:
flags: "python2"
build: "python2_dagmc_pymoab"

# Workflow part:
# This part defines the list of the jobs that will be ran and in which sequence.
# The goal was to avoid running advanced configuration if PyNE does not work
# with limited amount of dependencies.
workflows:
version: 2
build_and_test:
jobs:
- build_py2
- build_py3
- py3_build
- py3_test:
requires:
- py3_build

- py2_build
- py2_test:
requires:
- py2_build

- py2_pymoab_build:
requires:
- py2_build
- py2_pymoab_test:
requires:
- py2_pymoab_build

- py2_dagmc_pymoab_build:
requires:
- py2_pymoab_build
- py2_dagmc_pymoab_test:
requires:
- py2_dagmc_pymoab_build
51 changes: 36 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,44 @@ MESSAGE("-- HDF5 Library directories: ${HDF5_LIBRARY_DIRS}")
MESSAGE("-- HDF5 Libraries: ${HDF5_C_LIBRARIES}")


# Find MOAB library
if(NOT MOAB_ROOT)
set(MOAB_ROOT "${DEPS_ROOT_DIR}")
# Look for MOAB if requested
if(WITH_MOAB)
# user may have set a search path
if(NOT MOAB_ROOT)
set(MOAB_ROOT "${DEPS_ROOT_DIR}")
endif()
MESSAGE("-- MOAB Root: ${MOAB_ROOT}")
find_package(MOAB)
message("-- MOAB Found: ${MOAB_FOUND}")
if(${MOAB_FOUND})
include_directories(${MOAB_INCLUDE_DIRS})
get_filename_component(MOAB_LIBRARY_DIRS ${MOAB_LIBRARY} PATH)
if(APPLE)
link_directories(${MOAB_LIBRARY_DIRS}/lib)
else(APPLE)
link_directories(${MOAB_LIBRARY_DIRS})
endif(APPLE)
endif(${MOAB_FOUND})
endif()
MESSAGE("-- MOAB Root: ${MOAB_ROOT}")
find_package(MOAB)
message("-- MOAB Found: ${MOAB_FOUND}")
if(${MOAB_FOUND})
include_directories(${MOAB_INCLUDE_DIR})
get_filename_component(MOAB_LIBRARY_DIRS ${MOAB_LIBRARY} PATH)
if(APPLE)
link_directories(${MOAB_LIBRARY_DIRS}/lib)
else(APPLE)
link_directories(${MOAB_LIBRARY_DIRS})
endif(APPLE)
endif(${MOAB_FOUND})

# Look for DAGMC if requested
if(WITH_DAGMC)
if(${MOAB_FOUND})
# Always look for DAGMC library
if(NOT DAGMC_ROOT)
set(DAGMC_ROOT "${DEPS_ROOT_DIR}")
endif()
MESSAGE("-- DAGMC Root: ${DAGMC_ROOT}")
find_package(DAGMC)
message("-- DAGMC Found: ${DAGMC_FOUND}")
if(${DAGMC_FOUND})
include_directories(${DAGMC_INCLUDE_DIRS})
link_directories(${DAGMC_LIBRARY_DIRS})
endif(${DAGMC_FOUND})
else(${MOAB_FOUND})
message("-- DAGMC: Not searching because MOAB was not found.")
endif(${MOAB_FOUND})
endif()

# Find Python
find_package(PythonInterp REQUIRED)
Expand Down
31 changes: 31 additions & 0 deletions cmake/FindDAGMC.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# - Try to find DAGMC
# Once done this will define
#
# DAGMC_FOUND - system has DAGMC
# DAGMC_INCLUDE_DIRS - the DAGMC include directory
# DAGMC_LIBRARIES - Link these to use DAGMC
# DAGMC_DEFINITIONS - Compiler switches required for using DAGMC
#
# Copyright (c) 2010 Roman Putanowicz <[email protected]>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


message(STATUS ${DAGMC_ROOT})

find_path(DAGMC_CMAKE_CONFIG NAMES DAGMCConfig.cmake
HINTS ${DAGMC_ROOT}
PATH_SUFFIXES lib Lib cmake lib/cmake/
NO_DEFAULT_PATH)

message(STATUS "Found DAGMC in ${DAGMC_CMAKE_CONFIG}")

if( "DAGMC_CMAKE_CONFIG-NOTFOUND" STREQUAL "${DAGMC_CMAKE_CONFIG}")
set(DAGMC_FOUND FALSE)
else()
include(${DAGMC_CMAKE_CONFIG}/DAGMCConfig.cmake)
set(DAGMC_FOUND TRUE)
endif()
Loading

0 comments on commit 2517952

Please sign in to comment.