Skip to content

Fix Boost dependency for iaf_bw_2001 model #3258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 lib/sli/sli-init.sli
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,7 @@ special prerequisites.
SeeAlso: exit_test_gracefully
*/

/skip_if_without_boost { statusdict/have_boost :: not { /skipped_no_boost exit_test_gracefully } if } def
/skip_if_no_mpi { statusdict/is_mpi :: not { /skipped_no_mpi exit_test_gracefully } if } def
/skip_if_have_mpi { statusdict/is_mpi :: { /skipped_have_mpi exit_test_gracefully } if } def
/skip_if_not_threaded { is_threaded not { /skipped_no_threading exit_test_gracefully } if } def
Expand Down
2 changes: 2 additions & 0 deletions models/iaf_bw_2001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "iaf_bw_2001.h"

#ifdef HAVE_GSL
#ifdef HAVE_BOOST

// Includes from libnestutil:
#include "dict_util.h"
Expand Down Expand Up @@ -521,4 +522,5 @@ nest::iaf_bw_2001::handle( CurrentEvent& e )
e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ), e.get_weight() * e.get_current() );
}

#endif // HAVE_BOOST
#endif // HAVE_GSL
2 changes: 2 additions & 0 deletions models/iaf_bw_2001.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "config.h"

#ifdef HAVE_GSL
#ifdef HAVE_BOOST

// C includes:
#include <gsl/gsl_errno.h>
Expand Down Expand Up @@ -516,5 +517,6 @@ iaf_bw_2001::set_status( const DictionaryDatum& d )
};
} // namespace

#endif // HAVE_BOOST
#endif // HAVE_GSL
#endif // IAF_BW_2001
9 changes: 9 additions & 0 deletions sli/slistartup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ SLIStartup::SLIStartup( int argc, char** argv )
, ismpi_name( "is_mpi" )
, have_gsl_name( "have_gsl" )
, have_music_name( "have_music" )
, have_boost_name( "have_boost" )
, have_libneurosim_name( "have_libneurosim" )
, have_sionlib_name( "have_sionlib" )
, have_hdf5_name( "have_hdf5" )
Expand All @@ -190,6 +191,7 @@ SLIStartup::SLIStartup( int argc, char** argv )
, exitcode_skipped_no_threading_name( "skipped_no_threading" )
, exitcode_skipped_no_gsl_name( "skipped_no_gsl" )
, exitcode_skipped_no_music_name( "skipped_no_music" )
, exitcode_skipped_no_boost_name( "skipped_no_boost" )
, exitcode_scripterror_name( "scripterror" )
, exitcode_abort_name( "abort" )
, exitcode_userabort_name( "userabort" )
Expand Down Expand Up @@ -330,6 +332,12 @@ SLIStartup::init( SLIInterpreter* i )
statusdict->insert( have_music_name, Token( new BoolDatum( false ) ) );
#endif

#ifdef HAVE_BOOST
statusdict->insert( have_boost_name, Token( new BoolDatum( true ) ) );
#else
statusdict->insert( have_boost_name, Token( new BoolDatum( false ) ) );
#endif

#ifdef HAVE_LIBNEUROSIM
statusdict->insert( have_libneurosim_name, Token( new BoolDatum( true ) ) );
#else
Expand Down Expand Up @@ -382,6 +390,7 @@ SLIStartup::init( SLIInterpreter* i )
exitcodes->insert( exitcode_skipped_no_threading_name, Token( new IntegerDatum( EXITCODE_SKIPPED_NO_THREADING ) ) );
exitcodes->insert( exitcode_skipped_no_gsl_name, Token( new IntegerDatum( EXITCODE_SKIPPED_NO_GSL ) ) );
exitcodes->insert( exitcode_skipped_no_music_name, Token( new IntegerDatum( EXITCODE_SKIPPED_NO_MUSIC ) ) );
exitcodes->insert( exitcode_skipped_no_boost_name, Token( new IntegerDatum( EXITCODE_SKIPPED_NO_BOOST ) ) );
exitcodes->insert( exitcode_scripterror_name, Token( new IntegerDatum( EXITCODE_SCRIPTERROR ) ) );
exitcodes->insert( exitcode_abort_name, Token( new IntegerDatum( NEST_EXITCODE_ABORT ) ) );
exitcodes->insert( exitcode_userabort_name, Token( new IntegerDatum( EXITCODE_USERABORT ) ) );
Expand Down
3 changes: 3 additions & 0 deletions sli/slistartup.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#define EXITCODE_SKIPPED_NO_THREADING 203
#define EXITCODE_SKIPPED_NO_GSL 204
#define EXITCODE_SKIPPED_NO_MUSIC 205
#define EXITCODE_SKIPPED_NO_BOOST 206


class SLIStartup : public SLIModule
Expand Down Expand Up @@ -108,6 +109,7 @@ class SLIStartup : public SLIModule
Name ismpi_name;
Name have_gsl_name;
Name have_music_name;
Name have_boost_name;
Name have_libneurosim_name;
Name have_sionlib_name;
Name have_hdf5_name;
Expand All @@ -127,6 +129,7 @@ class SLIStartup : public SLIModule
Name exitcode_skipped_no_threading_name;
Name exitcode_skipped_no_gsl_name;
Name exitcode_skipped_no_music_name;
Name exitcode_skipped_no_boost_name;
Name exitcode_scripterror_name;
Name exitcode_abort_name;
Name exitcode_userabort_name;
Expand Down
6 changes: 6 additions & 0 deletions testsuite/pytests/test_iaf_bw_2001.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import numpy.testing as nptest
import pytest

HAVE_BOOST = nest.ll_api.sli_func("statusdict/have_boost ::")


w_ex = 40.0
w_in = 15.0

Expand Down Expand Up @@ -64,6 +67,7 @@ def spiketrain_response(t, tau, spiketrain, w):
return response


@pytest.mark.skipif(not HAVE_BOOST, reason="Boost is not available")
def test_iaf_bw_2001():
"""
Creates 4 neurons.
Expand Down Expand Up @@ -162,6 +166,7 @@ def test_iaf_bw_2001():
nptest.assert_array_almost_equal(gaba_soln, mm_bw1.events["s_GABA"])


@pytest.mark.skipif(not HAVE_BOOST, reason="Boost is not available")
def test_approximation_I_NMDA_V_m():
"""
Creates 3 neurons.
Expand Down Expand Up @@ -221,6 +226,7 @@ def test_approximation_I_NMDA_V_m():
assert np.max(np.abs(mm_approx.events["V_m"] - mm_exact.events["V_m"])) < 0.25


@pytest.mark.skipif(not HAVE_BOOST, reason="Boost is not available")
def test_illegal_connection_error():
"""
Test that connecting with NMDA synapses from iaf_cond_exp throws error.
Expand Down
Loading