Skip to content
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

PyNEST-NG: Fix CI and some tests #71

Merged
merged 27 commits into from
Sep 25, 2023
Merged

Conversation

nicolossus
Copy link

@nicolossus nicolossus commented Sep 22, 2023

Tests still failing and description of bugs

Current testsuite summary:

  ----------------------------------------------------------------------
  NEST Testsuite Results
  ----------------------------------------------------------------------
  Phase                    Tests   Skipped  Failures    Errors      Time
  ----------------------------------------------------------------------
  07 pynesttests            2642         6        38         1     124.8
  08 cpptests                 29         0         0         0       0.0
  ----------------------------------------------------------------------
  Total                     2671         6        38         1     124.8
  ----------------------------------------------------------------------

test_parameter_operators.py

  • Bug: Creating NEST Parameters as integers fails
nest.CreateParameter("constant", {"value": 2})

>>> NESTErrors.TypeMismatch: Expected datatype: Failed to cast
>>> 'value' from long to type double
  • Flow:
// hl_api_types.py
def CreateParameter(parametertype, specs):
  return nestkernel.llapi_create_parameter({parametertype: specs})

// nestkernel_api.pyx
def llapi_create_parameter(object specs):
    cdef dictionary specs_dictionary = pydict_to_dictionary(specs)
    cdef ParameterPTR parameter
    parameter = create_parameter(specs_dictionary)
    obj = ParameterObject()
    obj._set_parameter(parameter)
    return nest.Parameter(obj)

// nest.cpp
ParameterPTR
create_parameter( const dictionary& param_dict )
{
  const auto n = param_dict.begin()->first;
  const auto pdict = param_dict.get< dictionary >( n );
  pdict.init_access_flags();
  auto parameter = create_parameter( n, pdict );
  pdict.all_entries_accessed( "create_parameter", "param" );
  return parameter;
}

ParameterPTR
create_parameter( const std::string& name, const dictionary& d )
{
  // The parameter factory will create the parameter
  return ParameterPTR( parameter_factory_().create( name, d ) );  // fails here
}

// ParameterFactory = GenericFactory< Parameter >;
ParameterFactory&
parameter_factory_( void )
{
  static ParameterFactory factory;
  return factory;
}


// generic_factory.h
template < class BaseT >
inline BaseT*
GenericFactory< BaseT >::create( const std::string& name, const dictionary& d ) const
{
  typename AssocMap::const_iterator i = associations_.find( name );
  std::cerr << "Factory name " << name << "\n";
  if ( i != associations_.end() )
  {
    return ( i->second )( d );
  }
  throw UndefinedName( name );
}

/*
Exception thrown by cast_value_() in dictionary.h

Note that we never enter any of the
 - create_parameter( const boost::any& value )
 - create_parameter( const double value )
 - create_parameter( const int value )
 - ...
*/

test_mip_corrdet.py

  • Bug:
    • fails the if ( not t_sim.is_grid_time() ) check in nest.cpp
# One extra time step so that after conversion to deliver-events-first logic
# final spikes are delivered as in NEST 3 up to NEST 3.5.
nest.Simulate(100000.0 + nest.resolution)

>>> NESTErrors.BadParameter: The simulation time must be a multiple of
>>> the simulation resolution.

Further experimentation:

n = nest.Create("iaf_psc_alpha")
nest.Connect(n, n)
# nest.Simulate(10.0)  # OK
# nest.Simulate(100_000.0)  # OK
# nest.Simulate(10.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(10.1 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(100.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(100.1 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(1000.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(1000.1 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(10_000.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(10_000.1 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(20_000.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(20_000.1 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(30_000.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(30_000.1 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(30_000.5 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(32_767.0 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(32_767.1 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(32_767.5 + nest.resolution)  # OK but warning about not being multiple of min_delay
# nest.Simulate(32_768.0 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(32_769.0 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(33_000.0 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(40_000.0 + nest.resolution)  # NESTErrors.BadParameter
# nest.Simulate(60_000.0 + nest.resolution)  # NESTErrors.BadParameter
nest.Simulate(100_000.0 + nest.resolution)  # NESTErrors.BadParameter

test_multisynapse_models.py, test_issue_1140.py

  • Bug: Not possible to set empty parameters.

test_sinusoidal_poisson_generator.py

  • Behavior change: test_set_individual_spike_trains_on_creation() now raises error.
    • If intended, easy to fix test using pytest.raises context

In test_sp/

test_conn_builder.py, test_disconnect_multiple.py, (test_sp_autapses_multapses.py)

  • Bug: Raises NESTErrors.UnaccessedDictionaryEntry: Unaccessed elements in syn_spec, in function Connect: post_synaptic_element pre_synaptic_element
    • I.e., all entries in syn_spec are either not accessed or access is not properly registered
  • Same bug probably the reason test_sp_autapses_multapses.py fails

In test_spatial/

test_create_spatial.py, test_layer_get_set.py, test_mask_anchors_boundaries.py, test_spatial_distributions.py

  • Bug: Seems to be several bugs in the spatial module. Needs closer inspection.

@jougs jougs merged commit 1fe7317 into jougs:new-pynest Sep 25, 2023
16 of 21 checks passed
@nicolossus nicolossus deleted the new-pynest-nico branch September 26, 2023 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants