lmhale99 / atomman

Atomistic Manipulation Toolkit
Other
34 stars 40 forks source link

Segmentation fault (core dumped) #9

Closed Metison closed 5 years ago

Metison commented 5 years ago

Hi! Error occurs when I run the following code:

import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
import atomman as am
x = np.random.randn(50000)
y = np.random.randn(50000)
def func(x, a, b, c):
  return 1 + 1* ( np.tan(x-a)/c - np.tanh(x-b)/c )
popt, pcov = curve_fit(func, x, y)

Errors

Segmentation fault (core dumped)

This Error only occurs only after the atomman imported, and the length of x & y larger than a certain value, eg. 50000. When commented out the statement import atomman as am, the error no longer occurs.
Above scripts run in ubuntu shell (bash), and python version is 3.6.8, while run the scripts in jupyter notebook, this error disappear.

I wonder if this has anything to do with atomman code?

Atomman version: 1.2.8
Numpy version: 1.17.2 Thanks

lmhale99 commented 5 years ago

Hi,

I just tested in the ubuntu subshell on and did not get the segmentation fault up to 600000. I tried three different variations without issue:

Fresh anaconda install, atomman from github:

Then, conda update --all:

Then, I removed the github atomman and used pip install

Segmentation faults usually occur because of memory issues or bugs in c extensions.

Let me know if you get it working, find out anything more.

Metison commented 5 years ago

Thanks a lot.
It could be a numpy or scipy installation conflict. I reinstalled numpy and scipy in conda, and the problem disappeared.

atomman installed with pip

Thanks again.