Skip to content

Commit

Permalink
3.4.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiliangChenOIST committed Nov 9, 2018
1 parent da9289d commit 0274082
Show file tree
Hide file tree
Showing 261 changed files with 233,438 additions and 3,667 deletions.
12 changes: 12 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,*,-clang-analyzer-alpha.*,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-implicit-bool-cast,-cppcoreguidelines-pro-bounds-constant-array-index,-google-runtime-reference,cppcoreguidelines-owning-memory'
FormatStyle: file

# Checks to use with "clang-tidy -fix": google-readability-namespace-comments,hicpp-braces-around-statements,modernize-use-equals-default,modernize-use-nullptr,llvm-include-order,modernize-redundant-void-arg,readability-implicit-bool-conversion,readability-redundant-member-init

# Warnings to fix:
# cppcoreguidelines-pro-type-member-init
# readability-named-parameter
# google-build-using-namespace
#
# maybe pro-bounds-pointer-arithmetic but may be required by cython
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ pysteps/steps/cysteps_mpi.cpp
.python-version

.ipynb_checkpoints

spconfig.py
6 changes: 5 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ Stefan Wils (OIST, UA, 2006 - 2009)
From École polytechnique fédérale de Lausanne, Switzerland (Since STEPS version 3.0.0):

Fabien Delalondre
* Technical lead and coordination for Blue Brain team contribution
* Technical lead and coordination for Blue Brain team contribution (to June 2018)

James King
* Technical lead and coordination for Blue Brain team contribution (from July 2018)

