Closed steven-murray closed 10 years ago
Hi Steven,
You can do this by compiling with F90FLAGS=-fopenmp python setup.py install though you may need the ['gomp'] thing that you already did as well. I should add a note in the README on this!
Cheers, Joe
Hi thanks for your prompt reply! So I tried doing what you suggest, I also remembered just after I contacted you that the right way to link to openmp with gfortran was the -fopenmp option (rather than the -lgomp option).
But it still doesn't give me multithreading... it's very odd. Perhaps a better way is to premake the CAMB library and then link to it directly?
That's odd. There should be a line in the setup output somewhere that looks like: Fortran f90 compiler: /usr/local/bin/gfortran -fopenmp -m64 -fPIC -O3 -funroll-loops
Does yours include the openmp flag? Good to clean by removing the build dir first, of course. Also, you mayt need to set the environment variable OMP_NUM_THREADS=2 (e.g)
The older version of the code was built as you describe - if you go back in the git history to before rainwoodman's commits you should find the version built like that.
Joe
Hi, My line reads: Fortran f90 compiler: /usr/local/bin/gfortran -Wall -fno-second-underscore -m64 -fPIC -O3 -funroll-loops
ie. there's evidently no -fopenmp there. Not sure why this is. I cleaned my build directory.
I'll have a little google around see what I can dig up...
As usual, documentation on f2py is scarce and out of date.
Anyway, it works when I use the 'old' way. Maybe one day I'll figure out this way as well :)
It may be that I am using numpy v1.7.0
When I use the machine at work with numpy 1.6.1 it works fine with the flag specified as you say.
I have noticed that in the f2py of the newer numpy, the option extra_f90_compile_args is no longer available. Perhaps this has something to do with it...
Hey,
This is a nice application. I was wondering how to get it to support multi-threading using open mp? CAMB itself does this, but when I build with this setup it doesn't seem to multithread at all. I have tried using libraries = ['gomp'] in the Extension part of the setup script, to no avail.
I also added a '@ThreadNum' variable to the generatePycamb.py file to change the number of threads used. I'm probably missing something really simple!