Closed Pvjesper closed 3 years ago
Hi @Pvjesper I have run your code without problem. I never ran into this problem and used max_order
up to 200.
Which python, OS, and pyroomacoustics versions are you using ?
Both machines have the same pyroomacoustics and python version, but different OS. OS: Windows 10, Windows 7 Pyroomacoustics 0.3.1 Python 3.7.4-amd64
I see, I was testing on my machine, which is a Mac. I have added a test and run the CI. Indeed, this fails on windows with error -1073741571
. This seems to be a stack exhaustion problem.
I don't have a windows machine to experiment here, but maybe you could try to adjust the size of the stack using the resource
module ?
import resource
resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
Edit: maybe 2 ** 29
is not the correct value and you might need to experiment a little I guess.
The resource module seems to be UNIX only. An often suggested solution for windows seems to be leaning on the threading library, and setting the stack size for a newly created thread. However, the smallest allowed stack size for max_order=31 was fine, and the largest allowed stack size for max_order=32 produced the same error.
I would gladly try something else if you have a clue, but I'm not sure where to go from here.
The adjusted script with stack size adjustment:
import threading
import pyroomacoustics as pra
import numpy as np
def compute_rir(order):
fromPos = np.zeros((3))
toPos = np.ones((3,1))
roomSize = np.array([3,3,3])
room = pra.ShoeBox(roomSize, fs = 1000, absorption=0.999, max_order=order)
room.add_source(fromPos)
mics = pra.MicrophoneArray(toPos, room.fs)
room.add_microphone_array(mics)
room.compute_rir()
if __name__ == "__main__":
threading.stack_size(2**15)
t = threading.Thread(target=compute_rir(31))
t.start()
t.join()
print("Computed 31")
threading.stack_size(2**27)
t = threading.Thread(target=compute_rir(32))
t.start()
t.join()
print("Computed 32")
Sorry to have dropped the ball on this one. Where you able to make some progress ?
@Pvjesper The latest version update includes a complete rewrite of the simulation core in C++ which seems to solve the problem. I have added a test for order over 31 that seems to run without problem. https://github.com/LCAV/pyroomacoustics/actions/runs/132155203 Can you try to update to v0.4.0 and let me know it this solves your problem ?
Thank you! I only have my laptop with me, but I tried it for a few orders, up to 95, and it works well. So I think it is really solved.
I am using pyroomacoustics purely to generate room impulse responses. I would like to generate more reverberant rooms, of at least one second.
The highest max_order that does not trigger "Python stopped working" is 31. Same behavior on two different computers. I could not find any documentation concerning this. Is it an issue, or am I doing something wrong? I attached a small code snippet that reproduces the error on my machines.