Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Jun 23, 2020
2 parents ca3d8c6 + f542be5 commit a2c778b
Show file tree
Hide file tree
Showing 189 changed files with 14,149 additions and 9,639 deletions.
19 changes: 10 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@
*.lib

# Executables
/src/programs/gsa/gsa
/src/programs/pest++/pestpp
/src/programs/pestpp-ies/pestpp-ies
/src/programs/pestpp-opt/pestpp-opt
/src/programs/pestpp-pso/psopp
/src/utilities/ascii2pbin/ascii2pbin
/src/utilities/pbin2ascii/pbin2ascii
/src/utilities/pbin_dump/pbin_dump
/src/utilities/sweep/sweep
/bin

# User files
/src/local.mak
*.suo
*.u2d

# Makefile object
/src/libs/build-stamp
/*build*

/morris_meth/ipch
/morris_meth/Debug
Expand Down Expand Up @@ -61,3 +56,9 @@ pest++/run_manager_fortran_test/fortran_test
pest++/sweep/sweep

.DS_Store
/src/.vs
/src/libs/common/ix64/Release
*.user
*.u2d
*.log
/src/UpgradeLog.htm
113 changes: 60 additions & 53 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,85 @@
sudo: false
dist: trusty
language: python
language: cpp
dist: bionic
os: linux

python:
- "3.6"
git:
depth: 1

cache:
pip: true
apt: true
directories:
- $HOME/.cache/pip
- $HOME/.local
services:
- xvfb

matrix:
compiler:
- gcc

jobs:
include:
- name: "pestpp-opt tests"
env: TEST_REPO="https://github.com/usgs/pestpp-opt_benchmarks" TEST_SCRIPT="opt_test.py" TEST_DIR="pestpp-opt_benchmarks"
env:
TEST_REPO="https://github.com/usgs/pestpp-opt_benchmarks"
TEST_SCRIPT="opt_test.py"

- name: "pestpp-ies tests part 1"
env: TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks" TEST_SCRIPT="ies_test_part1.py" TEST_DIR="pestpp-ies_benchmarks"
env:
TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks"
TEST_SCRIPT="ies_test_part1.py"

- name: "pestpp-ies tests part 2"
env: TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks" TEST_SCRIPT="ies_test_part2.py" TEST_DIR="pestpp-ies_benchmarks"
env:
TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks"
TEST_SCRIPT="ies_test_part2.py"

- name: "pestpp-ies tests part 3"
env: TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks" TEST_SCRIPT="ies_test_part3.py" TEST_DIR="pestpp-ies_benchmarks"
env:
TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks"
TEST_SCRIPT="ies_test_part3.py"

- name: "pestpp-ies tests part 4"
env: TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks" TEST_SCRIPT="ies_test_part4.py" TEST_DIR="pestpp-ies_benchmarks"
- name: "pestpp-ies tests baseline"
env: TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks" TEST_SCRIPT="ies_test_base.py" TEST_DIR="pestpp-ies_benchmarks"
- name: "pestpp-glm tests baseline"
env: TEST_REPO="https://github.com/usgs/pestpp-glm_benchmarks" TEST_SCRIPT="glm_test_base.py" TEST_DIR="pestpp-glm_benchmarks"
env:
TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks"
TEST_SCRIPT="ies_test_part4.py"

- name: "pestpp-ies tests baseline"
env:
TEST_REPO="https://github.com/usgs/pestpp-ies_benchmarks"
TEST_SCRIPT="ies_test_base.py"

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
- gfortran-6
- liblapack-dev
- name: "pestpp-glm tests baseline"
env:
TEST_REPO="https://github.com/usgs/pestpp-glm_benchmarks"
TEST_SCRIPT="glm_test_base.py"

git:
depth: 1
env:
global:
- MAKEFLAGS="-j 2"
- name: "basic tests"
env:
TEST_REPO="https://github.com/usgs/pestpp"
TEST_SCRIPT="basic_tests.py"
TEST_DIR="benchmarks"

before_script:
- cd src
- rm -r -f ../bin/linux/
- make clean
- COMPILER=gcc6 CXX=g++-6 FC=gfortran-6 STATIC=no make install
- mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j2
# executable targets are automatically installed into bin
- cd ..
- wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda update --yes conda
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- conda install --yes python=$TRAVIS_PYTHON_VERSION pip numpy scipy pandas matplotlib nose
- source "$HOME/miniconda/etc/profile.d/conda.sh"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda create -q -n ci python=3.6 pip numpy scipy pandas matplotlib nose
- conda activate ci
- git clone --depth 1 --single-branch -b develop https://github.com/modflowpy/flopy.git
- cd flopy
- python setup.py install
- cd ..
- pip install ./flopy
- git clone --depth 1 --single-branch -b develop https://github.com/jtwhite79/pyemu.git
- cd pyemu
- python setup.py install
- cd ..
- export PYTHONPATH=$PYTHONPATH:.
- export PATH="./test_bin/linux:../test_bin/linux:../../test_bin/linux:$PATH"
- nosetests -v -w ./benchmarks basic_tests.py
- pip install ./pyemu

script:
- git clone -b master --depth 1 $TEST_REPO
- git clone --depth 1 -b master $TEST_REPO
- if [ ! -n "${TEST_DIR+set}" ]; then export TEST_DIR=$(basename $TEST_REPO); fi
- cd $TEST_DIR
- export PATH="$TRAVIS_BUILD_DIR/$TEST_DIR/test_bin/linux:$PATH"
# Ensure repo name is named 'pestpp' for tests
- if [ ! -d ../../pestpp ]; then ln -sr ../../$(basename $TRAVIS_REPO_SLUG) ../../pestpp; fi
- nosetests -v $TEST_SCRIPT


Expand Down
177 changes: 177 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# This is the top-level CMake file for PEST++
cmake_minimum_required(VERSION 3.9)

# Get PESTPP_VERSION from common source header
file(READ "${CMAKE_SOURCE_DIR}/src/libs/common/config_os.h" _file)
string(REGEX MATCH "PESTPP_VERSION \"([0-9\.]+)\"" _ ${_file})
set(PESTPP_VERSION ${CMAKE_MATCH_1})
if("${PESTPP_VERSION}" STREQUAL "")
message(SEND_ERROR
"Could not find PESTPP_VERSION in src/libs/common/config_os.h")
endif()

message(STATUS
"Configuring CMake ${CMAKE_VERSION} to build PESTPP ${PESTPP_VERSION}")

# This logic needs to be considered before project()
set(_change_MSVC_flags FALSE)
if(WIN32)
if(CMAKE_VERSION VERSION_LESS 3.15.0)
set(_change_MSVC_flags TRUE)
else()
# Set MSVC runtime to MultiThreaded (/MT)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()

project(PESTPP
VERSION ${PESTPP_VERSION}
LANGUAGES CXX)

# Prevent running cmake in source dir
if("${PESTPP_SOURCE_DIR}" STREQUAL "${PESTPP_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed")
endif()

if(_change_MSVC_flags)
# Modify compile flags to change MSVC runtime from /MD to /MT
set(_re_match "([\\/\\-]M)D")
set(_re_replace "\\1T")
string(REGEX REPLACE ${_re_match} ${_re_replace}
CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE ${_re_match} ${_re_replace}
CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE ${_re_match} ${_re_replace}
CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE ${_re_match} ${_re_replace}
CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${_re_match} ${_re_replace}
CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()

# Fortran is not required (anymore), but can be enabled using either:
# 1. ENABLE_Fortran=ON and use whatever default compiler is available
# 2. CMAKE_Fortran_COMPILER=ifort (or other compiler)
if(DEFINED ENABLE_Fortran)
set(_default_ENABLE_Fortran ${ENABLE_Fortran})
else()
if(DEFINED CMAKE_Fortran_COMPILER)
set(_default_ENABLE_Fortran ON)
else()
set(_default_ENABLE_Fortran OFF)
endif()
endif()
option(ENABLE_Fortran "Enable Fortran in PEST++" ${_default_ENABLE_Fortran})
if(ENABLE_Fortran)
enable_language(Fortran)
find_package(LAPACK REQUIRED)
message(STATUS "BLA_VENDOR=${BLA_VENDOR}")
message(STATUS "BLAS_LIBRARIES=${BLAS_LIBRARIES}")
message(STATUS "LAPACK_LIBRARIES=${LAPACK_LIBRARIES}")
set(Fortran_ENABLED TRUE)
else()
set(Fortran_ENABLED FALSE)
endif()

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
message(STATUS "CMAKE_THREAD_LIBS_INIT=${CMAKE_THREAD_LIBS_INIT}")

# Ensure C++11 is used
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Use global "-fvisibility=hidden" see https://gcc.gnu.org/wiki/Visibility
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

# Global warning flags
set(PESTPP_CXX_WARN_FLAGS "${PESTPP_CXX_WARN_FLAGS}"
CACHE STRING "C++ flags used to compile PEST++ targets")

# Global definitions
if(WIN32)
add_compile_definitions(_WIN32_WINNT=0x0600)
endif()

option(BUILD_SHARED_LIBS "Build PEST++ shared (default is static, OFF)" OFF)
message(STATUS "BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}")

option(FORCE_STATIC "Force '-static' flag to link applications (default OFF)" OFF)
message(STATUS "FORCE_STATIC=${FORCE_STATIC}")

# Default install directories
include(GNUInstallDirs)

# Build main targets in src
add_subdirectory(src)

# Define an custom OS tag for CPACK_SYSTEM_NAME and (for now) local bin sub-directory
if(WIN32)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(_ostag "iwin")
else()
set(_ostag "win")
endif()
elseif(APPLE)
set(_ostag "mac")
elseif(UNIX)
set(_ostag "linux")
else()
set(_ostag "unknown")
endif()

# Detect if using a 32-bit compiler, show warning and modify _ostag
if(CMAKE_SIZEOF_VOID_P STREQUAL 4)
message(WARNING
"A 32-bit compiler has been detected. It is recommended that "
"PEST++ should be compiled using a 64-bit compiler.")
set(_ostag "${_ostag}32")
endif()

# Use a custom command to locally install binaries after compiling
# https://www.linux.com/training-tutorials/cmake-recipe-2-install-local-folder-build-dir-testing/
option(INSTALL_LOCAL "Install local executables in ./bin" ON)
if(INSTALL_LOCAL)
set(_OPTION_INSTALL_LOCAL_ALL ALL)
endif()
# Use an extra command to copy binaries into a sub-directory within bin -- please remove soon
if(WIN32)
set(_local_install_COMMAND_to_be_removed
cd "${PESTPP_SOURCE_DIR}\\bin" &&
md ${_ostag} &
copy /b pestpp-* ${_ostag}\\
)
else()
set(_local_install_COMMAND_to_be_removed
cd "${PESTPP_SOURCE_DIR}/bin" &&
rm -rf ${_ostag} &&
mkdir ${_ostag} &&
cp pestpp-* ${_ostag}/
)
endif()
add_custom_target(local_install
${_OPTION_INSTALL_LOCAL_ALL}
"${CMAKE_COMMAND}"
-D CMAKE_INSTALL_PREFIX=${PESTPP_SOURCE_DIR}
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake"
COMMAND ${_local_install_COMMAND_to_be_removed}
DEPENDS
pestpp-glm
pestpp-ies
pestpp-opt
pestpp-sen
pestpp-swp
COMMENT "Installing local executables to ${PESTPP_SOURCE_DIR}/bin"
)

# Packaging
string(TOLOWER ${PROJECT_NAME} CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_VERSION_MAJOR ${PESTPP_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PESTPP_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PESTPP_VERSION_PATCH})
set(CPACK_SYSTEM_NAME ${_ostag})
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
include(CPack)
Loading

0 comments on commit a2c778b

Please sign in to comment.