Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
053b5ce
not a bug.
Apr 3, 2020
e28cdbb
Turned scripts recieved from harsha into a test case. open #402.
Apr 4, 2020
326ce2c
Renamed wrapper.Neutral to __Wrapper__. With new API, this functionality
Apr 4, 2020
ce3dff7
Merge branch 'master' into issue_402
dilawar Apr 6, 2020
ae2fd33
closes #401
Apr 9, 2020
fadcdf8
Fixed another bug: -DWTIH_BOOST=ON could not override GSL after WITH_GSL
Apr 9, 2020
3be10d9
check is made if solver has space while reading/writing SBML files,sm…
Apr 10, 2020
bff419d
Squashed commit of the following:
Apr 12, 2020
03dd92b
Minor fixes to pybind11.
Apr 12, 2020
c690daa
Fix #409
Apr 15, 2020
4bccbe7
Ready for a draft PR and initial disucssion.
Apr 15, 2020
cb8b8c1
Return numpy array instead of vector.
Apr 15, 2020
647e3dc
Fixed: moose.le can caused segfault when used on moose.vec
Apr 15, 2020
2ce1086
Fixed: moose.le can caused segfault when used on moose.vec
Apr 15, 2020
5fd60ba
Merge branch 'python_binding_using_pybind11' of gitlab.com:dilawar/mo…
Apr 15, 2020
9f90d36
removed mkdoc.py from pybind11.
Apr 15, 2020
636efbc
Fixed a pylint error as well python2/python3 compatibility
Apr 15, 2020
c8bc982
wildcard -> reacSystemPath
Apr 15, 2020
180cc03
Fixed another set.
Apr 15, 2020
fe4a02d
Travis fix: Install pytest on OSX as well.
Apr 15, 2020
9466b28
fix gitlab pipeline
Apr 15, 2020
15b49b4
isinstance is replace to isA added to this, validation.py: error msg …
Apr 15, 2020
29bf0db
fix test py_run.
Apr 15, 2020
64dc328
grenerate documentation on the fly.
Apr 15, 2020
2081d05
Work in progress: __doc__ string from cWork in progress: __doc__ string
Apr 16, 2020
7fa6688
Keeping the C++ type and Python's type name same.
Apr 17, 2020
b1620b6
Cleanup
Apr 17, 2020
0b7192f
pydoc support
Apr 17, 2020
53887ce
moose.doc is working now.
Apr 17, 2020
6d850f7
update to docs
Apr 17, 2020
b596799
more docstring are added [skip ci]
Apr 17, 2020
b6e6ab0
Added datetime and other string to version_info.
Apr 17, 2020
f427f06
All functions have docstring.
Apr 17, 2020
ab1f1dc
loadmodel docstring is added.
Apr 17, 2020
f840a44
temp commit.
Apr 17, 2020
82af977
showmsg is ported to c++.
Apr 17, 2020
55cbb15
added more docstring and moved some functions to public api.
Apr 18, 2020
ccf52b7
Merge remote-tracking branch 'hrani/master' into python_binding_using…
Apr 18, 2020
f6de583
Merge remote-tracking branch 'github/issue_402' into python_binding_u…
Apr 18, 2020
8001fae
Merge remote-tracking branch 'github/issue_401' into python_binding_u…
Apr 18, 2020
d0e5a45
Merged hrani changes and mine from new bindings.
Apr 18, 2020
b0c5b9c
# This is a combination of 2 commits.
Apr 18, 2020
b52b2fd
python2 support.
Apr 18, 2020
8c1c424
basestring -> str
Apr 18, 2020
2279e5a
fixes to `pip install`
Apr 18, 2020
d0f7d71
Fixed pylint error.
Apr 18, 2020
6403835
moose.getField accepts two argument instead of 3. Updated rmogul.py
Apr 18, 2020
d15f5fd
fix: compiles with clang++
Apr 18, 2020
ce2f997
travis fixes: OSX
Apr 18, 2020
3dba936
builds on osx locally.
Apr 19, 2020
b4e0e0b
tests passes with 3.8 as well.
Apr 19, 2020
51c6f13
Merge branch 'master' into python_binding_using_pybind11
dilawar Apr 19, 2020
59f9ecc
Merge branch 'python_binding_using_pybind11' of https://github.com/di…
Apr 19, 2020
64799ee
On OSX, stream does not flush properly?
Apr 19, 2020
57771e9
flush the streams before calling tests...
Apr 19, 2020
ebea75d
Merge branch 'python_binding_using_pybind11' of https://gitlab.com/di…
Apr 19, 2020
137cbd9
Don't run the trvais/osx
Apr 19, 2020
7f8ebfd
Merge branch 'python_binding_using_pybind11' of https://github.com/di…
Apr 19, 2020
4623118
Merge branch 'python_binding_using_pybind11' of gitlab.com:dilawar/mo…
Apr 19, 2020
1c284de
Fixes to pyrun tests.
Apr 19, 2020
922aee1
Merge branch 'python_binding_using_pybind11' of github.com:dilawar/mo…
Apr 19, 2020
f8b5f2f
Time to post the API.
Apr 19, 2020
1c25ac0
listmsg has been moved to C++.
Apr 19, 2020
8eb140d
docstring to writeNML2
Apr 19, 2020
ade45d6
Fixed typo in docstring. Ready to be reviewed.
Apr 19, 2020
854c77f
showfield and showfields are both supported.
Apr 19, 2020
68c8988
Added back moose.ce
Apr 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/travis_prepare_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ $PYTHON3 -m pip install matplotlib --user --upgrade
$PYTHON3 -m pip install pyNeuroML libNeuroML --user
$PYTHON3 -m pip install scipy --user
$PYTHON3 -m pip install pylint --user
$PYTHON3 -m pip install pytest --user
49 changes: 49 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
AccessModifierOffset: -4
SortIncludes: false
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: true
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 4
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Stroustrup
IndentFunctionDeclarationAfterType: true
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: false
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
Standard : C++11
...

8 changes: 7 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ build:
- python3 -m pip install python-libsbml --user --upgrade
- python3 -m pip install pyneuroml --user --upgrade
- python3 -m pip install sympy scipy --user --upgrade
- python3 -m pip install pytest --user --upgrade
- python3 setup.py build test
- python3 setup.py install --user
- python3 -c "import moose; moose.test()"
- python3 -c "import moose.tests; moose.tests.test()"

except:
- pybind11
- devel

182 changes: 37 additions & 145 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.2.3 FATAL_ERROR)

# Project to build MOOSE's python module.
project(PyMOOSE)
Expand All @@ -18,11 +18,7 @@ if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp 2.7)
endif()

# Disable rpath on OSX.
if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
endif()

set(CMAKE_MACOSX_RPATH OFF)

# NOTE: version should be changed in setup.py file.
# If moose version is not given, use setup.py file to get the default version.
Expand Down Expand Up @@ -55,19 +51,20 @@ if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
endif()

################################ CMAKE OPTIONS ##################################
option(WITH_NSDF "Enable NSDF support. Requires hdf5" OFF )

option(DEBUG "Build with debug support" OFF)
option(GPROF "Build for profiling using gprof" OFF)
option(ENABLE_UNIT_TESTS "Enable unit tests (DEBUG should also be ON)" OFF)
option(WITH_MPI "Enable Openmpi support" OFF)

option(WITH_BOOST "Enable boost. Prefer boost over stl" OFF)
option(WITH_BOOST_ODE "Use boost library ode2 library instead of GSL" OFF)
option(WITH_GSL "Use gsl-library. Alternative is WITH_BOOST" ON)
option(PARALLELIZED_CLOCK "High level parallelization of moose::Clock (alpha)" OFF )
option(USE_PRIVATE_RNG "Stochastic Objects use their private RNG" ON)

option(WITH_ASAN "Use AddressSanitizer in DEBUG mode." OFF)

option(WITH_NSDF "Enable NSDF support. Requires hdf5" OFF )

option(WITH_LEGACY_BINDING "Use legacy python-bindings" OFF)

############################ BUILD CONFIGURATION #################################