Tristan Carel
* Docker image (https://github.com/CNS-OIST/STEPS_Docker)
Expand All @@ -49,6 +52,7 @@ Francesco Casalegno

Samuel Melchior
* Rejection-based SSA for well mixed solver
* Optimisation of Wmrk4 non-spatial deterministic solver.

Aleksandr Ovcharenko
* R123 random number generator
Expand Down
14 changes: 8 additions & 6 deletions CMake/Compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ set(CXX_DIALECT_OPT_CXX14 "-std=c++14")
set(CXX_DIALECT_OPT_CXX14EXT "-std=gnu++14")


if( (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^ppc" ) OR ( CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^power" ) )
## ppc arch do not support -march= syntax
set(COMPILER_OPT_ARCH_NATIVE "-mcpu=native")
add_definitions(-D_BLUEGENE)
else()
set(COMPILER_OPT_ARCH_NATIVE "-march=native")
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
if( (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^ppc" ) OR ( CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^power" ) )
## ppc arch do not support -march= syntax
set(COMPILER_OPT_ARCH_NATIVE "-mcpu=native")
add_definitions(-D_BLUEGENE)
else()
set(COMPILER_OPT_ARCH_NATIVE "-march=native")
endif()
endif()


Expand Down
29 changes: 29 additions & 0 deletions CMake/FindCLANG_TIDY.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# /FindCLANG_TIDY.cmake
#
# This CMake script will search for clang-tidy and set the following
# variables
#
# CLANG_TIDY_FOUND : Whether or not clang-tidy is available on the target system
# CLANG_TIDY_EXECUTABLE : Fully qualified path to the clang-tidy executable
#
# The following variables will affect the operation of this script
# CLANG_TIDY_SEARCH_PATHS : List of directories to search for clang-tidy in,
# before searching any system paths. This should be
# the prefix to which clang-tidy was installed, and
# not the path that contains the clang-tidy binary.
# Eg /opt/ not /opt/bin/

# Search for the canonical executable, then search for ones with
# a version from newest to oldest.
find_program(CLANG_TIDY_EXECUTABLE
NAMES clang-tidy clang-tidy-6.0 clang-tidy-5.0
clang-tidy-4.0 clang-tidy-3.9 clang-tidy-3.8
clang-tidy-3.7 clang-tidy-3.6 clang-tidy-3.5
HINTS ${CLANG_TIDY_SEARCH_PATHS}
)

if(CLANG_TIDY_EXECUTABLE)
set (CLANG_TIDY_FOUND TRUE)
else()
set (CLANG_TIDY_FOUND FALSE)
endif()
52 changes: 52 additions & 0 deletions CMake/UseCodeCoverage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# - Enable Code Coverage
#
# Variables you may define are:
# CODECOV_HTMLOUTPUTDIR - the name of the directory where HTML results are placed. Defaults to "coverage_html"
# CODECOV_XMLOUTPUTFILE - the name of the directory where HTML results are placed. Defaults to "coverage.xml"
# CODECOV_GCOVR_OPTIONS - additional options given to gcovr commands.
#

option(ENABLE_CODECOVERAGE "Enable code coverage testing support")

if(ENABLE_CODECOVERAGE)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
endif(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")

if(NOT DEFINED CODECOV_XMLOUTPUTFILE)
set(CODECOV_XMLOUTPUTFILE coverage.xml)
endif(NOT DEFINED CODECOV_XMLOUTPUTFILE)

if(NOT DEFINED CODECOV_HTMLOUTPUTDIR)
set(CODECOV_HTMLOUTPUTDIR coverage_html)
endif(NOT DEFINED CODECOV_HTMLOUTPUTDIR)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCXX)
foreach(exe gcov lcov gcovr)
string(TOUPPER ${exe} exe_var)
set(exe_var "CODECOV_${exe_var}")
find_program(${exe_var} ${exe})
if(NOT ${exe_var})
message(SEND_ERROR "Could not find ${exe} executable")
endif()
endforeach()
add_definitions(-fprofile-arcs -ftest-coverage)
link_libraries(gcov)
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} --coverage)
add_custom_target(
coverage_init
${CODECOV_LCOV} --gcov-tool ${CODECOV_GCOV} --base-directory .
--directory ${CMAKE_BINARY_DIR} --capture --initial
)
string(REPLACE " " ";" codecov_gcovr_opts "${CODECOV_GCOVR_OPTIONS}")
set(CODECOV_GCOVR_BASECMD ${CODECOV_GCOVR} ${codecov_gcovr_opts}
--gcov-executable ${CODECOV_GCOV} --root ${PROJECT_SOURCE_DIR})
add_custom_target(
coverage
${CODECOV_GCOVR_BASECMD} --xml --output ${CODECOV_XMLOUTPUTFILE}
COMMAND mkdir -p ${CODECOV_HTMLOUTPUTDIR}
COMMAND ${CODECOV_GCOVR_BASECMD} --html --html-details
--output ${CODECOV_HTMLOUTPUTDIR}/index.html
)
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCXX)
endif(ENABLE_CODECOVERAGE)
43 changes: 41 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
project(STEPS)

