-
Notifications
You must be signed in to change notification settings - Fork 13
compilation_problems
One of the best qualities of pyaneti
is that part of it is written in FORTRAN
, and this speed up the execution time. Unfortunately, this also means that we need to compile the code in order to run it. Sometimes the compilation may fail due to different problems that vary from computer to computer. Here I describe some typical problems that I have seen, and how to solve them.
Note that you can also use pyaneti in a virtual machine, this solution does not require you to compile the code and you can use pyaneti out of the box.
The compilation problems can vary from machine to machine, so the first thing to try is to tell the compiler to indicate to us what is going wrong with the compilation. To do so, we need to remove the --quiet
flag in the makefile
.
First, open the makefile
that is inside the main pyaneti
directory. You should see the lines
FLAGS_OMP= -c -m --quiet --f90flags='-fopenmp'
FLAGS = -c -m --quiet
you have to remove the --quiet
flag, and the lines should look like
FLAGS_OMP= -c -m --f90flags='-fopenmp'
FLAGS = -c -m
Now, save the file and try to compile the code again. This will not solve the problem, but it will make it easier to identify the problem. Now you can try one of the solutions that we propose below.
It has been reported by several users that the code is not compiling when they are using a Python environment such as anaconda
. It looks like the problem is caused by bad communication between the environment and the FORTRAN
compiler. There has not been a reported solution on how to deal with this problem. But a way to solve this is to compile the code outside the environment. pyaneti
depends only on numpy, matplotlib, and seaborn, therefore it should not create problems in your local Python
installation. Some users have been able to compile to code following this recommendation.
You know pyaneti has compiled if there is a *.so file created in your main pyaneti directory (example pyaneti.cpython-36m-x86_64-linux-gnu.so or pyaneti.so)
Pyaneti comes with a makefile that provides all the instructions to the shell in order to compile the code correctly. The main ingredient of the compilation process is done by a command called F2PY. F2PY is a numpy module that allows compiling FORTRAN subroutines as PYTHON functions. If you have a numpy installation in your machine, you should have an F2PY variable in your terminal. However, if you have several PYTHON versions installed in your machine this can lead to problems with the compilation. If this is the case, you have to modify the makefile to indicate the F2PY version to use. Example, if the nominal makefile that comes with pyaneti includes the variable
FP=f2py
but your machine has f2py3.6, you can change that line to
FP=f2py3.6
and try to compile the code again.
If you have indicated the correct version of f2py in the makefile, and the code still does not compile, try to update your numpy version. Sometimes the old version of numpy is not compatible with the newest libraries in your machine.
If you compiled the code, you should have a *.so file in your main pyaneti directory. You can run the code by typing
./pyaneti.py test
However, this may fail if the F2PY version used in the makefile does not correspond to the default PYTHON version in your machine. This is solved easily by placing the PYTHON version that we use to compile the code before the pyaneti call. Example
If we use f2py3.6 to compile the code, we can run the code by running
python3.6 pyaneti.py test
Some users have reported that the newer versions of the GCC
compilers generate a mismatch error that before was flagged as a warning. This can be solved by modifying the
FLAGS_OMP= -c -m --quiet --f90flags='-fopenmp'
FLAGS = -c -m --quiet
lines in the makefile
. You have to modify them by adding the -fallow-argument-mismatch
flag
FLAGS_OMP= -c -m --quiet --f90flags='-fallow-argument-mismatch -fopenmp'
FLAGS = -c -m --quiet --f90flags='-fallow-argument-mismatch'
save the makefile
and compile the code again.
If you find any more problems and solutions, feel free to let me know and I can add them here.
- Start to use pyaneti
- Parallel run
- The input_fit.py file
- Output files
- Parametrizations
- Examples
- Theory
- Others: