Advertisement
Tioz90

Untitled

Nov 16th, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 60.09 KB | None | 0 0
  1. Last login: Tue Nov 16 12:23:37 on ttys001
  2. (base) thomastiotto@mac-mini ~ % conda activate brian
  3. overriding CC,CLANG with gcc, and CLANGXX,CXX with g++
  4. (brian) thomastiotto@mac-mini ~ % $CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh
  5. (brian) thomastiotto@mac-mini ~ % python
  6. Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:25:50)
  7. [Clang 11.1.0 ] on darwin
  8. Type "help", "copyright", "credits" or "license" for more information.
  9. >>> import brian2
  10. >>> brian2.test('cython', test_codegen_independent=False, additional_args=['-x'])
  11. Running tests in /Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/brian2 for targets cython (excluding long tests)
  12. Running Brian version 2.4.2 from '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/brian2'
  13. Resetting to default preferences
  14.  
  15. Running tests for target cython:
  16. F
  17. =================================== FAILURES ===================================
  18. _______________________________ test_active_flag _______________________________
  19.  
  20. self = <distutils.unixccompiler.UnixCCompiler object at 0x11ecd6670>
  21. obj = '/Users/thomastiotto/Library/Caches/cython/brian_extensions/Users/thomastiotto/Library/Caches/cython/brian_extensions/_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2.o'
  22. src = '/Users/thomastiotto/Library/Caches/cython/brian_extensions/_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2.cpp'
  23. ext = '.cpp'
  24. cc_args = ['-I/Users/thomastiotto/mambaforge/envs/brian/include', '-I/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/sit...an/lib/python3.8/site-packages/brian2/synapses', '-I/Users/thomastiotto/mambaforge/envs/brian/include/python3.8', '-c']
  25. extra_postargs = ['-w', '-O3', '-ffast-math', '-fno-finite-math-only', '-march=native', '-std=c++11', ...]
  26. pp_opts = ['-I/Users/thomastiotto/mambaforge/envs/brian/include', '-I/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/sit...vs/brian/lib/python3.8/site-packages/brian2/synapses', '-I/Users/thomastiotto/mambaforge/envs/brian/include/python3.8']
  27.  
  28.     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
  29.         compiler_so = self.compiler_so
  30.         if sys.platform == 'darwin':
  31.             compiler_so = _osx_support.compiler_fixup(compiler_so,
  32.                                                     cc_args + extra_postargs)
  33.         try:
  34. >           self.spawn(compiler_so + cc_args + [src, '-o', obj] +
  35.                        extra_postargs)
  36.  
  37. mambaforge/envs/brian/lib/python3.8/distutils/unixccompiler.py:117:
  38. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  39.  
  40. self = <distutils.unixccompiler.UnixCCompiler object at 0x11ecd6670>
  41. cmd = ['gcc', '-Wno-unused-result', '-Wsign-compare', '-Wunreachable-code', '-DNDEBUG', '-g', ...]
  42.  
  43.     def spawn(self, cmd):
  44. >       spawn(cmd, dry_run=self.dry_run)
  45.  
  46. mambaforge/envs/brian/lib/python3.8/distutils/ccompiler.py:910:
  47. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  48.  
  49. cmd = ['gcc', '-Wno-unused-result', '-Wsign-compare', '-Wunreachable-code', '-DNDEBUG', '-g', ...]
  50. search_path = 1, verbose = 0, dry_run = 0
  51.  
  52.     def spawn(cmd, search_path=1, verbose=0, dry_run=0):
  53.         """Run another program, specified as a command list 'cmd', in a new process.
  54.  
  55.        'cmd' is just the argument list for the new process, ie.
  56.        cmd[0] is the program to run and cmd[1:] are the rest of its arguments.
  57.        There is no way to run a program with a name different from that of its
  58.        executable.
  59.  
  60.        If 'search_path' is true (the default), the system's executable
  61.        search path will be used to find the program; otherwise, cmd[0]
  62.        must be the exact path to the executable.  If 'dry_run' is true,
  63.        the command will not actually be run.
  64.  
  65.        Raise DistutilsExecError if running the program fails in any way; just
  66.        return on success.
  67.        """
  68.         # cmd is documented as a list, but just in case some code passes a tuple
  69.         # in, protect our %-formatting code against horrible death
  70.         cmd = list(cmd)
  71.         if os.name == 'posix':
  72. >           _spawn_posix(cmd, search_path, dry_run=dry_run)
  73.  
  74. mambaforge/envs/brian/lib/python3.8/distutils/spawn.py:36:
  75. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  76.  
  77. cmd = 'gcc', search_path = 1, verbose = 0, dry_run = 0
  78.  
  79.     def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0):
  80.         log.info(' '.join(cmd))
  81.         if dry_run:
  82.             return
  83.         executable = cmd[0]
  84.         exec_fn = search_path and os.execvp or os.execv
  85.         env = None
  86.         if sys.platform == 'darwin':
  87.             global _cfg_target, _cfg_target_split
  88.             if _cfg_target is None:
  89.                 from distutils import sysconfig
  90.                 _cfg_target = sysconfig.get_config_var(
  91.                                       'MACOSX_DEPLOYMENT_TARGET') or ''
  92.                 if _cfg_target:
  93.                     _cfg_target_split = [int(x) for x in _cfg_target.split('.')]
  94.             if _cfg_target:
  95.                 # ensure that the deployment target of build process is not less
  96.                 # than that used when the interpreter was built. This ensures
  97.                 # extension modules are built with correct compatibility values
  98.                 cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
  99.                 if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
  100.                     my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
  101.                               'now "%s" but "%s" during configure'
  102.                                     % (cur_target, _cfg_target))
  103.                     raise DistutilsPlatformError(my_msg)
  104.                 env = dict(os.environ,
  105.                            MACOSX_DEPLOYMENT_TARGET=cur_target)
  106.                 exec_fn = search_path and os.execvpe or os.execve
  107.         pid = os.fork()
  108.         if pid == 0: # in the child
  109.             try:
  110.                 if env is None:
  111.                     exec_fn(executable, cmd)
  112.                 else:
  113.                     exec_fn(executable, cmd, env)
  114.             except OSError as e:
  115.                 if not DEBUG:
  116.                     cmd = executable
  117.                 sys.stderr.write("unable to execute %r: %s\n"
  118.                                  % (cmd, e.strerror))
  119.                 os._exit(1)
  120.  
  121.             if not DEBUG:
  122.                 cmd = executable
  123.             sys.stderr.write("unable to execute %r for unknown reasons" % cmd)
  124.             os._exit(1)
  125.         else: # in the parent
  126.             # Loop until the child either exits or is terminated by a signal
  127.             # (ie. keep waiting if it's merely stopped)
  128.             while True:
  129.                 try:
  130.                     pid, status = os.waitpid(pid, 0)
  131.                 except OSError as exc:
  132.                     if not DEBUG:
  133.                         cmd = executable
  134.                     raise DistutilsExecError(
  135.                           "command %r failed: %s" % (cmd, exc.args[-1]))
  136.                 if os.WIFSIGNALED(status):
  137.                     if not DEBUG:
  138.                         cmd = executable
  139.                     raise DistutilsExecError(
  140.                           "command %r terminated by signal %d"
  141.                           % (cmd, os.WTERMSIG(status)))
  142.                 elif os.WIFEXITED(status):
  143.                     exit_status = os.WEXITSTATUS(status)
  144.                     if exit_status == 0:
  145.                         return   # hey, it succeeded!
  146.                     else:
  147.                         if not DEBUG:
  148.                             cmd = executable
  149. >                       raise DistutilsExecError(
  150.                               "command %r failed with exit status %d"
  151. E                             distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
  152.  
  153. mambaforge/envs/brian/lib/python3.8/distutils/spawn.py:157: DistutilsExecError
  154.  
  155. During handling of the above exception, another exception occurred:
  156.  
  157. self = MagicNetwork()
  158. run_namespace = {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/thomas...e-packages/_pytest/assertion/rewrite.py'>, 'ALLOW_THREADS': 1, 'Annotation': <class 'matplotlib.text.Annotation'>, ...}
  159.  
  160.     @device_override('network_before_run')
  161.     def before_run(self, run_namespace):
  162.         '''
  163.        before_run(namespace)
  164.  
  165.        Prepares the `Network` for a run.
  166.  
  167.        Objects in the `Network` are sorted into the correct running order, and
  168.        their `BrianObject.before_run` methods are called.
  169.  
  170.        Parameters
  171.        ----------
  172.        run_namespace : dict-like, optional
  173.            A namespace in which objects which do not define their own
  174.            namespace will be run.
  175.        '''
  176.         all_objects = self.sorted_objects
  177.         prefs.check_all_validated()
  178.  
  179.         # Check names in the network for uniqueness
  180.         names = [obj.name for obj in all_objects]
  181.         non_unique_names = [name for name, count in Counter(names).items()
  182.                             if count > 1]
  183.         if len(non_unique_names):
  184.             formatted_names = ', '.join("'%s'" % name
  185.                                         for name in non_unique_names)
  186.             raise ValueError('All objects in a network need to have unique '
  187.                              'names, the following name(s) were used more than '
  188.                              'once: %s' % formatted_names)
  189.  
  190.         # Check that there are no SummedVariableUpdaters targeting the same
  191.         # target variable
  192.         _check_multiple_summed_updaters(all_objects)
  193.  
  194.         self._stopped = False
  195.         Network._globally_stopped = False
  196.  
  197.         device = get_device()
  198.         if device.network_schedule is not None:
  199.             # The device defines a fixed network schedule
  200.             if device.network_schedule != self.schedule:
  201.                 # TODO: The human-readable name of a device should be easier to get
  202.                 device_name = list(all_devices.keys())[list(all_devices.values()).index(device)]
  203.                 logger.warn(("The selected device '{device_name}' only "
  204.                              "supports a fixed schedule, but this schedule is "
  205.                              "not consistent with the network's schedule. The "
  206.                              "simulation will use the device's schedule.\n"
  207.                              "Device schedule: {device.network_schedule}\n"
  208.                              "Network schedule: {net.schedule}\n"
  209.                              "Set the network schedule explicitly or set the "
  210.                              "core.network.default_schedule preference to "
  211.                              "avoid this warning.").format(device_name=device_name,
  212.                                                            device=device,
  213.                                                            net=self),
  214.                             name_suffix='schedule_conflict', once=True)
  215.  
  216.         logger.debug("Preparing network {self.name} with {numobj} "
  217.                      "objects: {objnames}".format(self=self,
  218.                         numobj=len(all_objects),
  219.                         objnames=', '.join(obj.name for obj in all_objects)),
  220.                      "before_run")
  221.  
  222.         self.check_dependencies()
  223.  
  224.         for obj in all_objects:
  225.             if obj.active:
  226.                 try:
  227. >                   obj.before_run(run_namespace)
  228.  
  229. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/network.py:897:
  230. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  231.  
  232. self = StateUpdater(clock=Clock(dt=100. * usecond, name='defaultclock'), when=groups, order=0, name='neurongroup_stateupdater')
  233. run_namespace = {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/thomas...e-packages/_pytest/assertion/rewrite.py'>, 'ALLOW_THREADS': 1, 'Annotation': <class 'matplotlib.text.Annotation'>, ...}
  234.  
  235.     def before_run(self, run_namespace):
  236. >       self.create_code_objects(run_namespace)
  237.  
  238. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/groups/group.py:1143:
  239. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  240.  
  241. self = StateUpdater(clock=Clock(dt=100. * usecond, name='defaultclock'), when=groups, order=0, name='neurongroup_stateupdater')
  242. run_namespace = {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/thomas...e-packages/_pytest/assertion/rewrite.py'>, 'ALLOW_THREADS': 1, 'Annotation': <class 'matplotlib.text.Annotation'>, ...}
  243.  
  244.     def create_code_objects(self, run_namespace):
  245.         # By default, we only have one code object for each CodeRunner.
  246.         # Overwrite this function to use more than one.
  247. >       code_object = self.create_default_code_object(run_namespace)
  248.  
  249. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/groups/group.py:1136:
  250. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  251.  
  252. self = StateUpdater(clock=Clock(dt=100. * usecond, name='defaultclock'), when=groups, order=0, name='neurongroup_stateupdater')
  253. run_namespace = {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/thomas...e-packages/_pytest/assertion/rewrite.py'>, 'ALLOW_THREADS': 1, 'Annotation': <class 'matplotlib.text.Annotation'>, ...}
  254.  
  255.     def create_default_code_object(self, run_namespace):
  256.         self.update_abstract_code(run_namespace=run_namespace)
  257.         # If the CodeRunner has variables, add them
  258.         if hasattr(self, 'variables'):
  259.             additional_variables = self.variables
  260.         else:
  261.             additional_variables = None
  262.  
  263.         if not self.generate_empty_code and len(self.abstract_code) == 0:
  264.             self.codeobj = None
  265.         else:
  266. >           self.codeobj = create_runner_codeobj(group=self.group,
  267.                                                  code=self.abstract_code,
  268.                                                  user_code=self.user_code,
  269.                                                  template_name=self.template,
  270.                                                  name=self.name + '_codeobject*',
  271.                                                  check_units=self.check_units,
  272.                                                  additional_variables=additional_variables,
  273.                                                  needed_variables=self.needed_variables,
  274.                                                  run_namespace=run_namespace,
  275.                                                  template_kwds=self.template_kwds,
  276.                                                  override_conditional_write=self.override_conditional_write,
  277.                                                  codeobj_class=self.codeobj_class
  278.                                                  )
  279.  
  280. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/groups/group.py:1118:
  281. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  282.  
  283. group = <weakproxy at 0x11e5e07c0 to NeuronGroup at 0x11eab3d60>
  284. code = {None: '_v = dt/ms + v\nv = _v'}, template_name = 'stateupdate'
  285. run_namespace = {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/thomas...e-packages/_pytest/assertion/rewrite.py'>, 'ALLOW_THREADS': 1, 'Annotation': <class 'matplotlib.text.Annotation'>, ...}
  286. user_code = {None: 'v = 1/ms'}, variable_indices = None
  287. name = 'neurongroup_stateupdater_codeobject*', check_units = False
  288. needed_variables = [], additional_variables = None, template_kwds = None
  289. override_conditional_write = set()
  290. codeobj_class = <class 'brian2.codegen.runtime.cython_rt.cython_rt.CythonCodeObject'>
  291.  
  292.     def create_runner_codeobj(group, code, template_name,
  293.                               run_namespace,
  294.                               user_code=None,
  295.                               variable_indices=None,
  296.                               name=None, check_units=True,
  297.                               needed_variables=None,
  298.                               additional_variables=None,
  299.                               template_kwds=None,
  300.                               override_conditional_write=None,
  301.                               codeobj_class=None
  302.                               ):
  303.         ''' Create a `CodeObject` for the execution of code in the context of a
  304.        `Group`.
  305.  
  306.        Parameters
  307.        ----------
  308.        group : `Group`
  309.            The group where the code is to be run
  310.        code : str or dict of str
  311.            The code to be executed.
  312.        template_name : str
  313.            The name of the template to use for the code.
  314.        run_namespace : dict-like
  315.            An additional namespace that is used for variable lookup (either
  316.            an explicitly defined namespace or one taken from the local
  317.            context).
  318.        user_code : str, optional
  319.            The code that had been specified by the user before other code was
  320.            added automatically. If not specified, will be assumed to be identical
  321.            to ``code``.
  322.        variable_indices : dict-like, optional
  323.            A mapping from `Variable` objects to index names (strings).  If none is
  324.            given, uses the corresponding attribute of `group`.
  325.        name : str, optional
  326.            A name for this code object, will use ``group + '_codeobject*'`` if
  327.            none is given.
  328.        check_units : bool, optional
  329.            Whether to check units in the statement. Defaults to ``True``.
  330.        needed_variables: list of str, optional
  331.            A list of variables that are neither present in the abstract code, nor
  332.            in the ``USES_VARIABLES`` statement in the template. This is only
  333.            rarely necessary, an example being a `StateMonitor` where the
  334.            names of the variables are neither known to the template nor included
  335.            in the abstract code statements.
  336.        additional_variables : dict-like, optional
  337.            A mapping of names to `Variable` objects, used in addition to the
  338.            variables saved in `group`.
  339.        template_kwds : dict, optional
  340.            A dictionary of additional information that is passed to the template.
  341.        override_conditional_write: list of str, optional
  342.            A list of variable names which are used as conditions (e.g. for
  343.            refractoriness) which should be ignored.
  344.        codeobj_class : class, optional
  345.            The `CodeObject` class to run code with. If not specified, defaults to
  346.            the `group`'s ``codeobj_class`` attribute.
  347.         '''
  348.  
  349.        if name is None:
  350.            if group is not None:
  351.                name = '%s_%s_codeobject*' % (group.name, template_name)
  352.            else:
  353.                name = '%s_codeobject*' % template_name
  354.  
  355.        if user_code is None:
  356.            user_code = code
  357.  
  358.        if isinstance(code, str):
  359.            code = {None: code}
  360.            user_code = {None: user_code}
  361.  
  362.        msg = 'Creating code object (group=%s, template name=%s) for abstract code:\n' % (group.name, template_name)
  363.        msg += indent(code_representation(code))
  364.        logger.diagnostic(msg)
  365.        from brian2.devices import get_device
  366.        device = get_device()
  367.  
  368.        if override_conditional_write is None:
  369.            override_conditional_write = set([])
  370.        else:
  371.            override_conditional_write = set(override_conditional_write)
  372.  
  373.        if codeobj_class is None:
  374.            codeobj_class = device.code_object_class(group.codeobj_class)
  375.        else:
  376.            codeobj_class = device.code_object_class(codeobj_class)
  377.  
  378.        template = getattr(codeobj_class.templater, template_name)
  379.        template_variables = getattr(template, 'variables', None)
  380.  
  381.        all_variables = dict(group.variables)
  382.        if additional_variables is not None:
  383.            all_variables.update(additional_variables)
  384.  
  385.        # Determine the identifiers that were used
  386.        identifiers = set()
  387.        user_identifiers = set()
  388.        for v, u_v in zip(code.values(), user_code.values()):
  389.            _, uk, u = analyse_identifiers(v, all_variables, recursive=True)
  390.            identifiers |= uk | u
  391.            _, uk, u = analyse_identifiers(u_v, all_variables, recursive=True)
  392.            user_identifiers |= uk | u
  393.  
  394.        # Add variables that are not in the abstract code, nor specified in the
  395.        # template but nevertheless necessary
  396.        if needed_variables is None:
  397.            needed_variables = []
  398.        # Resolve all variables (variables used in the code and variables needed by
  399.        # the template)
  400.        variables = group.resolve_all(identifiers | set(needed_variables) | set(template_variables),
  401.                                      # template variables are not known to the user:
  402.                                      user_identifiers=user_identifiers,
  403.                                      additional_variables=additional_variables,
  404.                                      run_namespace=run_namespace)
  405.        # We raise this error only now, because there is some non-obvious code path
  406.        # where Jinja tries to get a Synapse's "name" attribute via syn['name'],
  407.         # which then triggers the use of the `group_get_indices` template which does
  408.         # not exist for standalone. Putting the check for template == None here
  409.         # means we will first raise an error about the unknown identifier which will
  410.         # then make Jinja try syn.name
  411.         if template is None:
  412.             codeobj_class_name = codeobj_class.class_name or codeobj_class.__name__
  413.             raise AttributeError(('"%s" does not provide a code generation '
  414.                                   'template "%s"') % (codeobj_class_name,
  415.                                                       template_name))
  416.  
  417.  
  418.         conditional_write_variables = {}
  419.         # Add all the "conditional write" variables
  420.         for var in variables.values():
  421.             cond_write_var = getattr(var, 'conditional_write', None)
  422.             if cond_write_var in override_conditional_write:
  423.                 continue
  424.             if cond_write_var is not None:
  425.                 if (cond_write_var.name in variables and
  426.                         not variables[cond_write_var.name] is cond_write_var):
  427.                     logger.diagnostic(('Variable "%s" is needed for the '
  428.                                        'conditional write mechanism of variable '
  429.                                        '"%s". Its name is already used for %r.') % (cond_write_var.name,
  430.                                                                                     var.name,
  431.                                                                                     variables[cond_write_var.name]))
  432.                 else:
  433.                     conditional_write_variables[cond_write_var.name] = cond_write_var
  434.  
  435.         variables.update(conditional_write_variables)
  436.  
  437.         if check_units:
  438.             for c in code.values():
  439.                 # This is the first time that the code is parsed, catch errors
  440.                 try:
  441.                     check_units_statements(c, variables)
  442.                 except (SyntaxError, ValueError) as ex:
  443.                     error_msg = _error_msg(c, name)
  444.                     raise ValueError(error_msg) from ex
  445.  
  446.         all_variable_indices = copy.copy(group.variables.indices)
  447.         if additional_variables is not None:
  448.             all_variable_indices.update(additional_variables.indices)
  449.         if variable_indices is not None:
  450.             all_variable_indices.update(variable_indices)
  451.  
  452.         # Make "conditional write" variables use the same index as the variable
  453.         # that depends on them
  454.         for varname, var in variables.items():
  455.             cond_write_var = getattr(var, 'conditional_write', None)
  456.             if cond_write_var is not None:
  457.                 all_variable_indices[cond_write_var.name] = all_variable_indices[varname]
  458.  
  459.         # Check that all functions are available
  460.         for varname, value in variables.items():
  461.             if isinstance(value, Function):
  462.                 try:
  463.                     value.implementations[codeobj_class]
  464.                 except KeyError as ex:
  465.                     # if we are dealing with numpy, add the default implementation
  466.                     from brian2.codegen.runtime.numpy_rt import NumpyCodeObject
  467.                     if codeobj_class is NumpyCodeObject:
  468.                         value.implementations.add_numpy_implementation(value.pyfunc)
  469.                     else:
  470.                         raise NotImplementedError(('Cannot use function '
  471.                                                    '%s: %s') % (varname, ex)) from ex
  472.  
  473.         # Gather the additional compiler arguments declared by function
  474.         # implementations
  475.         all_keywords = [_gather_compiler_kwds(var, codeobj_class)
  476.                         for var in variables.values()
  477.                         if isinstance(var, Function)]
  478.         compiler_kwds = _merge_compiler_kwds(all_keywords)
  479.  
  480.         # Add the indices needed by the variables
  481.         for varname in list(variables):
  482.             var_index = all_variable_indices[varname]
  483.             if not var_index in ('_idx', '0'):
  484.                 variables[var_index] = all_variables[var_index]
  485.  
  486. >       return device.code_object(owner=group,
  487.                                   name=name,
  488.                                   abstract_code=code,
  489.                                   variables=variables,
  490.                                   template_name=template_name,
  491.                                   variable_indices=all_variable_indices,
  492.                                   template_kwds=template_kwds,
  493.                                   codeobj_class=codeobj_class,
  494.                                   override_conditional_write=override_conditional_write,
  495.                                   compiler_kwds=compiler_kwds
  496.                                   )
  497.  
  498. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/codegen/codeobject.py:441:
  499. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  500.  
  501. self = <brian2.devices.device.RuntimeDevice object at 0x11b8e19d0>
  502. owner = <weakproxy at 0x11e5e07c0 to NeuronGroup at 0x11eab3d60>
  503. name = 'neurongroup_stateupdater_codeobject'
  504. abstract_code = {None: '_v = dt/ms + v\nv = _v'}
  505. variables = {'N': <Constant(dimensions=Dimension(),  dtype=int64, scalar=True, constant=True, read_only=True)>, 'dt': <ArrayVariab...ly=True)>, 'v': <ArrayVariable(dimensions=Dimension(),  dtype=float64, scalar=False, constant=False, read_only=False)>}
  506. template_name = 'stateupdate'
  507. variable_indices = defaultdict(..., {'N': '0', 't': '0', 'dt': '0', 't_in_timesteps': '0', 'v': '_idx', 'ms': '_idx', '_v': '_idx'})
  508. codeobj_class = <class 'brian2.codegen.runtime.cython_rt.cython_rt.CythonCodeObject'>
  509. template_kwds = {'dt': '_array_defaultclock_dt[0]', 'load_namespace': '_var_N = _namespace["_var_N"]\ncdef int64_t N = _namespace["N"]...group_v\'])\ncdef double v\ncdef double _lio_1\ncdef double _v', 'support_code_lines': [], 'v': '_array_neurongroup_v'}
  510. override_conditional_write = set()
  511. compiler_kwds = defaultdict(<class 'list'>, {})
  512.  
  513.    def code_object(self, owner, name, abstract_code, variables, template_name,
  514.                    variable_indices, codeobj_class=None,
  515.                    template_kwds=None, override_conditional_write=None,
  516.                    compiler_kwds=None):
  517.        if compiler_kwds is None:
  518.            compiler_kwds = {}
  519.        name = find_name(name)
  520.        codeobj_class = self.code_object_class(codeobj_class)
  521.        template = getattr(codeobj_class.templater, template_name)
  522.        iterate_all = template.iterate_all
  523.        generator = codeobj_class.generator_class(variables=variables,
  524.                                                  variable_indices=variable_indices,
  525.                                                  owner=owner,
  526.                                                  iterate_all=iterate_all,
  527.                                                  codeobj_class=codeobj_class,
  528.                                                  override_conditional_write=override_conditional_write,
  529.                                                  allows_scalar_write=template.allows_scalar_write,
  530.                                                  name=name,
  531.                                                  template_name=template_name)
  532.        if template_kwds is None:
  533.            template_kwds = dict()
  534.        else:
  535.            template_kwds = template_kwds.copy()
  536.  
  537.        logger.diagnostic('%s abstract code:\n%s' % (name, indent(code_representation(abstract_code))))
  538.  
  539.        scalar_code, vector_code, kwds = generator.translate(abstract_code,
  540.                                                             dtype=prefs['core.default_float_dtype'])
  541.        # Add the array names as keywords as well
  542.        for varname, var in variables.items():
  543.            if isinstance(var, ArrayVariable):
  544.                pointer_name = generator.get_array_name(var)
  545.                if var.scalar:
  546.                    pointer_name += '[0]'
  547.                template_kwds[varname] = pointer_name
  548.                if hasattr(var, 'resize'):
  549.                    dyn_array_name = generator.get_array_name(var,
  550.                                                              access_data=False)
  551.                    template_kwds['_dynamic_'+varname] = dyn_array_name
  552.  
  553.  
  554.        template_kwds.update(kwds)
  555.        logger.diagnostic('%s snippet (scalar):\n%s' % (name, indent(code_representation(scalar_code))))
  556.        logger.diagnostic('%s snippet (vector):\n%s' % (name, indent(code_representation(vector_code))))
  557.  
  558.        code = template(scalar_code, vector_code,
  559.                        owner=owner, variables=variables, codeobj_name=name,
  560.                        variable_indices=variable_indices,
  561.                        get_array_name=generator.get_array_name,
  562.                        **template_kwds)
  563.        logger.diagnostic('%s code:\n%s' % (name, indent(code_representation(code))))
  564.  
  565.        codeobj = codeobj_class(owner, code, variables, variable_indices,
  566.                                template_name=template_name,
  567.                                template_source=template.template_source,
  568.                                name=name, compiler_kwds=compiler_kwds)
  569. >       codeobj.compile()
  570.  
  571. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/devices/device.py:327:
  572. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  573.  
  574. self = <brian2.codegen.runtime.cython_rt.cython_rt.CythonCodeObject object at 0x11eb28970>
  575.  
  576.    def compile(self):
  577.        for block in ['before_run', 'run', 'after_run']:
  578. >           self.compiled_code[block] = self.compile_block(block)
  579.  
  580. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/codegen/codeobject.py:101:
  581. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  582.  
  583. self = <brian2.codegen.runtime.cython_rt.cython_rt.CythonCodeObject object at 0x11eb28970>
  584. block = 'run'
  585.  
  586.    def compile_block(self, block):
  587.        code = getattr(self.code, block, '').strip()
  588.        if not code or 'EMPTY_CODE_BLOCK' in code:
  589.            return None
  590. >       return cython_extension_manager.create_extension(
  591.            code,
  592.            define_macros=self.define_macros,
  593.            libraries=self.libraries,
  594.            extra_compile_args=self.extra_compile_args,
  595.            extra_link_args=self.extra_link_args,
  596.            include_dirs=self.include_dirs,
  597.            library_dirs=self.library_dirs,
  598.            compiler=self.compiler,
  599.            owner_name=self.owner.name+'_'+self.template_name,
  600.            sources=self.sources
  601.            )
  602.  
  603. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/codegen/runtime/cython_rt/cython_rt.py:143:
  604. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  605.  
  606. self = <brian2.codegen.runtime.cython_rt.extension_manager.CythonExtensionManager object at 0x11b8ef070>
  607. code = '#cython: language_level=3\n#cython: boundscheck=False\n#cython: wraparound=False\n#cython: cdivision=False\n#cython: ...       v = _array_neurongroup_v[_idx]\n        _v = _lio_1 + v\n        v = _v\n        _array_neurongroup_v[_idx] = v'
  608. force = False, name = None, define_macros = []
  609. include_dirs = ['/Users/thomastiotto/mambaforge/envs/brian/include', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/numpy/core/include', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/brian2/synapses']
  610. library_dirs = ['/Users/thomastiotto/mambaforge/envs/brian/lib']
  611. runtime_library_dirs = None
  612. extra_compile_args = ['-w', '-O3', '-ffast-math', '-fno-finite-math-only', '-march=native', '-std=c++11', ...]
  613. extra_link_args = [], libraries = [], compiler = 'unix', sources = []
  614. owner_name = 'neurongroup_stateupdate'
  615.  
  616.     def create_extension(self, code, force=False, name=None,
  617.                          define_macros=None,
  618.                          include_dirs=None,
  619.                          library_dirs=None,
  620.                          runtime_library_dirs=None,
  621.                          extra_compile_args=None,
  622.                          extra_link_args=None,
  623.                          libraries=None,
  624.                          compiler=None,
  625.                          sources=None,
  626.                          owner_name='',
  627.                          ):
  628.         if sources is None:
  629.             sources = []
  630.         self._simplify_paths()
  631.  
  632.         if Cython is None:
  633.             raise ImportError('Cython is not available')
  634.  
  635.         code = deindent(code)
  636.  
  637.         lib_dir = get_cython_cache_dir()
  638.         if '~' in lib_dir:
  639.             lib_dir = os.path.expanduser(lib_dir)
  640.         try:
  641.             os.makedirs(lib_dir)
  642.         except OSError:
  643.             if not os.path.exists(lib_dir):
  644.                 raise IOError("Couldn't create Cython cache directory '%s', try setting the "
  645.                               "cache directly with prefs.codegen.runtime.cython.cache_dir." % lib_dir)
  646.  
  647.         numpy_version = '.'.join(numpy.__version__.split('.')[:2])  # Only use major.minor version
  648.         key = code, sys.version_info, sys.executable, Cython.__version__, numpy_version
  649.  
  650.         if force:
  651.             # Force a new module name by adding the current time to the
  652.             # key which is hashed to determine the module name.
  653.             key += time.time(),
  654.  
  655.         if key in self._code_cache:
  656.             return self._code_cache[key]
  657.  
  658.         if name is not None:
  659.             module_name = name#py3compat.unicode_to_str(args.name)
  660.         else:
  661.             module_name = "_cython_magic_" + hashlib.md5(str(key).encode('utf-8')).hexdigest()
  662.         if owner_name:
  663.             logger.diagnostic('"{owner_name}" using Cython module "{module_name}"'.format(owner_name=owner_name,
  664.                                                                                      module_name=module_name))
  665.  
  666.  
  667.         module_path = os.path.join(lib_dir, module_name + self.so_ext)
  668.  
  669.         if prefs['codegen.runtime.cython.multiprocess_safe']:
  670.             lock = FileLock(os.path.join(lib_dir, module_name + '.lock'))
  671.             with lock:
  672. >               module = self._load_module(module_path,
  673.                                            define_macros=define_macros,
  674.                                            include_dirs=include_dirs,
  675.                                            library_dirs=library_dirs,
  676.                                            extra_compile_args=extra_compile_args,
  677.                                            extra_link_args=extra_link_args,
  678.                                            libraries=libraries,
  679.                                            code=code,
  680.                                            lib_dir=lib_dir,
  681.                                            module_name=module_name,
  682.                                            runtime_library_dirs=runtime_library_dirs,
  683.                                            compiler=compiler,
  684.                                            key=key,
  685.                                            sources=sources)
  686.  
  687. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/codegen/runtime/cython_rt/extension_manager.py:112:
  688. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  689.  
  690. self = <brian2.codegen.runtime.cython_rt.extension_manager.CythonExtensionManager object at 0x11b8ef070>
  691. module_path = '/Users/thomastiotto/Library/Caches/cython/brian_extensions/_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2.cpython-38-darwin.so'
  692. define_macros = []
  693. include_dirs = ['/Users/thomastiotto/mambaforge/envs/brian/include', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/numpy/core/include', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/brian2/synapses']
  694. library_dirs = ['/Users/thomastiotto/mambaforge/envs/brian/lib']
  695. extra_compile_args = ['-w', '-O3', '-ffast-math', '-fno-finite-math-only', '-march=native', '-std=c++11', ...]
  696. extra_link_args = [], libraries = []
  697. code = '#cython: language_level=3\n#cython: boundscheck=False\n#cython: wraparound=False\n#cython: cdivision=False\n#cython: ...       v = _array_neurongroup_v[_idx]\n        _v = _lio_1 + v\n        v = _v\n        _array_neurongroup_v[_idx] = v'
  698. lib_dir = '/Users/thomastiotto/Library/Caches/cython/brian_extensions'
  699. module_name = '_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2'
  700. runtime_library_dirs = None, compiler = 'unix'
  701. key = ('#cython: language_level=3\n#cython: boundscheck=False\n#cython: wraparound=False\n#cython: cdivision=False\n#cython:..., micro=12, releaselevel='final', serial=0), '/Users/thomastiotto/mambaforge/envs/brian/bin/python', '0.29.24', '1.21')
  702. sources = []
  703.  
  704.    def _load_module(self, module_path, define_macros, include_dirs, library_dirs,
  705.                     extra_compile_args, extra_link_args, libraries, code,
  706.                     lib_dir, module_name, runtime_library_dirs, compiler,
  707.                     key, sources):
  708.        have_module = os.path.isfile(module_path)
  709.  
  710.        if not have_module:
  711.            if define_macros is None:
  712.                define_macros = []
  713.            if include_dirs is None:
  714.                include_dirs = []
  715.            if library_dirs is None:
  716.                library_dirs = []
  717.            if extra_compile_args is None:
  718.                extra_compile_args = []
  719.            if extra_link_args is None:
  720.                extra_link_args = []
  721.            if libraries is None:
  722.                libraries = []
  723.  
  724.            c_include_dirs = include_dirs
  725.            if 'numpy' in code:
  726.                import numpy
  727.                c_include_dirs.append(numpy.get_include())
  728.  
  729.            # TODO: We should probably have a special folder just for header
  730.            # files that are shared between different codegen targets
  731.            import brian2.synapses as synapses
  732.            synapses_dir = os.path.dirname(synapses.__file__)
  733.            c_include_dirs.append(synapses_dir)
  734.  
  735.            pyx_file = os.path.join(lib_dir, module_name + '.pyx')
  736.            # ignore Python 3 unicode stuff for the moment
  737.            #pyx_file = py3compat.cast_bytes_py2(pyx_file, encoding=sys.getfilesystemencoding())
  738.            #with io.open(pyx_file, 'w', encoding='utf-8') as f:
  739.            #    f.write(code)
  740.            with open(pyx_file, 'w') as f:
  741.                f.write(code)
  742.  
  743.            for source in sources:
  744.                if not source.lower().endswith('.pyx'):
  745.                    raise ValueError('Additional Cython source files need to '
  746.                                     'have an .pyx ending')
  747.                # Copy source and header file (if present) to library directory
  748.                shutil.copyfile(source, os.path.join(lib_dir,
  749.                                                     os.path.basename(source)))
  750.                name_without_ext = os.path.splitext(os.path.basename(source))[0]
  751.                header_name = name_without_ext + '.pxd'
  752.                if os.path.exists(os.path.join(os.path.dirname(source), header_name)):
  753.                    shutil.copyfile(os.path.join(os.path.dirname(source), header_name),
  754.                                    os.path.join(lib_dir, header_name))
  755.            final_sources = [os.path.join(lib_dir, os.path.basename(source))
  756.                             for source in sources]
  757.            extension = Extension(
  758.                name=module_name,
  759.                sources=[pyx_file],
  760.                define_macros=define_macros,
  761.                include_dirs=c_include_dirs,
  762.                library_dirs=library_dirs,
  763.                runtime_library_dirs=runtime_library_dirs,
  764.                extra_compile_args=extra_compile_args,
  765.                extra_link_args=extra_link_args,
  766.                libraries=libraries,
  767.                language='c++')
  768.            build_extension = self._get_build_extension(compiler=compiler)
  769.            try:
  770.                opts = dict(
  771.                    quiet=True,
  772.                    annotate=False,
  773.                    force=True,
  774.                    )
  775.                # suppresses the output on stdout
  776.                with std_silent():
  777.                    build_extension.extensions = Cython_Build.cythonize([extension] + final_sources, **opts)
  778.  
  779.                    build_extension.build_temp = os.path.dirname(pyx_file)
  780.                    build_extension.build_lib = lib_dir
  781. >                   build_extension.run()
  782.  
  783. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/codegen/runtime/cython_rt/extension_manager.py:258:
  784. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  785.  
  786. self = <distutils.command.build_ext.build_ext object at 0x11eceeac0>
  787.  
  788.    def run(self):
  789.        from distutils.ccompiler import new_compiler
  790.  
  791.        # 'self.extensions', as supplied by setup.py, is a list of
  792.        # Extension instances.  See the documentation for Extension (in
  793.        # distutils.extension) for details.
  794.        #
  795.        # For backwards compatibility with Distutils 0.8.2 and earlier, we
  796.        # also allow the 'extensions' list to be a list of tuples:
  797.        #    (ext_name, build_info)
  798.        # where build_info is a dictionary containing everything that
  799.        # Extension instances do except the name, with a few things being
  800.        # differently named.  We convert these 2-tuples to Extension
  801.        # instances as needed.
  802.  
  803.        if not self.extensions:
  804.            return
  805.  
  806.        # If we were asked to build any C/C++ libraries, make sure that the
  807.        # directory where we put them is in the library search path for
  808.        # linking extensions.
  809.        if self.distribution.has_c_libraries():
  810.            build_clib = self.get_finalized_command('build_clib')
  811.            self.libraries.extend(build_clib.get_library_names() or [])
  812.            self.library_dirs.append(build_clib.build_clib)
  813.  
  814.        # Setup the CCompiler object that we'll use to do all the
  815.         # compiling and linking
  816.         self.compiler = new_compiler(compiler=self.compiler,
  817.                                      verbose=self.verbose,
  818.                                      dry_run=self.dry_run,
  819.                                      force=self.force)
  820.         customize_compiler(self.compiler)
  821.         # If we are cross-compiling, init the compiler now (if we are not
  822.         # cross-compiling, init would not hurt, but people may rely on
  823.         # late initialization of compiler even if they shouldn't...)
  824.         if os.name == 'nt' and self.plat_name != get_platform():
  825.             self.compiler.initialize(self.plat_name)
  826.  
  827.         # And make sure that any compile/link-related options (which might
  828.         # come from the command-line or from the setup script) are set in
  829.         # that CCompiler object -- that way, they automatically apply to
  830.         # all compiling and linking done here.
  831.         if self.include_dirs is not None:
  832.             self.compiler.set_include_dirs(self.include_dirs)
  833.         if self.define is not None:
  834.             # 'define' option is a list of (name,value) tuples
  835.             for (name, value) in self.define:
  836.                 self.compiler.define_macro(name, value)
  837.         if self.undef is not None:
  838.             for macro in self.undef:
  839.                 self.compiler.undefine_macro(macro)
  840.         if self.libraries is not None:
  841.             self.compiler.set_libraries(self.libraries)
  842.         if self.library_dirs is not None:
  843.             self.compiler.set_library_dirs(self.library_dirs)
  844.         if self.rpath is not None:
  845.             self.compiler.set_runtime_library_dirs(self.rpath)
  846.         if self.link_objects is not None:
  847.             self.compiler.set_link_objects(self.link_objects)
  848.  
  849.         # Now actually compile and link everything.
  850. >       self.build_extensions()
  851.  
  852. mambaforge/envs/brian/lib/python3.8/distutils/command/build_ext.py:340:
  853. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  854.  
  855. self = <distutils.command.build_ext.build_ext object at 0x11eceeac0>
  856.  
  857.     def build_extensions(self):
  858.         # First, sanity-check the 'extensions' list
  859.         self.check_extensions_list(self.extensions)
  860.         if self.parallel:
  861.             self._build_extensions_parallel()
  862.         else:
  863. >           self._build_extensions_serial()
  864.  
  865. mambaforge/envs/brian/lib/python3.8/distutils/command/build_ext.py:449:
  866. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  867.  
  868. self = <distutils.command.build_ext.build_ext object at 0x11eceeac0>
  869.  
  870.     def _build_extensions_serial(self):
  871.         for ext in self.extensions:
  872.             with self._filter_build_errors(ext):
  873. >               self.build_extension(ext)
  874.  
  875. mambaforge/envs/brian/lib/python3.8/distutils/command/build_ext.py:474:
  876. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  877.  
  878. self = <distutils.command.build_ext.build_ext object at 0x11eceeac0>
  879. ext = <setuptools.extension.Extension('_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2') at 0x11f104100>
  880.  
  881.     def build_extension(self, ext):
  882.         sources = ext.sources
  883.         if sources is None or not isinstance(sources, (list, tuple)):
  884.             raise DistutilsSetupError(
  885.                   "in 'ext_modules' option (extension '%s'), "
  886.                   "'sources' must be present and must be "
  887.                   "a list of source filenames" % ext.name)
  888.         sources = list(sources)
  889.  
  890.         ext_path = self.get_ext_fullpath(ext.name)
  891.         depends = sources + ext.depends
  892.         if not (self.force or newer_group(depends, ext_path, 'newer')):
  893.             log.debug("skipping '%s' extension (up-to-date)", ext.name)
  894.             return
  895.         else:
  896.             log.info("building '%s' extension", ext.name)
  897.  
  898.         # First, scan the sources for SWIG definition files (.i), run
  899.         # SWIG on 'em to create .c files, and modify the sources list
  900.         # accordingly.
  901.         sources = self.swig_sources(sources, ext)
  902.  
  903.         # Next, compile the source code to object files.
  904.  
  905.         # XXX not honouring 'define_macros' or 'undef_macros' -- the
  906.         # CCompiler API needs to change to accommodate this, and I
  907.         # want to do one thing at a time!
  908.  
  909.         # Two possible sources for extra compiler arguments:
  910.         #   - 'extra_compile_args' in Extension object
  911.         #   - CFLAGS environment variable (not particularly
  912.         #     elegant, but people seem to expect it and I
  913.         #     guess it's useful)
  914.         # The environment variable should take precedence, and
  915.         # any sensible compiler will give precedence to later
  916.         # command line args.  Hence we combine them in order:
  917.         extra_args = ext.extra_compile_args or []
  918.  
  919.         macros = ext.define_macros[:]
  920.         for undef in ext.undef_macros:
  921.             macros.append((undef,))
  922.  
  923. >       objects = self.compiler.compile(sources,
  924.                                          output_dir=self.build_temp,
  925.                                          macros=macros,
  926.                                          include_dirs=ext.include_dirs,
  927.                                          debug=self.debug,
  928.                                          extra_postargs=extra_args,
  929.                                          depends=ext.depends)
  930.  
  931. mambaforge/envs/brian/lib/python3.8/distutils/command/build_ext.py:528:
  932. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  933.  
  934. self = <distutils.unixccompiler.UnixCCompiler object at 0x11ecd6670>
  935. sources = ['/Users/thomastiotto/Library/Caches/cython/brian_extensions/_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2.cpp']
  936. output_dir = '/Users/thomastiotto/Library/Caches/cython/brian_extensions'
  937. macros = []
  938. include_dirs = ['/Users/thomastiotto/mambaforge/envs/brian/include', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/numpy/core/include', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/brian2/synapses']
  939. debug = None, extra_preargs = None
  940. extra_postargs = ['-w', '-O3', '-ffast-math', '-fno-finite-math-only', '-march=native', '-std=c++11', ...]
  941. depends = ['/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/brian2/synapses/stdint_compat.h', '/Users/thom...s.h', '/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h', ...]
  942.  
  943.     def compile(self, sources, output_dir=None, macros=None,
  944.                 include_dirs=None, debug=0, extra_preargs=None,
  945.                 extra_postargs=None, depends=None):
  946.         """Compile one or more source files.
  947.  
  948.        'sources' must be a list of filenames, most likely C/C++
  949.        files, but in reality anything that can be handled by a
  950.        particular compiler and compiler class (eg. MSVCCompiler can
  951.        handle resource files in 'sources').  Return a list of object
  952.        filenames, one per source filename in 'sources'.  Depending on
  953.        the implementation, not all source files will necessarily be
  954.        compiled, but all corresponding object filenames will be
  955.        returned.
  956.  
  957.        If 'output_dir' is given, object files will be put under it, while
  958.        retaining their original path component.  That is, "foo/bar.c"
  959.        normally compiles to "foo/bar.o" (for a Unix implementation); if
  960.        'output_dir' is "build", then it would compile to
  961.        "build/foo/bar.o".
  962.  
  963.        'macros', if given, must be a list of macro definitions.  A macro
  964.        definition is either a (name, value) 2-tuple or a (name,) 1-tuple.
  965.        The former defines a macro; if the value is None, the macro is
  966.        defined without an explicit value.  The 1-tuple case undefines a
  967.        macro.  Later definitions/redefinitions/ undefinitions take
  968.        precedence.
  969.  
  970.        'include_dirs', if given, must be a list of strings, the
  971.        directories to add to the default include file search path for this
  972.        compilation only.
  973.  
  974.        'debug' is a boolean; if true, the compiler will be instructed to
  975.        output debug symbols in (or alongside) the object file(s).
  976.  
  977.        'extra_preargs' and 'extra_postargs' are implementation- dependent.
  978.        On platforms that have the notion of a command-line (e.g. Unix,
  979.        DOS/Windows), they are most likely lists of strings: extra
  980.        command-line arguments to prepend/append to the compiler command
  981.        line.  On other platforms, consult the implementation class
  982.        documentation.  In any event, they are intended as an escape hatch
  983.        for those occasions when the abstract compiler framework doesn't
  984.        cut the mustard.
  985.  
  986.        'depends', if given, is a list of filenames that all targets
  987.        depend on.  If a source file is older than any file in
  988.        depends, then the source file will be recompiled.  This
  989.        supports dependency tracking, but only at a coarse
  990.        granularity.
  991.  
  992.        Raises CompileError on failure.
  993.        """
  994.         # A concrete compiler class can either override this method
  995.         # entirely or implement _compile().
  996.         macros, objects, extra_postargs, pp_opts, build = \
  997.                 self._setup_compile(output_dir, macros, include_dirs, sources,
  998.                                     depends, extra_postargs)
  999.         cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
  1000.  
  1001.         for obj in objects:
  1002.             try:
  1003.                 src, ext = build[obj]
  1004.             except KeyError:
  1005.                 continue
  1006. >           self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  1007.  
  1008. mambaforge/envs/brian/lib/python3.8/distutils/ccompiler.py:574:
  1009. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1010.  
  1011. self = <distutils.unixccompiler.UnixCCompiler object at 0x11ecd6670>
  1012. obj = '/Users/thomastiotto/Library/Caches/cython/brian_extensions/Users/thomastiotto/Library/Caches/cython/brian_extensions/_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2.o'
  1013. src = '/Users/thomastiotto/Library/Caches/cython/brian_extensions/_cython_magic_3222b51974c5bfffb38fc4d2e4e2bfd2.cpp'
  1014. ext = '.cpp'
  1015. cc_args = ['-I/Users/thomastiotto/mambaforge/envs/brian/include', '-I/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/sit...an/lib/python3.8/site-packages/brian2/synapses', '-I/Users/thomastiotto/mambaforge/envs/brian/include/python3.8', '-c']
  1016. extra_postargs = ['-w', '-O3', '-ffast-math', '-fno-finite-math-only', '-march=native', '-std=c++11', ...]
  1017. pp_opts = ['-I/Users/thomastiotto/mambaforge/envs/brian/include', '-I/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/sit...vs/brian/lib/python3.8/site-packages/brian2/synapses', '-I/Users/thomastiotto/mambaforge/envs/brian/include/python3.8']
  1018.  
  1019.     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
  1020.         compiler_so = self.compiler_so
  1021.         if sys.platform == 'darwin':
  1022.             compiler_so = _osx_support.compiler_fixup(compiler_so,
  1023.                                                     cc_args + extra_postargs)
  1024.         try:
  1025.             self.spawn(compiler_so + cc_args + [src, '-o', obj] +
  1026.                        extra_postargs)
  1027.         except DistutilsExecError as msg:
  1028. >           raise CompileError(msg)
  1029. E           distutils.errors.CompileError: command 'gcc' failed with exit status 1
  1030.  
  1031. mambaforge/envs/brian/lib/python3.8/distutils/unixccompiler.py:120: CompileError
  1032.  
  1033. The above exception was the direct cause of the following exception:
  1034.  
  1035.     @pytest.mark.standalone_compatible
  1036.     @pytest.mark.multiple_runs
  1037.     def test_active_flag():
  1038.         G = NeuronGroup(1, 'dv/dt = 1/ms : 1')
  1039.         mon = StateMonitor(G, 'v', record=0)
  1040.         mon.active = False
  1041. >       run(1*ms)
  1042.  
  1043. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/tests/test_base.py:73:
  1044. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1045. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/units/fundamentalunits.py:2434: in new_f
  1046.     result = f(*args, **kwds)
  1047. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/magic.py:373: in run
  1048.     return magic_network.run(duration, report=report, report_period=report_period,
  1049. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/magic.py:231: in run
  1050.     Network.run(self, duration, report=report, report_period=report_period,
  1051. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/base.py:278: in device_override_decorated_function
  1052.     return func(*args, **kwds)
  1053. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/units/fundamentalunits.py:2434: in new_f
  1054.     result = f(*args, **kwds)
  1055. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/network.py:1008: in run
  1056.     self.before_run(namespace)
  1057. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/base.py:278: in device_override_decorated_function
  1058.     return func(*args, **kwds)
  1059. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1060.  
  1061. self = MagicNetwork()
  1062. run_namespace = {'@py_builtins': <module 'builtins' (built-in)>, '@pytest_ar': <module '_pytest.assertion.rewrite' from '/Users/thomas...e-packages/_pytest/assertion/rewrite.py'>, 'ALLOW_THREADS': 1, 'Annotation': <class 'matplotlib.text.Annotation'>, ...}
  1063.  
  1064.     @device_override('network_before_run')
  1065.     def before_run(self, run_namespace):
  1066.         '''
  1067.        before_run(namespace)
  1068.  
  1069.        Prepares the `Network` for a run.
  1070.  
  1071.        Objects in the `Network` are sorted into the correct running order, and
  1072.        their `BrianObject.before_run` methods are called.
  1073.  
  1074.        Parameters
  1075.        ----------
  1076.        run_namespace : dict-like, optional
  1077.            A namespace in which objects which do not define their own
  1078.            namespace will be run.
  1079.        '''
  1080.         all_objects = self.sorted_objects
  1081.         prefs.check_all_validated()
  1082.  
  1083.         # Check names in the network for uniqueness
  1084.         names = [obj.name for obj in all_objects]
  1085.         non_unique_names = [name for name, count in Counter(names).items()
  1086.                             if count > 1]
  1087.         if len(non_unique_names):
  1088.             formatted_names = ', '.join("'%s'" % name
  1089.                                         for name in non_unique_names)
  1090.             raise ValueError('All objects in a network need to have unique '
  1091.                              'names, the following name(s) were used more than '
  1092.                              'once: %s' % formatted_names)
  1093.  
  1094.         # Check that there are no SummedVariableUpdaters targeting the same
  1095.         # target variable
  1096.         _check_multiple_summed_updaters(all_objects)
  1097.  
  1098.         self._stopped = False
  1099.         Network._globally_stopped = False
  1100.  
  1101.         device = get_device()
  1102.         if device.network_schedule is not None:
  1103.             # The device defines a fixed network schedule
  1104.             if device.network_schedule != self.schedule:
  1105.                 # TODO: The human-readable name of a device should be easier to get
  1106.                 device_name = list(all_devices.keys())[list(all_devices.values()).index(device)]
  1107.                 logger.warn(("The selected device '{device_name}' only "
  1108.                              "supports a fixed schedule, but this schedule is "
  1109.                              "not consistent with the network's schedule. The "
  1110.                              "simulation will use the device's schedule.\n"
  1111.                              "Device schedule: {device.network_schedule}\n"
  1112.                              "Network schedule: {net.schedule}\n"
  1113.                              "Set the network schedule explicitly or set the "
  1114.                              "core.network.default_schedule preference to "
  1115.                              "avoid this warning.").format(device_name=device_name,
  1116.                                                            device=device,
  1117.                                                            net=self),
  1118.                             name_suffix='schedule_conflict', once=True)
  1119.  
  1120.         logger.debug("Preparing network {self.name} with {numobj} "
  1121.                      "objects: {objnames}".format(self=self,
  1122.                         numobj=len(all_objects),
  1123.                         objnames=', '.join(obj.name for obj in all_objects)),
  1124.                      "before_run")
  1125.  
  1126.         self.check_dependencies()
  1127.  
  1128.         for obj in all_objects:
  1129.             if obj.active:
  1130.                 try:
  1131.                     obj.before_run(run_namespace)
  1132.                 except Exception as ex:
  1133. >                   raise BrianObjectException("An error occurred when preparing an object.", obj) from ex
  1134. E                   brian2.core.base.BrianObjectException: Error encountered with object named "neurongroup_stateupdater".
  1135. E                   Object was created here (most recent call only, full details in debug log):
  1136. E                     File "/Users/thomastiotto/mambaforge/envs/brian/lib/python3.8/site-packages/_pytest/python.py", line 183, in pytest_pyfunc_call
  1137. E                       result = testfunction(**testargs)
  1138. E
  1139. E                   An error occurred when preparing an object. (See above for original error message and traceback.)
  1140.  
  1141. mambaforge/envs/brian/lib/python3.8/site-packages/brian2/core/network.py:899: BrianObjectException
  1142. ----------------------------- Captured stderr call -----------------------------
  1143. clang: error: the clang compiler does not support '-march=native'
  1144. =========================== short test summary info ============================
  1145. FAILED mambaforge/envs/brian/lib/python3.8/site-packages/brian2/tests/test_base.py::test_active_flag
  1146. !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
  1147. 1 failed, 410 deselected in 1.14s
  1148. ERROR: 1/1 test suite(s) did not complete successfully (see above).
  1149. False
  1150. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement