BlackHolePerturbationToolkit / FastEMRIWaveforms

Blazingly fast EMRI waveforms
GNU General Public License v3.0
38 stars 26 forks source link

Segmentation fault for Pn5AAKWaveform #61

Closed ShaunFell closed 1 year ago

ShaunFell commented 1 year ago

Pn5AAKWaveform seg fault's when calculating 5 PN AAK waveform for the following parameters:

import few; from few.waveform import Pn5AAKWaveform as pn5; wg = pn5() wg(1e5,1,0.5,11,0.3,1,0.2,0,0,0,1) [1] 71783 segmentation fault (core dumped) python

I've tried setting the time-step to a large value, e.g. dt=1e3, to see if the array length was causing the issue but it doenst change the result. Changing the total waveform time to a small value does fix it but increasing the T kwarg while decreasing the dt kwarg will still crash the kernel. For example:

wf = wg(1e5,1,0.5,11,0.3,1,0.2,0,0,0,1,T=0.39,dt=1e3);len(wf)

12308

wf = wg(1e5,1,0.5,11,0.3,1,0.2,0,0,0,1,T=0.4,dt=1e3);len(wf) [1] 72040 segmentation fault (core dumped) python

Increasing T by a small increment crashes the python kernel, even though the array length isnt very large.

ShaunFell commented 1 year ago

test.txt

this file reproduces the error. Running python -m trace --trace test.txt shows seg fault occurs in few.utils.utility.wrapper and few.utils.utility.pointer_adjust function.

lorenzsp commented 1 year ago

Hi Shaun, I might have found the bug. There was a problem with the number of points allocated in the AAK waveform creation in gpuAAK.cu Let me know if this solves the issue.

ShaunFell commented 1 year ago

Hi lorenzsp, Thank you for the fix, I reran my code with this fix and everything seems to work as expected now.

ShaunFell commented 1 year ago

Hi @lorenzsp , this issue has appeared again, this time with the following parameters M=2e5 mu=10 a=0.63 p0=26.9 e0=0.5 Y0=1. qS=3.14/4 phiS=0. qK=1e-6 phiK=0. dist=1. T=5 dt=15

calling Pn5AAKWaveform results in the stacktrace:

stack smashing detected : terminated Fatal Python error: Aborted

Current thread 0x00007faa48a0f740 (most recent call first): File "/mnt/Data_Volume/Computer_Programs/Anaconda/envs/few_env/lib/python3.7/site-packages/few/utils/utility.py", line 883 in func_wrapper File "/mnt/Data_Volume/Computer_Programs/Anaconda/envs/few_env/lib/python3.7/site-packages/few/summation/aakwave.py", line 304 in sum File "/mnt/Data_Volume/Computer_Programs/Anaconda/envs/few_env/lib/python3.7/site-packages/few/utils/baseclasses.py", line 843 in call

the stack smashing seems to be caused by a buffer overflow in gpuAAK.cu