Skip to content

Commit

Permalink
Merge pull request #19 from jougs/remove-sibling-container
Browse files Browse the repository at this point in the history
Remove sibling container
  • Loading branch information
heplesser committed Aug 10, 2017
2 parents da95f77 + 0752fec commit 8c13a40
Show file tree
Hide file tree
Showing 716 changed files with 29,158 additions and 13,224 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
# This is the Travis CI top-level script to setup and run the NEST build and test environment.


language: generic
language: minimal

# Required for Ubuntu Trusty (14.04 LTS).
sudo: required
dist: trusty

#https://blog.travis-ci.com/2017-06-19-trusty-updates-2017-Q2
group: edge
env:
matrix:
# We don't have to run a full matrix here, because most of the options are
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ if ( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local" )
"Please set -DCMAKE_INSTALL_PREFIX:PATH=<install prefix>." )
endif ()

################################################################################
################# Use absolute path for CMAKE_NEST_PREFIX #################
################################################################################

get_filename_component(CMAKE_NEST_PREFIX ${CMAKE_INSTALL_PREFIX} REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")

################################################################################
################## Find utility programs ##################
################################################################################
Expand Down
6 changes: 3 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ NEST is installed with `cmake` (at least v2.8.12). In the simplest case, the com
make
make install

should build and install NEST to <install-path>. Detailed installation
instructions can be found below, including instructions for macOS, BlueGene/Q
and Fujitsu Sparc64 systems.
should build and install NEST to `/install/path`, which should be an absolute
path. Detailed installation instructions can be found below, including
instructions for macOS, BlueGene/Q and Fujitsu Sparc64 systems.

Choice of CMake Version
=======================
Expand Down
49 changes: 31 additions & 18 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,29 +144,40 @@ if [ "$xSTATIC_ANALYSIS" = "1" ] ; then
done
done
echo "MSGBLD0100: Retrieving changed files completed."

printf '%s\n' "$file_names" | while IFS= read -r line
do
echo "MSGBLD0095: File changed: $line"
done
echo "MSGBLD0100: Retrieving changed files completed."
echo

sudo chmod +x ./extras/static_code_analysis.sh

RUNS_ON_TRAVIS=true
INCREMENTAL=false
VERA=vera++
# Set the command line arguments for the static code analysis script and execute it.

# The names of the static code analysis tools executables.
VERA=vera++
CPPCHECK=cppcheck
CLANG_FORMAT=clang-format
PEP8=pep8
PERFORM_VERA=false
PERFORM_CPPCHECK=false

# Perform or skip a certain analysis.
PERFORM_VERA=true
PERFORM_CPPCHECK=true
PERFORM_CLANG_FORMAT=true
PERFORM_PEP8=true

./extras/static_code_analysis.sh "$RUNS_ON_TRAVIS" "$INCREMENTAL" "$file_names" "$NEST_VPATH" "$VERA" "$CPPCHECK" "$CLANG_FORMAT" "$PEP8" \
"$PERFORM_VERA" "$PERFORM_CPPCHECK" "$PERFORM_CLANG_FORMAT" "$PERFORM_PEP8"
# The following command line parameters indicate whether static code analysis error messages
# will cause the Travis CI build to fail or are ignored.
IGNORE_MSG_VERA=true
IGNORE_MSG_CPPCHECK=true
IGNORE_MSG_CLANG_FORMAT=false
IGNORE_MSG_PEP8=false

# The script is called within the Travis CI environment and cannot be run incremental.
RUNS_ON_TRAVIS=true
INCREMENTAL=false

sudo chmod +x ./extras/static_code_analysis.sh
./extras/static_code_analysis.sh "$RUNS_ON_TRAVIS" "$INCREMENTAL" "$file_names" "$NEST_VPATH" \
"$VERA" "$CPPCHECK" "$CLANG_FORMAT" "$PEP8" \
"$PERFORM_VERA" "$PERFORM_CPPCHECK" "$PERFORM_CLANG_FORMAT" "$PERFORM_PEP8" \
"$IGNORE_MSG_VERA" "$IGNORE_MSG_CPPCHECK" "$IGNORE_MSG_CLANG_FORMAT" "$IGNORE_MSG_PEP8"

fi # Static code analysis.


Expand Down Expand Up @@ -217,11 +228,13 @@ make installcheck
echo "MSGBLD0300: Make installcheck completed."

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "MSGBLD0310: This build was triggered by a pull request." >&2
echo "MSGBLD0330: (WARNING) Build artifacts not uploaded to Amazon S3." >&2
echo "MSGBLD0310: This build was triggered by a pull request."
echo "MSGBLD0330: (WARNING) Build artifacts not uploaded to Amazon S3."
fi

if [ "$TRAVIS_REPO_SLUG" != "nest/nest-simulator" ] ; then
echo "MSGBLD0320: This build was from a forked repository and not from nest/nest-simulator." >&2
echo "MSGBLD0330: (WARNING) Build artifacts not uploaded to Amazon S3." >&2
echo "MSGBLD0320: This build was from a forked repository and not from nest/nest-simulator."
echo "MSGBLD0330: (WARNING) Build artifacts not uploaded to Amazon S3."
fi

echo "MSGBLD0340: Build completed."
21 changes: 20 additions & 1 deletion conngen/cg_connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ cg_connect( ConnectionGeneratorDatum& cg,
{
if ( not params_map->known( names::weight )
|| not params_map->known( names::delay ) )
{
throw BadProperty(
"The parameter map has to contain the indices of weight and delay." );
}

long w_idx = ( *params_map )[ names::weight ];
long d_idx = ( *params_map )[ names::delay ];
Expand Down Expand Up @@ -128,8 +130,10 @@ cg_connect( ConnectionGeneratorDatum& cg,
{
if ( not params_map->known( names::weight )
|| not params_map->known( names::delay ) )
{
throw BadProperty(
"The parameter map has to contain the indices of weight and delay." );
}

long w_idx = ( *params_map )[ names::weight ];
long d_idx = ( *params_map )[ names::delay ];
Expand Down Expand Up @@ -234,7 +238,9 @@ cg_create_masks( std::vector< ConnectionGenerator::Mask >* masks,
for ( size_t proc = 0; proc
< static_cast< size_t >( kernel().mpi_manager.get_num_processes() );
++proc )
{
( *masks )[ proc ].sources.insert( cg_idx_left, right );
}
cg_idx_left += num_elements + 1;
}

Expand Down Expand Up @@ -296,7 +302,9 @@ cg_get_right_border( index left, size_t step, std::vector< long >& gids )
// Check if left is already the index of the last element in
// gids. If yes, return left as the right border
if ( left == gids.size() - 1 )
{
return left;
}

// leftmost_r is the leftmost right border during the search
long leftmost_r = -1;
Expand All @@ -316,7 +324,9 @@ cg_get_right_border( index left, size_t step, std::vector< long >& gids )
if ( ( i == static_cast< long >( gids.size() ) - 1
&& gids[ i ] - gids[ left ] == i - static_cast< long >( left ) )
|| i == leftmost_r )
{
return last_i;
}

// Store the current value of i in last_i. This is the current
// candidate for the right border of the range.
Expand All @@ -327,7 +337,9 @@ cg_get_right_border( index left, size_t step, std::vector< long >& gids )
// for leftmost_r to the current i (i.e. the known leftmost
// position) and set i to the left by step steps.
if ( gids[ i ] - gids[ left ] == i - static_cast< long >( left ) )
{
i += step;
}
else
{
leftmost_r = i;
Expand All @@ -337,7 +349,9 @@ cg_get_right_border( index left, size_t step, std::vector< long >& gids )
// Reduce the search interval by half its size if it is > 1.
// This adaptation is the basis of the binary search.
if ( step != 1 )
{
step /= 2;
}
}

// The border should always be found and returned during the while
Expand Down Expand Up @@ -370,9 +384,14 @@ cg_get_ranges( RangeSet& ranges, std::vector< long >& gids )
right = cg_get_right_border( left, ( gids.size() - left ) / 2, gids );
ranges.push_back( Range( gids[ left ], gids[ right ] ) );
if ( right == gids.size() - 1 ) // We're at the end of gids and stop
{
break;
}
else
left = right + 1; // The new left border is one after the old right
{
// The new left border is one after the old right
left = right + 1;
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion conngen/conngen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "exceptions.h"
#include "kernel_manager.h"
#include "modelrange.h"
#include "nest_datums.h"

// Includes from sli:
#include "token.h"
Expand Down Expand Up @@ -91,7 +90,9 @@ nest::cg_connect( nest::ConnectionGeneratorDatum& cg,
const Token synmodel =
kernel().model_manager.get_synapsedict()->lookup( synmodel_name );
if ( synmodel.empty() )
{
throw UnknownSynapseType( synmodel_name.toString() );
}
const index synmodel_id = static_cast< index >( synmodel );

const modelrange source_range =
Expand Down Expand Up @@ -129,7 +130,9 @@ nest::cg_connect( nest::ConnectionGeneratorDatum& cg,
const Token synmodel =
kernel().model_manager.get_synapsedict()->lookup( synmodel_name );
if ( synmodel.empty() )
{
throw UnknownSynapseType( synmodel_name.toString() );
}
const index synmodel_id = static_cast< index >( synmodel );

RangeSet source_ranges;
Expand Down
60 changes: 38 additions & 22 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,44 @@

if ( NOT CMAKE_CROSSCOMPILING )
add_custom_target( generate_help ALL )
# Extract help from all source files in the source code, put them in
# doc/help and generate a local help index in the build directory containing
# links to the help files.
add_custom_command( TARGET generate_help POST_BUILD
COMMAND python -B generate_help.py "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
COMMAND python -B generate_helpindex.py "${PROJECT_BINARY_DIR}/doc"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/extras/help_generator"
COMMENT "Extracting help information; this may take a litte while."
)
# Copy the local doc/help directory to the global installation
# directory for documentation.
install( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/help"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
# Update the global help index to contain all help files that are
# located in the global installation directory for documentation.
install( CODE
"execute_process(
COMMAND python -B generate_helpindex.py \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}\"
WORKING_DIRECTORY \"${PROJECT_SOURCE_DIR}/extras/help_generator\"
)"
)

# Python is needed to generate the help. If Python does not exist, there are
# problems with the following.
# See https://github.com/nest/nest-simulator/issues/678.
find_package( PythonInterp )
if ( PYTHONINTERP_FOUND )

# Because of problems of help generation with the implementation of 're'
# in Python older than 2.7.8, the production of the help is skipped
# completely for these versions.
if(${PYTHON_VERSION_STRING} VERSION_GREATER "2.7.7")
# Extract help from all source files in the source code, put them in
# doc/help and generate a local help index in the build directory containing
# links to the help files.
add_custom_command( TARGET generate_help POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} -B generate_help.py "${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}"
COMMAND ${PYTHON_EXECUTABLE} -B generate_helpindex.py "${PROJECT_BINARY_DIR}/doc"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/extras/help_generator"
COMMENT "Extracting help information; this may take a litte while."
)
# Copy the local doc/help directory to the global installation
# directory for documentation.
install( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/help"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
# Update the global help index to contain all help files that are
# located in the global installation directory for documentation.
install( CODE
"execute_process(
COMMAND ${PYTHON_EXECUTABLE} -B generate_helpindex.py \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}\"
WORKING_DIRECTORY \"${PROJECT_SOURCE_DIR}/extras/help_generator\"
)"
)
endif ()

endif ()

endif ()

install( DIRECTORY conngen model_details
Expand Down
2 changes: 2 additions & 0 deletions examples/MyModule/drop_odd_spike_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ DropOddSpikeConnection< targetidentifierT >::send( nest::Event& e,
const CommonPropertiesType& props )
{
if ( e.get_stamp().get_steps() % 2 ) // stamp is odd, drop it
{
return;
}

// Even time stamp, we send the spike using the normal sending mechanism
// send the spike to the target
Expand Down
19 changes: 14 additions & 5 deletions examples/MyModule/pif_psc_alpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,25 @@ mynest::pif_psc_alpha::Parameters_::set( const DictionaryDatum& d )
updateValue< double >( d, names::V_th, V_th );
updateValue< double >( d, names::V_reset, V_reset );
updateValue< double >( d, names::t_ref, t_ref );

if ( C_m <= 0 )
{
throw nest::BadProperty(
"The membrane capacitance must be strictly positive." );

}
if ( tau_syn <= 0 )
{
throw nest::BadProperty(
"The synaptic time constant must be strictly positive." );

}
if ( V_reset >= V_th )
{
throw nest::BadProperty( "The reset potential must be below threshold." );

}
if ( t_ref < 0 )
{
throw nest::BadProperty(
"The refractory time must be at least one simulation step." );
}
}

void
Expand Down Expand Up @@ -240,10 +244,15 @@ mynest::pif_psc_alpha::update( Time const& slice_origin,

// update membrane potential
if ( S_.refr_count == 0 ) // neuron absolute not refractory
{
S_.V_m +=
V_.P30 * ( S_.I_ext + P_.I_e ) + V_.P31 * S_.dI_syn + V_.P32 * S_.I_syn;
}
else
--S_.refr_count; // count down refractory time
{
// count down refractory time
--S_.refr_count;
}

// update synaptic currents
S_.I_syn = V_.P21 * S_.dI_syn + V_.P22 * S_.I_syn;
Expand Down
6 changes: 6 additions & 0 deletions examples/MyModule/pif_psc_alpha.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ mynest::pif_psc_alpha::handles_test_event( nest::SpikeEvent&,
// to handle @c SpikeEvent on port 0. You need to extend the function
// if you want to differentiate between input ports.
if ( receptor_type != 0 )
{
throw nest::UnknownReceptorType( receptor_type, get_name() );
}
return 0;
}

Expand All @@ -360,7 +362,9 @@ mynest::pif_psc_alpha::handles_test_event( nest::CurrentEvent&,
// to handle @c CurrentEvent on port 0. You need to extend the function
// if you want to differentiate between input ports.
if ( receptor_type != 0 )
{
throw nest::UnknownReceptorType( receptor_type, get_name() );
}
return 0;
}

Expand All @@ -374,7 +378,9 @@ mynest::pif_psc_alpha::handles_test_event( nest::DataLoggingRequest& dlr,
// The function also tells the built-in UniversalDataLogger that this node
// is recorded from and that it thus needs to collect data during simulation.
if ( receptor_type != 0 )
{
throw nest::UnknownReceptorType( receptor_type, get_name() );
}

return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
}
Expand Down
2 changes: 2 additions & 0 deletions examples/MyModule/step_pattern_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ mynest::StepPatternBuilder::connect_()
for ( nest::GIDCollection::const_iterator sgid = sources_->begin();
sgid < sources_->end();
++sgid )
{
skip_conn_parameter_( tid );
}
continue;
}
nest::Node* const target =
Expand Down
Loading

0 comments on commit 8c13a40

Please sign in to comment.