Expand Down Expand Up @@ -102,10 +99,8 @@ if(WITH_ASAN AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
endif()

if(WITH_GSL)
set(WITH_BOOST OFF)
set(WITH_BOOST_ODE OFF)
elseif(WITH_BOOST)
# Override default GSL solvers when BOOST is enabled.
if(WITH_BOOST OR WITH_BOOST_ODE)
set(WITH_BOOST_ODE ON)
set(WITH_GSL OFF)
endif()
Expand All @@ -114,19 +109,16 @@ endif()

link_directories(${CMAKE_BINARY_DIR})
add_library(libmoose SHARED basecode/main.cpp)
set_target_properties(libmoose PROPERTIES PREFIX "")
add_executable(moose.bin basecode/main.cpp)


################################### SETUP BUILD ################################
# default include paths.
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
set_target_properties(libmoose PROPERTIES COMPILE_DEFINITIONS "MOOSE_LIB")
set_target_properties(libmoose PROPERTIES PREFIX "")

## Variable to collect all static libraries.
# Variable to collect all static libraries.
set(STATIC_LIBRARIES "" )
# Collect all shared libraries here.
set(SYSTEM_SHARED_LIBS ${LibXML2_LIBRARIES})
set(SYSTEM_SHARED_LIBS "")

# BOOST ode library performs better than GSL and ideally should be made default.
# Unfortunately Boost does not have a very good matrix library; it has ublas
Expand Down Expand Up @@ -231,7 +223,7 @@ add_subdirectory(device)
add_subdirectory(kinetics)
add_subdirectory(synapse)
add_subdirectory(intfire)
add_subdirectory(external/libsoda)
add_subdirectory(external)

# development related.
add_subdirectory(devel)
Expand Down Expand Up @@ -271,7 +263,7 @@ endif( )
# especially section 'Mac OS X and the RPATH'
# Switching is OFF since all libraries are statically linked in module.
if(APPLE)
set_target_properties( libmoose PROPERTIES MACOSX_RPATH OFF)
set_target_properties(libmoose PROPERTIES MACOSX_RPATH OFF)
endif(APPLE)

# MAC linker does not understand many of gnu-ld options.
Expand Down Expand Up @@ -304,12 +296,16 @@ if( WITH_BOOST )
target_link_libraries( moose.bin ${Boost_LIBRARIES} )
endif( WITH_BOOST )


######################### BUILD PYMOOSE ########################################

if(NOT WITH_LEGACY_BINDING)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/pybind11)
add_subdirectory(pybind11)
else()
message(STATUS "Building legacy python binding.")
add_subdirectory(pymoose)
endif()

# This target is built by pymoose/CMakeLists.txt file.
add_subdirectory(pymoose)

# always override debian default installation directory. It will be installed in
# site-packages instead of dist-packages.
Expand Down Expand Up @@ -338,9 +334,6 @@ endif()
install(TARGETS moose.bin DESTINATION bin CONFIGURATIONS Debug)
install(TARGETS libmoose DESTINATION lib CONFIGURATIONS Debug)

# NOTE: Install macro for _moose (pymoose) has been moved to
# pymoose/CMakeLists.txt file.

# Print message to start build process
if(${CMAKE_BUILD_TOOL} MATCHES "make")
message(
Expand All @@ -353,123 +346,8 @@ endif()


############################ CTEST ######################################
include( CTest )
set(CTEST_NIGHTLY_START_TIME "05:30:00 UTC")
set(CTEST_SUBMIT_URL "http://my.cdash.org/submit.php?project=moose")

if(DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
# Run this test in debug mode. In Release mode, this does not do anything.
set(MOOSE_BIN_LOCATION $<TARGET_FILE:moose.bin>)
message(STATUS "Executable moose.bin will be at ${MOOSE_BIN_LOCATION}" )

add_test(NAME moose.bin-raw-run COMMAND moose.bin -u -q)
endif()

# Core tests.
set(PYMOOSE_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/py_moose)
file(GLOB PY_TEST_SCRIPTS "${PYMOOSE_TEST_DIRECTORY}/test_*.py" )
foreach(_test_script ${PY_TEST_SCRIPTS} )
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "core_${_name_we}")
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
WORKING_DIRECTORY ${PYMOOSE_TEST_DIRECTORY})
set_tests_properties(${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach()

# Tests for supported formats such as neuroml, sbml etc.
set(SUPPORT_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/support)
file(GLOB PY_TEST_SCRIPTS "${SUPPORT_TEST_DIRECTORY}/test_*.py" )
foreach(_test_script ${PY_TEST_SCRIPTS} )
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "support_${_name_we}")
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
WORKING_DIRECTORY ${SUPPORT_TEST_DIRECTORY})
set_tests_properties(${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach()

# rdesigneur tests. These tests require matplotlib.
set(RDES_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/py_rdesigneur)
file(GLOB RDES_TEST_SCRIPTS "${RDES_TEST_DIRECTORY}/test_*.py" )
foreach(_test_script ${RDES_TEST_SCRIPTS})
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "rdes_${_name_we}")
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
WORKING_DIRECTORY ${RDES_TEST_DIRECTORY}
)
set_tests_properties(${_test_name} PROPERTIES
ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python;MOOSE_NUM_THREADS=4"
)
endforeach()

