Installing CAMB on Sierra

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Damian Sowinski
Posts: 1
Joined: February 14 2017
Affiliation: University of Wisconsin, Madison

Installing CAMB on Sierra

Post by Damian Sowinski » February 24 2017

I'm having problems with getting CAMB working on Sierra.

First off, I have the latest version of gfortran installed

Code: Select all

GNU Fortran (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The latest version of pyCAMB says that it fixed the compilation issue with 6.3, but theres another post (http://cosmocoffee.info/viewtopic.php?t ... ht=install) where someone was having problems with 6.3.

When I run from inside the camb/pycamb folder:

Code: Select all

sudo python setup.py install --user
,
I get the following error:

Code: Select all

mkdir -p Releaselib
gfortran -shared -fPIC -O3 -fopenmp -ffast-math -fmax-errors=4 -JReleaselib -IReleaselib/ -c constants.f90 -o Releaselib/constants.o
FATAL:/opt/local/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
Running through the code, I see that the setup.py starts the subprocess "make camblib.so".
That ends up running Makefile, which gets to the end and starts running Makefile_main.
When gfortran ($(F90C)) is called in the line ,

Code: Select all

$(DLL_DIR)/%.o: %.f90
	$(F90C) $(SF90FLAGS) -c $*.f90 -o $(DLL_DIR)/$*.o
the error pops up.

If anyone know why this is happening, please let me know.
After trying to get around this I finally took Caldwell's advice and installed gfortran v5.3.
Running setup.py no longer pops us the 'm' flag error, but now I get a strange:

Code: Select all

gfortran -dynamiclib -fPIC -O3 -fopenmp -ffast-math -fmax-errors=4 -JReleaselib -IReleaselib/ -c utils.F90 -o Releaselib/utils.o
/var/tmp//ccijfDb9.s:9224:suffix or operands invalid for `movq'
/var/tmp//ccijfDb9.s:9328:suffix or operands invalid for `movq'
make: *** [Releaselib/utils.o] Error 1
looking a the traceback, the problem appears to be in the setup.py file:

Code: Select all

---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/IPython/utils/py3compat.py in execfile(fname, glob, loc, compiler)
    184         with open(fname, 'rb') as f:
    185             compiler = compiler or compile
--> 186             exec(compiler(f.read(), fname, 'exec'), glob, loc)
    187 
    188     # Refactor print statements in doctests.

/Users/Omnius/Desktop/CAMB-Jan2017/pycamb/setup.py in <module>&#40;&#41;
    122       packages=&#91;'camb', 'camb_tests'&#93;,
    123       package_data=&#123;'camb'&#58; &#91;DLLNAME, 'HighLExtrapTemplate_lenspotentialCls.dat'&#93;&#125;,
--> 124       test_suite='camb_tests',
    125       classifiers=&#91;'Programming Language &#58;&#58; Python &#58;&#58; 2','Programming Language &#58;&#58; Python &#58;&#58; 2.7','Programming Language &#58;&#58; Python &#58;&#58; 3','Programming Language &#58;&#58; Python &#58;&#58; 3.4','Programming Language &#58;&#58; Python &#58;&#58; 3.5'&#93;,
    126       keywords=&#91;'cosmology', 'CAMB'&#93;,

/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/core.py in setup&#40;**attrs&#41;
    146     if ok&#58;
    147         try&#58;
--> 148             dist.run_commands&#40;&#41;
    149         except KeyboardInterrupt&#58;
    150             raise SystemExit&#40;"interrupted"&#41;

/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py in run_commands&#40;self&#41;
    953         """
    954         for cmd in self.commands&#58;
--> 955             self.run_command&#40;cmd&#41;
    956 
    957     # -- Methods that operate on its Commands --------------------------

/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py in run_command&#40;self, command&#41;
    972         cmd_obj = self.get_command_obj&#40;command&#41;
    973         cmd_obj.ensure_finalized&#40;&#41;
--> 974         cmd_obj.run&#40;&#41;
    975         self.have_run&#91;command&#93; = 1
    976 

/Users/Omnius/Desktop/CAMB-Jan2017/pycamb/setup.py in run&#40;self&#41;
     97             subprocess.call&#40;"make camblib.so", shell=True&#41;
     98             print&#40;" end make camblib.so"&#41;
---> 99             if not osp.isfile&#40;os.path.join&#40;'Releaselib', 'camblib.so'&#41;&#41;&#58; sys.exit&#40;'Compilation failed'&#41;
    100             print&#40;" chmod 755 Releaselib/camblib.so"&#41;
    101             subprocess.call&#40;"chmod 755 Releaselib/camblib.so", shell=True&#41;

SystemExit&#58; Compilation failed
At this point I gave up.
If anyone can help with either the prior issue or the present one, that would be great.

Antony Lewis
Posts: 1936
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Installing CAMB on Sierra

Post by Antony Lewis » February 24 2017

As with that post, it's probably an issue with your gfortran/gcc/ports installation, e.g. cf

https://github.com/Homebrew/legacy-home ... sues/45258
https://github.com/SciRuby/nmatrix/issues/406

If you have problems I'd just compile and run it in one of the CosmoBox virtual environments instead.

Post Reply