-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fresh install on Mac OS X segfaults or produces a Fortran Runtime error #57
Comments
Could you give a bit more detail about what a 'fresh' install is on OSX? The script you provide runs on my machine, so it likely that this is an OSX-issue, possibly specific to your compilers/MPI setup. The travis setup shows that there are indeed some unresolved issues associated with OSX + MPI, which look very similar to your own. Lacking an OSX machine testing this is difficult (particularly as the travis spin-up time is 15 minutes for OSX). Does your code run successfully without MPI? |
I can’t run anything PolyChord. The shortest error message I get is
And that’s what I get without MPI. With MPI it segfaults. |
A fresh install is a clear venv, brew MPI, brew GFortran. Pip install every dependency. |
If you run the equivalent commands encoded in the .travis.yml (if MPI=0), do you still get this error? |
Exactly the same error messages. Running with |
Did you install polychord and its dependencies in the same manner as travis? (I ask, because we know that it can work on OSX without segfaults if you do that, and we can then try to isolate what in your setup is causing the segfault on your machine). |
Nope. It fails with the following.
|
make gaussian
./bin/gaussian ini/gaussian.ini
make veryclean
make DEBUG=1 MPI=0 libchord.so
python setup.py install
python <my script> |
|
How far through does it get. Can you do |
Would you be able to paste the stdout during this procedure: make veryclean
make DEBUG=1 MPI=0 libchord.so
python setup.py install
python <my script> |
On my system python is python2.7, so here's the output of the same with python3. |
This is not too critical, as Cobaya still uses PolyChord v1.16, which runs OK on my machine. |
ah -- it's still using mpicc for the pypolychord compilation. Does CC=gcc CXX=g++ python setup.py install fix that? Alternatively, you could try python setup.py install --no-mpi |
You should also make sure that there aren't any other installations of pypolychord on the system (python virtual environments are not completely failsafe) |
Every other combination with any other compiler (e.g.
Cobaya taught me that the hard way.... |
Not sure whether this is relevant here, but on the topic of installation from scratch and virtual environments and MPI, I found that it is safer to use pip install --no-cache-dir mpi4py |
Sorry, 'obviously' it should be python setup.py --no-mpi install |
Compiled with
Same segfault. |
OK, so on #58 I have now managed to get it to run with both python2 and python3 without MPI. With MPI I get a very similar segfault to the one that you are finding, so it would be good to isolate whether the issue you are finding is with MPI, or a separate segfault. Could you try to make things as travis-like as possible. This means:
brew unlink python@2
brew link python@3
python3 -m pip install virtualenv
virtualenv venv -p python3
source venv/bin/activate
pip install numpy scipy First without mpi: pip install . --global-option="--no-mpi"
python run_pypolychord.py Then with (this may segfault): pip install .
pip install mpi4py
mpirun -np 2 python run_pypolychord.py Thank you for your help with this -- this seems to be a segfault that only affects a subset of OSX users, and lacking a mac (or a willing user with a segfaulting system), it is likely that this issue has been annoying some prospective users for a while. |
My suspicion is that clang is the culprit, as on mac OS clang is always the default compiler. That is, brew packages (such as openmpi) are compiled/linked against clang, even if gcc is installed. Python is built with clang as well. With MPI, things get even more complicated, since mpicxx (which is used to compile the python extension) points to clang, while mpifort (used to compile libchord) points to gfortran (i.e., gcc). Rewriting the python interface in terms of ctypes might be an option, since it would eliminate the need to compile a python extension. |
Fresh clean install on a completely new factory reset system, with explicit references to home-brew libraries. This produces
|
I had the same problem and was able to compile things as follows to get a working install. $ git clone [email protected]:PolyChord/PolyChordLite.git
$ cd PolyChordLite
$ make MPI=0 libcord.so
$ python setup.py --no-mpi install $ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin $ python --version
Python 3.8.1 |
Didn't work for me, besides I'm trying to debug a problem I had with MPI, so I can't just ignore MPI support. |
Had the same issue with MPI. I managed to install PolychordLite without any problems only without MPI:
|
MWE:
produces
The text was updated successfully, but these errors were encountered: