Skip to content

compilation_problems

Oscar Barragán edited this page Jan 14, 2021 · 5 revisions

Dealing with compilation problems

One of the best qualities of pyaneti is that part of it is written in FORTRAN, and this speed ups 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.

Problem: The code does not compile

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.

Problem: The code compiles, but it does not run

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 compiled 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

Other problems

If you find further problems and solutions, feel free to let me know and I can add them here.