Open RalphFS opened 6 years ago
Also, for some reason, no .pythranrc is created That's normal. It's a customization point, the vanilla pythran does not need one.
The OpenMP issue is both strange and critical. Can your reproduce it on Linux, or is that specific to OSX? It looks like you're no longer linking with the system OpenMP, or that you need to force the OpenMP rpath. The reason why you encounter this problem is probably that pythran depends on a c++ compiler that gets installed alongside pythran, but this compiler references an improper libgomp...
See this ticket: https://github.com/gprMax/gprMax/issues/134 that proposes a -rpath based solution (the actual rpath value probably differs on your setup)
Thanks for your quick response. I will try to reproduce this with Linux.
The reason why you encounter this problem is probably that pythran depends on a c++ compiler that gets installed alongside pythran, but this compiler references an improper libgomp...
Yes, that looks very familiar to me... that would also explain another problem I noticed: The speed of a compiled Pythran program depends on the kernel used. Let's say I have two anaconda environments:
When I import Pythran code into the anaconda kernel, the code is extremely slow. However, if I choose the new_env kernel, Pythran programs are very fast...
Also, for openMP to work with Cython, I need to set the following parameters: %%cython
Can I force the openMP rpath in Pythran as well?
With respect to the wrong linkage I can show you the output of my bash_profile file.
export PATH=/usr/local/bin:$PATH export PATH="/usr/local/bin:/anaconda3/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" export CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 export CXX=/usr/local/Cellar/gcc/8.2.0/bin/g++-8 export CPP=/usr/local/Cellar/gcc/8.2.0/bin/cpp-8 export LD=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 alias c++=/usr/local/Cellar/gcc/8.2.0/bin/c++-8 alias g++=/usr/local/Cellar/gcc/8.2.0/bin/g++-8 alias gcc=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 alias cpp=/usr/local/Cellar/gcc/8.2.0/bin/cpp-8 alias ld=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 alias cc=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8
Does that somehow cause openMP to stop working with Pythran?
Can I force the openMP rpath in Pythran as well? yes, passing the same options to pythran would work
pythran stuff.py -Wl,-rpath,/usr/local/Cellar/gcc/8.2.0/lib/gcc/8/
Okay that works in the terminal but it doesn't work in combination with the pythran magic,right? unfortunately, that doesn't fix the issue. However, today i tested it on a linux machine and can confirm that on linux everything works as desired.
@RalphFS #1057 should make it possible to use -Wl,stuff
in a pythran magic. Can you confirm it's okay for you?
I think this would be more convenient if you work a lot with Jupyter notebooks but I am also happy with the terminal solution. Unfortunately this does not fix the openmp error message. I'm not familiar with c++, but if you have any other ideas, you're welcome to give me instructions that I can try under MacOS. I'm pretty sure it's related to Pythran or some package dependencies, since the problem doesn't occur until I install Pythran from conda-froge.
@RalphFS can you try to just install gcc in a venv, and check if gcc is the not the origin of the problem?
You are talking about a virtual conda environment, right? In the meantime I also tried anaconda gcc 4.8... unfortunately without success. However, I was able to solve the problem artificially in the meantime. Apparently different compilation dependencies cause these problems.
I used the terminal command otool -L example.so to examine the dependencies and found that once Pythran is installed, the following command is obviously ignored by Cython and Pythran: -Wl,-rpath,/usr/local/Cellar/gcc/8.2.0/lib/gcc/8/
To fix the problem, I had to copy the files libgomp.a, libgomp.1.dylib, libgomp.dylib and libgomp.spec from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/ into the lib folder of my anaconda environment. I don't understand why -Wl,-rpath,/usr/local/Cellar/gcc/8.2.0/lib/gcc/8/ is ignored, but at least it works now
Installing Pythran via Conda-forge causes openmp to stop working for both Pythran and Cython.
When I create a new Conda environment via
at least Cython (0.28.5) seems to work correctly with fopenmp. But as soon as I add Pythran (0.8.5 / 0.8.7) via
something will break.
For example, if I compile the following lines of code:
...I get this error message:
The strange thing is that after installing Pythran this error message also occurs with Cython code when using openmp.
I tried this on two different computers, both running MacOS Mojave and gcc 8.2. Also, for some reason, no .pythranrc file is created during installation.