# FIXME TESTS. These should not run by default. We need to fix them.
set(PYMOOSE_FIXME_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/devel/fixme)
file(GLOB PY_FIXME_TEST_SCRIPTS "${PYMOOSE_FIXME_TEST_DIRECTORY}/*.py" )
foreach( _test_script ${PY_FIXME_TEST_SCRIPTS} )
get_filename_component( _name_we ${_test_script} NAME_WE)
set(_test_name "alpha_${_name_we}")
add_test( NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
CONFIGURATIONS alpha
WORKING_DIRECTORY ${PYMOOSE_ALPHA_TEST_DIRECTORY}
)
set_tests_properties( ${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach( )

# Regression and github issues. These should not run by default.
set(PYMOOSE_ISSUES_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/devel/issues)
file(GLOB PY_ISSUES_SCRIPTS "${PYMOOSE_ISSUES_DIRECTORY}/*.py" )
foreach(_test_script ${PY_ISSUES_SCRIPTS})
get_filename_component( _test_name ${_test_script} NAME_WE)
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
CONFIGURATIONS Devel
WORKING_DIRECTORY ${PYMOOSE_ISSUES_DIRECTORY}
)
set_tests_properties(${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach()

################################# COVERAGE ###################################

add_custom_target(coverage)
set(PYTEST_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
file(GLOB_RECURSE PYTEST_TEST_SCRIPTS ${PYTEST_TEST_DIRECTORY}/test_*.py)

foreach(_test_script ${PYTEST_TEST_SCRIPTS})
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "pytest_${_name_we}")
# message(STATUS "Adding test ${_test_name}")
add_custom_target(${_test_name}
# We collect coverage data but do not show report during each test.
# We show report at the end of all tests. Set `--cov-report=`
COMMAND ${PYTHON_EXECUTABLE} -m pytest
--cov=moose --cov=rdesigneur --cov-append --cov-report=
${_test_script}
DEPENDS _moose
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Executing ${_test_script} using pytest"
VERBATIM)
add_dependencies(coverage ${_test_name})
endforeach()

# Generate report at the end.
add_custom_command(TARGET coverage POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} -m coverage report
COMMAND ${PYTHON_EXECUTABLE} -m coverage html
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Genearting coverage report"
VERBATIM)

include(CTest)
add_subdirectory(tests)

########################### RELEASE #########################################
set(PYMOOSE_SDIST_FILE ${CMAKE_BINARY_DIR}/pymoose-${VERSION_MOOSE}.tar.gz)
Expand Down Expand Up @@ -519,3 +397,17 @@ foreach(_py_script ${PY_SCRIPTS})
add_dependencies(pylint ${TGT_NAME} )
endforeach( )

######################## DOCS ###############################################
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/devel/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation using Doxygen."
VERBATIM)
else()
message(STATUS "Doxygen needs to be installed to generate API docs")
endif()
7 changes: 3 additions & 4 deletions CheckCXXCompiler.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Compiler check.
# Must support c++11
# Must support c++14
# If python2 is supported then we can not use c++17.
if(COMPILER_IS_TESTED)
return()
Expand All @@ -20,12 +20,11 @@ add_definitions(-Wall
)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# gcc-4.9.0 has regex supports though moose will compile with 4.8.x;
# <regex> won't work.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
message(FATAL_ERROR "Insufficient gcc version. Minimum requried 4.9")
endif()
add_definitions( -Wno-unused-local-typedefs )
add_definitions( -fmax-errors=5 )
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
add_definitions( -Wno-unused-local-typedef )
endif()
Expand All @@ -50,7 +49,7 @@ if(COMPILER_SUPPORTS_CXX11)
endif(APPLE)
else(COMPILER_SUPPORTS_CXX11)
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} is too old. \n"
"Please use a compiler which has c++11 support."
"Please use a compiler which has full c++11 support."
)
endif(COMPILER_SUPPORTS_CXX11)

Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ recursive-include signeur *
recursive-include synapse *
recursive-include tests *
recursive-include utility *
recursive-include pybind11 *
recursive-include devel *
7 changes: 6 additions & 1 deletion basecode/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 2.8)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake )
add_library(basecode
consts.cpp
Element.cpp
DataElement.cpp
GlobalDataElement.cpp
Expand All @@ -26,3 +25,9 @@ add_library(basecode
doubleEq.cpp
testAsync.cpp
)

add_executable(test_globals testGlobals.cpp global.cpp)

enable_testing()
add_test(NAME cpp_test_globals COMMAND $<TARGET_FILE:test_globals>)

Loading