set(VERSION_MAJOR 3)
set(VERSION_MINOR 3)
set(VERSION_MINOR 4)
set(VERSION_PATCH 0)
set(STEPS_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

# OPTIONS
option(TARGET_NATIVE_ARCH "Generate non-portable arch-specific code" ON)
option(PYTHON_BINDINGS_CYTHON "Generate bindings using Cthon, instead of Swig" ON)
option(USE_BDSYSTEM_LAPACK "Use new BDSystem/Lapack code for E-Field solver" OFF)
set(USE_MPI "Default" CACHE STRING "Use MPI for parallel solvers")
set(USE_PETSC "Default" CACHE STRING "Use PETSC library for parallel E-Field solver")
Expand All @@ -26,13 +25,34 @@ if (NOT USE_PETSC MATCHES "^(Default|True|False)$")
message(FATAL_ERROR "Acceptable values for USE_PETSC are: \"Default\", \"True\", \"False\"!")
endif()

# Valgrind
set(VALGRIND "" CACHE STRING "Valgrind plus arguments for testing")
if(NOT VALGRIND STREQUAL "")
file(GLOB valgrind_supps ${CMAKE_CURRENT_SOURCE_DIR}/test/ci/valgrind/*.supp)
foreach(valgrind_supp IN LISTS valgrind_supps)
LIST(APPEND valgrind_supps_cmd --suppressions=${valgrind_supp})
endforeach()
set(VALGRIND "${VALGRIND}" ${valgrind_supps_cmd})
endif()

# Compiler options
# -------------------------------------------------------------------
include(CMake/Compiler.cmake)

include(CMake/steps_portability_check.cmake)

option(USE_CLANG_TIDY "Perform C++ static analysis while compiling" FALSE)
if(USE_CLANG_TIDY)
find_package(CLANG_TIDY REQUIRED)
if(CLANG_TIDY_FOUND)
cmake_minimum_required(VERSION 3.6)
set(CLANG_TIDY_ARGS "" CACHE STRING "clang-tidy command options")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" ${CLANG_TIDY_ARGS})
else()
message(ERROR "Could not find clang-tidy utility")
endif()
endif()

# Nuke any -DNDEBUG in the compiler options introduced by CMake.
include(CMake/ManipulateVariables.cmake)
foreach(var_name ${flag_vars})
Expand All @@ -48,6 +68,19 @@ if(TARGET_NATIVE_ARCH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_OPT_ARCH_NATIVE}")
endif()

# Code coverage
SET(CODECOV_GCOVR_OPTIONS "-v --filter='.*/src/steps/.*'")
include(UseCodeCoverage)
if(ENABLE_CODECOVERAGE)
install(
DIRECTORY ${CMAKE_BINARY_DIR}/${CODECOV_HTMLOUTPUTDIR}/
DESTINATION share/steps/${STEPS_VERSION}/coverage
)
install(
FILES ${CMAKE_BINARY_DIR}/${CODECOV_XMLOUTPUTFILE}
DESTINATION share/steps/${STEPS_VERSION}/coverage
)
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
Expand All @@ -72,6 +105,12 @@ if (USE_MPI MATCHES "^(Default|True)$")
endif()
if (MPI_FOUND)
add_definitions(-DUSE_MPI)
find_program(MPIRUN
NAMES mpirun
HINTS ${MPI_HOME} $ENV{MPI_HOME}
PATHS ${_MPI_PREFIX_PATH}
PATH_SUFFIXES bin
DOC "Executable for running MPI programs.")
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ If STEPS is installed successfully, you should be able to see similar informatio

```
STochastic Engine for Pathway Simulation
Version: 3.1.0
Version: 3.4.0
License: GPL2.0
Website: steps.sourceforge.net
CXX Binding: Cython
Expand Down
8 changes: 7 additions & 1 deletion RELEASES
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Release Notes

Version 3.4.0 (2018-11)
==========================
1. Optimisation of non-spatial deterministic solver Wmrk4. Vast improvement in performance for large models.
2. Various bug fixes and unit tests.

Version 3.3.0 (2018-04)
==========================
1. Implemented Rejection-based SSA (Thanh V, Zunino R, Priami C (n.d.) On the rejection-based algorithm for simulation and analysis of large-scale reaction networks. The Journal of Chemical Physics 142:244106) as a faster alternative to Wmdirect
Expand All @@ -10,7 +16,7 @@ Version 3.2.0 (2017-10)
==========================
1. Extensive rework on Cython binding and documentation with Jupyter notebook.
2. Extend support for Python 3.3~.
3. several bug fixs.
3. several bug fixes.
Note: SWIG Binding will be removed in 3.3 release.

Version 3.1.0 (2017-6)
Expand Down
122 changes: 122 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Testing

This document contains the STEPS code testing guidelines. It should answer any
questions you may have as an aspiring STEPS contributor.

## Test suites

STEPS has four test suites:

* C++ unit tests located in `test/unit/cpp`
* Python unit tests located in `test/unit/py`
* Minimal integration tests in `test/validation`
* Validation tests located in [CNS-OIST/STEPS_Validation](https://github.com/CNS-OIST/STEPS_Validation)
repository.

## Writing new tests

Most code changes will fall into one of the following categories.

### Writing tests for new features

New code should be covered by unit tests. If the code is difficult to test with
a unit tests then that is a good sign that it should be refactored to make it
easier to reuse and maintain.

### Writing tests for bug fixes

Bugs fixes should include a unit test case which exercises the bug.

A bug fix may also include new assertions in an existing integration tests for the
API endpoint.

### Validation tests

FIXME: define guidelines

## Running tests

### Unit tests
To run the unit test suite:

```
cd /path/to/build/path
make check
```

To execute only one test: `ctest --output-on-failure -R TEST_NAME`

### Integration tests

To run the integration test suite, follow instructions of
[CNS-OIST/STEPS_Validation](https://github.com/CNS-OIST/STEPS_Validation)
repository.


## Code Analysis

### Code coverage

Code coverage provides report to know how much the STEPS code is executed
by unit tests. Analysis provides detailed reports in both HTML and XML
showing the number of times every line of code is executed when running
unit tests.

### Requirements

Following tools are required: gcov, lcov, gcovr

#### Run coverage

Compilation with gcc is required to perform code coverage.

```
cd /path/to/STEPS
mkdir _build && pushd _build
cmake -DENABLE_CODECOVERAGE:BOOL=TRUE -DUSE_MPI:BOOL=False -DUSE_PETSC:BOOL=False -DCMAKE_BUILD_TYPE=Debug ..
make -j all coverage_init test coverage
```

Under the hood:

1. `all`: compilation phase is different: every object file is attached to a .gcno file,
containing information to reconstruct the basic block graphs and assign source line
numbers to blocks.
1. `coverage_init`: creates .gcda count data file for every .gcno,
with counters reset to 0
1. `test`: counters in .gcda files are updating while executing the test suite.
1. `coverage`: generate both XML and HTML reports based on .gcno and .gcda

### Valgrind

Valgrind is an instrumentation framework to build analysis from running applications.


#### Instrument unit test suite

It is strongly advise to run C++ unit-tests with valgrind memory checker activated.

```
cd /path/to/STEPS
mkdir _build && pushd _build
cmake -DCMAKE_BUILD_TYPE=Debug -DVALGRIND=valgrind ..
export VALGRIND_OPTS="--tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all --verbose"
make test
```

#### Selectively suppress errors

Simply add suppression files to `test/ci/valgrind` directory with *.supp* extension
to manually remove some warnings.

#### Generate suppression files

To generate a suppression file:
1. Instrument your program with the following valgrind option:
`--gen-suppressions=all --log-file=report.log`
1. Extract all `{ }` sections from the log file your want to permanently ignore
1. Put them in *.supp* files in `test/ci/valgrind/` directory. Typically, you should
have one file per library or namespace.

CMake won't detect that `test/ci/valgrind` has been modified, so it is required
to run `cmake .` explicitly after adding or removing a *.supp* file.
5 changes: 0 additions & 5 deletions pysteps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,3 @@ install(TARGETS cysteps

# Install python package, from cmake_setup.py
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${setup_py} build --build-base=${CMAKE_BINARY_DIR} install --install-lib=${PYTHON_INSTALL_PREFIX} --force WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")

# install matlab .m and config files file
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/steps/utilities/matlab_support/run_steps.m" DESTINATION "${PYTHON_INSTALL_PREFIX}/steps/utilities/matlab_support/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/steps/utilities/matlab_support/matlab_parser.cfg" DESTINATION "${PYTHON_INSTALL_PREFIX}/steps/utilities/matlab_support/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/steps/utilities/matlab_support/simulate.cfg" DESTINATION "${PYTHON_INSTALL_PREFIX}/steps/utilities/matlab_support/")
Loading

0 comments on commit 0274082

Please sign in to comment.