INCF / MUSIC

MUSIC, the MUltiSimulation Coordinator
GNU General Public License v3.0
37 stars 37 forks source link

[BUG] Event output #38

Open mhoff opened 7 years ago

mhoff commented 7 years ago

mpirun -np 2 music run.music for the attached testcase leads to:

out1: connected
in1: connected
(0, 0.0)
[node16:13393] *** Process received signal ***
[node16:13393] Signal: Segmentation fault (11)
[node16:13393] Signal code: Address not mapped (1)
[node16:13393] Failing at address: 0x8
[node16:13393] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0xf890) [0x7f087af1c890]
[node16:13393] [ 1] /home/hoff/.local/lib/libmusic.so.1(_ZN5MUSIC15EventOutputPort15insertEventImplEdi+0) [0x7f08791b2520]
[node16:13393] [ 2] /home/hoff/.local/lib/python2.7/site-packages/music/pymusic.so(+0x26178) [0x7f0879c3f178]
[node16:13393] [ 3] /usr/bin/python(PyEval_EvalFrameEx+0x6a0a) [0x4f60ca]
[node16:13393] [ 4] /usr/bin/python(PyEval_EvalCodeEx+0x7fb) [0x4f696b]
[node16:13393] [ 5] /usr/bin/python(PyEval_EvalFrameEx+0x573b) [0x4f4dfb]
[node16:13393] [ 6] /usr/bin/python(PyEval_EvalCodeEx+0x7fb) [0x4f696b]
[node16:13393] [ 7] /usr/bin/python(PyEval_EvalCode+0x19) [0x4f6a89]
[node16:13393] [ 8] /usr/bin/python(PyRun_FileExFlags+0x134) [0x51e6a4]
[node16:13393] [ 9] /usr/bin/python(PyRun_SimpleFileExFlags+0xdf) [0x52016f]
[node16:13393] [10] /usr/bin/python(Py_Main+0xb51) [0x537981]
[node16:13393] [11] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f087a260b45]
[node16:13393] [12] /usr/bin/python() [0x41859e]
[node16:13393] *** End of error message ***

The testcase does contain two simple nodes with a unidirectional event connection.

I initially build this testcase to demonstrate another faulty behaviour: Having multiple unconnected event outputs fails. I will go into detail as soon as we could solve the above (it should be just a minor thing, I suppose).


[send]
  np = 1
  binary = ./send_node.py

[recv]
  np = 1
  binary = ./recv_node.py

send.out1 -> recv.in1 [1]
#send.out2 -> recv.in2 [1]
#send.out3 -> recv.in3 [1]
#! /usr/bin/python

import music
import itertools

setup = music.Setup()

def make_out_proxy(port_name):
    proxy = setup.publishEventOutput(port_name)
    print("{}: {}".format(port_name, ["not connected", "connected"][proxy.isConnected()]))
    if proxy.isConnected():
        assert proxy.width() == 1
        proxy.map(music.Index.GLOBAL, size=1, base=0, maxBuffered=1)
        return lambda time: proxy.insertEvent(time, 0, music.Index.GLOBAL)
    return lambda time: None

outs = map(make_out_proxy, ["out1"])

for index, time in zip(itertools.cycle(range(len(outs))),
                       itertools.takewhile(lambda t: t < 1000.0, setup.runtime(0.01))):
    print(index, time)
    outs[index](time + 0.5)
#! /usr/bin/python

import music
import itertools
import functools

setup = music.Setup()

def print_spike(port, time, _, __):
    print("Received spike from port {}: {}".format(port, time))

def make_in_proxy(port_name):
    proxy = setup.publishEventInput(port_name)
    print("{}: {}".format(port_name, ["not connected", "connected"][proxy.isConnected()]))
    if proxy.isConnected():
        assert proxy.width() == 1
        proxy.map(functools.partial(print_spike, port_name), music.Index.GLOBAL,
                  size=proxy.width(), base=0, maxBuffered=1, accLatency=0)
    return proxy

ins = map(make_in_proxy, ["in1"])

for time in itertools.takewhile(lambda t: t < 1000.0, setup.runtime(0.01)):
    pass