- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello dear community,
I'm trying to compile a modified version of a cosmological code called CAMB from Anthony Lewis. The issue is that I need the Intel Fortran compiler version 15.0.7. It is old but very important to compile this code. Of course, this cosmological code can be compiled with the latest version of ifort but the modified version cannot.
Anyone knows how to download this ifort 15.0.8? I've been struggling for an entire month to get this specific version. I hope anyone can show me or, possibly, give a link to directly download it.
Thank you so much for reading this and I hope you can give me an useful information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I built just the CAMB executable on Windows, not a shared library, so I did not touch or use camb_python.f90. I did not enable OpenMP, attempt to generate PIC, or use their makefile.
Note that your build completed the first part (building the camb executable) with just a warning. I suggest that you run the newly built camb on some test problems and examine the output results before attempting to build a shared library and using that library from Python.
Line 405 of camb_python.f90 has "use Transfer", and that is a line that probably needs to be replaced by "use Transfer, xcept => c, ycept => EV", just as I suggested above for file cmbmain.f90.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't. Tell us what goes wrong when building the modified program, and we'll help you fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I run the usual ifort - c file1.f file2.f
And create a library using ar qc libodepack.a *.o
According to the instructions given in https://cosmocoffee.info/viewtopic.php?t=3120, I link the library in the makefile of the source code.
I type make and after compiling, I get the following error:
Undefined symbols for architecture x86_64:
_dlsoda_", referenced from:
_quint_mp_bde_hO in equations bde_v3.o
_quint_mp_bde_omega today_ in equations_bde_v3.o
_quint_mp_bde_search_lambdac_ in equations_bde_vi
quint_mp_bde_background_ in eguations_bde_v3
init_background_ in equations_bde_v3,o
(maybe you meant: _quint_ mp_bde_dlsoda_equations
ld: symbol(s) not found for architecture x86_64
make: *s* [camblib.so] Error 1
So, it seems that ifort is not compiling the library odepack to solve some equations in the main code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK you are not building in windows so my knowledge is minimal. I doubt you make a routine called _dlsoda_ I expect the underscore 'decoration' is made by the compiler. Such decoration schemes vary with the caller convention being used. In windows I would check the library symbols with dumpbin, I don't know the equivalent commands. This will tell you what is in the library and how it is named. The nature of he problem might then be know but you can always ask again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Andrew,
I tried to compile the code in WSL-Ubuntu in Windows 11. Now, When I compile the code it gives the following lines:
jose_lozano@Heisenberg:/mnt/c/Users/jaloz/OneDrive/Desktop/Numerical_codes/BDE_CAMB_ifort$ make clean
make: Warning: File 'Makefile' has modification time 208 s in the future
rm -f *.o *.a *.d core *.mod Releaselib/*.o Releaselib/*.mod
rm -f *.o *.a *.d core *.mod Release/*.o Release/*.mod pycamb/camb/*.so
rm -rf Release*
rm -rf Debug*
make: warning: Clock skew detected. Your build may be incomplete.
jose_lozano@Heisenberg:/mnt/c/Users/jaloz/OneDrive/Desktop/Numerical_codes/BDE_CAMB_ifort$ make
make: Warning: File 'Makefile' has modification time 204 s in the future
mkdir -p Release
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c constants.f90 -o Release/constants.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c utils.F90 -o Release/utils.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c subroutines.f90 -o Release/subroutines.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c inifile.f90 -o Release/inifile.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c power_tilt.f90 -o Release/power_tilt.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c recfast.f90 -o Release/recfast.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c reionization.f90 -o Release/reionization.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c modules.f90 -o Release/modules.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c bessels.f90 -o Release/bessels.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c equations_bde_v3.f90 -o Release/equations_bde_v3.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c halofit_ppf.f90 -o Release/halofit_ppf.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c lensing.f90 -o Release/lensing.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c SeparableBispectrum.F90 -o Release/SeparableBispectrum.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c cmbmain.f90 -o Release/cmbmain.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c camb.f90 -o Release/camb.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ Release/constants.o Release/utils.o Release/subroutines.o Release/inifile.o Release/power_tilt.o Release/recfast.o Release/reionization.o Release/modules.o Release/bessels.o Release/equations_bde_v3.o Release/halofit_ppf.o Release/lensing.o Release/SeparableBispectrum.o Release/cmbmain.o Release/camb.o inidriver.F90 -cxxlib -L/mnt/c/Users/jaloz/OneDrive/Desktop/Numerical_codes/BDE_CAMB_ifort/odepack -lodepack -o camb
ld: /opt/intel/oneapi/compiler/2023.2.1/linux/compiler/lib/intel64_lin/libiomp5.a(ompt-general.o): in function `ompt_pre_init':
(.text+0x2d24): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
mkdir -p Releaselib
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c constants.f90 -o Releaselib/constants.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c utils.F90 -o Releaselib/utils.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c subroutines.f90 -o Releaselib/subroutines.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c inifile.f90 -o Releaselib/inifile.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c power_tilt.f90 -o Releaselib/power_tilt.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c recfast.f90 -o Releaselib/recfast.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c reionization.f90 -o Releaselib/reionization.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c modules.f90 -o Releaselib/modules.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c bessels.f90 -o Releaselib/bessels.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c equations_bde_v3.f90 -o Releaselib/equations_bde_v3.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c halofit_ppf.f90 -o Releaselib/halofit_ppf.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c lensing.f90 -o Releaselib/lensing.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c SeparableBispectrum.F90 -o Releaselib/SeparableBispectrum.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c cmbmain.f90 -o Releaselib/cmbmain.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb.f90 -o Releaselib/camb.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb_python.f90 -o Releaselib/camb_python.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ Releaselib/constants.o Releaselib/utils.o Releaselib/subroutines.o Releaselib/inifile.o Releaselib/power_tilt.o Releaselib/recfast.o Releaselib/reionization.o Releaselib/modules.o Releaselib/bessels.o Releaselib/equations_bde_v3.o Releaselib/halofit_ppf.o Releaselib/lensing.o Releaselib/SeparableBispectrum.o Releaselib/cmbmain.o Releaselib/camb.o Releaselib/camb_python.o -o Releaselib/camblib.so
ld: /tmp/ipo_ifortQTOQdO.o: relocation R_X86_64_32S against symbol `raset1_' can not be used when making a shared object; recompile with -fPIC
ld: failed to set dynamic section sizes: bad value
make: *** [Makefile_main:113: camblib.so] Error 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What Steve said! The other way is to time travel back to 2014. Pretty much any valid code from 2014 should compile OK today if you set some options to avoid checking it too hard. Maybe you are trying to link to old libraries for which there is no source?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's right. I'm trying to link the odepack library to the main code. The thing is that the whole code works fine, according to my colleagues, using ifort 15.0.8.
However, using the latest version of ifort gives many errors. I solved the errors and the last thing to make it work again is to link and compile the odepack library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We have an article on the topic of old compilers: https://community.intel.com/t5/Intel-Fortran-Compiler/Older-Compiler-Download-Information/m-p/1372725#M160803
If you have Priority Support contract you can open a request on the Online Service Center. I'm not sure if they can still find a package that old, however.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't have priority support. I'm new in the business of fortran. In fact, I'm a "pure" Python user and this is my first time in the jungle of Fortran compilers. It's weird
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You show us the link errors (retyped, so you may have some transcription errors), but not any compilation errors.
There is a major bug in the ODEPACK source files, which the compiler properly complains about. On line 9497 of opkda1.f is a call to subroutine DPREPI that passes elements of double precision variable RWORK as several of the arguments. One of these corresponds to the integer dummy argument IWK in DPREPI. This mismatch is not allowed by the Fortran language. Worse, comments in the code for DPREPI say that it assumes IWK and WK share the same storage, which is also not allowed if there are assignments to either one, which there are.
It is clear that this code is very old, and assumes that compilers won't check for these errors, which was true 20 or more years ago.
It is possible to tell the Intel compiler to ignore these errors. The first you can ignore by not specifying "-warn interfaces", though as you are using Linux (or maybe Mac), this is not the default so if you are getting such complaints, I'm not sure why. The second, which doesn't trigger an error message, is to add "-assume dummy_aliases".
I can compile odepack without problems making these adjustments, but the sample program has numerous other errors of invalid Fortran, so I am not sure what to do about them.
This package needs a rewrite to correct the errors - the Fortran language has always disallowed these uses, even if old compilers didn't detect the errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rewriting old code is a long slow task, if you are new to Fortran it is not a good way to be introduced.
But if you proceed, start by creating an output file and then download all the results as you go along so they can be checked. And other people can look at them.
You are going to find surprises because new compilers catch old errors that used to slip through unnoticed. You also need to check that the results give you the "correct" answers.
it is not for the faint of heart, it is best attempted starting at 5pm on a Friday and assuming limited sleep you might finish by Monday.
The only place in the world that will help you is here. But you need to provide specific questions.
Good luck, it is a lot of fun, but it is not easy.
Python is not a language, it is a poor excuse for a language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ODEPACK is old, but continues to be widely used even now, partly because it is available on Netlib. The Netlib version has several bugs (mostly variables being used before having been initialized). Many such bugs have been fixed and the code itself has been modernized by several workers. For example, see the fine effort by Urban Jost and Jacob Williams.
I have spent quite a bit of time on the LLNL code, trying to overcome the issue that Steve Lionel identified -- the same memory block being used to store integers in some subroutines and for storing double precision values elsewhere. I gave up after several attempts. Despite this issue, the code in the package appears to work most of the time. The code contains several COMMON blocks in many subroutines, and different instances contain different dummy padding variables, which makes replacement of COMMON with modules risky.
There is one peculiar and completely unexpected behavior of a part of ODEPACK that I discovered, as follows, and it is related to the LSODPK example provided with the package. In this example, there are two variables, atol and rtol, which are used for controlling the iterations. Both are set equal to 1.0d-5 in the example file lsodpk.f (embedded in the file opkddemos.txt). I happened to try a slightly different value for rtol, = 3d-5. To my surprise, the output now contained several warnings:
DLSODPK- Warning. Poor iterative algorithm performance seen
at T = R1 by average no. of linear iterations = R2
In above, R1 = 0.1545244326464D+01 R2 = 0.5000000000000D+01
DLSODPK- Warning. Poor iterative algorithm performance seen
at T = R1 by linear convergence failure rate = R2
In above, R1 = 0.1545244326464D+01 R2 = 0.1000000000000D+01
The value of rtol for which this happens is affected by compiler optimization level, compiler used, etc. I suspect that this unexpected sensitivity to a tolerance value is the result of remaining bugs in the software rather than something that is a property of the numerical algorithms in ODEPACK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the original notes for the program. It is quite old.
If the author is still alive he will be 83.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
I was trying to compile a modified version of this cosmological code called CAMB on Ubuntu WSL2 on Windows 11. I compile the code in the terminal and it shows the following:
jose_lozano@Heisenberg:/mnt/c/Users/jaloz/OneDrive/Desktop/Numerical_codes/BDE_CAMB_ifort$ make
mkdir -p Release
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c constants.f90 -o Release/constants.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c utils.F90 -o Release/utils.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c subroutines.f90 -o Release/subroutines.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c inifile.f90 -o Release/inifile.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c power_tilt.f90 -o Release/power_tilt.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c recfast.f90 -o Release/recfast.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c reionization.f90 -o Release/reionization.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c modules.f90 -o Release/modules.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c bessels.f90 -o Release/bessels.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c equations_bde_v3.f90 -o Release/equations_bde_v3.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c halofit_ppf.f90 -o Release/halofit_ppf.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c lensing.f90 -o Release/lensing.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c SeparableBispectrum.F90 -o Release/SeparableBispectrum.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c cmbmain.f90 -o Release/cmbmain.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c camb.f90 -o Release/camb.o
ifort -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ Release/constants.o Release/utils.o Release/subroutines.o Release/inifile.o Release/power_tilt.o Release/recfast.o Release/reionization.o Release/modules.o Release/bessels.o Release/equations_bde_v3.o Release/halofit_ppf.o Release/lensing.o Release/SeparableBispectrum.o Release/cmbmain.o Release/camb.o inidriver.F90 -cxxlib -L/mnt/c/Users/jaloz/OneDrive/Desktop/Numerical_codes/BDE_CAMB_ifort/odepack -lodepack -o camb
ld: /opt/intel/oneapi/compiler/2023.2.1/linux/compiler/lib/intel64_lin/libiomp5.a(ompt-general.o): in function `ompt_pre_init':
(.text+0x2d24): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
mkdir -p Releaselib
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c constants.f90 -o Releaselib/constants.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c utils.F90 -o Releaselib/utils.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c subroutines.f90 -o Releaselib/subroutines.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c inifile.f90 -o Releaselib/inifile.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c power_tilt.f90 -o Releaselib/power_tilt.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c recfast.f90 -o Releaselib/recfast.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c reionization.f90 -o Releaselib/reionization.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c modules.f90 -o Releaselib/modules.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c bessels.f90 -o Releaselib/bessels.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c equations_bde_v3.f90 -o Releaselib/equations_bde_v3.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c halofit_ppf.f90 -o Releaselib/halofit_ppf.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c lensing.f90 -o Releaselib/lensing.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c SeparableBispectrum.F90 -o Releaselib/SeparableBispectrum.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c cmbmain.f90 -o Releaselib/cmbmain.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb.f90 -o Releaselib/camb.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb_python.f90 -o Releaselib/camb_python.o
ifort -shared -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ Releaselib/constants.o Releaselib/utils.o Releaselib/subroutines.o Releaselib/inifile.o Releaselib/power_tilt.o Releaselib/recfast.o Releaselib/reionization.o Releaselib/modules.o Releaselib/bessels.o Releaselib/equations_bde_v3.o Releaselib/halofit_ppf.o Releaselib/lensing.o Releaselib/SeparableBispectrum.o Releaselib/cmbmain.o Releaselib/camb.o Releaselib/camb_python.o -o Releaselib/camblib.so
ld: /tmp/ipo_ifortQTOQdO.o: relocation R_X86_64_32S against symbol `raset1_' can not be used when making a shared object; recompile with -fPIC
ld: failed to set dynamic section sizes: bad value
make: *** [Makefile_main:113: camblib.so] Error 1
The content of the makefile is the following:
#CAMB Makefile
#Set FISHER=Y to compile bispectrum fisher matrix code
FISHER=
#Will detect ifort/gfortran or edit for your compiler
ifortErr = $(shell which ifort >/dev/null; echo $$?)
ifeq "$(ifortErr)" "0"
#Intel compiler
# For OSX replace shared by dynamiclib
F90C = ifort
#erick11.04.19. We have to use these flags if we want to run a single mode
#FFLAGS = -fast -W0 -WB -fpp
#erick11.04.19. We have to use these flags if we want to run all modes & speed up calculations
FFLAGS = -fast -W0 -WB -fpp
SFFLAGS = -shared
DEBUGFLAGS = -g -check all -check noarg_temp_created -traceback -fpp -fpe0
ifortVer_major = $(shell ifort -v 2>&1 | cut -d " " -f 3 | cut -d. -f 1)
ifeq ($(shell test $(ifortVer_major) -gt 15; echo $$?),0)
FFLAGS+= -qopenmp
DEBUGFLAGS+= -qopenmp
else
FFLAGS+= -openmp -vec_report0
DEBUGFLAGS+= -openmp
endif
## This is flag is passed to the Fortran compiler allowing it to link C++ if required (not usually):
F90CRLINK = -cxxlib
#This is to append the ODEPACK fortran package to CAMB. We create the 'odepack' folder
# and move the files odepack.f, odepack_sub1.f, odepack_sub2.f. Then we create the
# libraries by typing:
# ifort -c odepack.f odepack_sub1.f odepack_sub2.f
# ar qc libodepack.a *.o
# Once we do that, the following line links these libraries to the code.
ODEPACK_LIB = /mnt/c/Users/jaloz/OneDrive/Desktop/Numerical_codes/BDE_CAMB_ifort/odepack
F90CRLINK = -cxxlib -L$(ODEPACK_LIB) -lodepack
MODOUT = -module $(OUTPUT_DIR)
SMODOUT = -module $(DLL_DIR)
ifneq ($(FISHER),)
FFLAGS += -mkl
endif
else
gfortErr = $(shell which gfortran >/dev/null; echo $$?)
ifeq "$(gfortErr)" "0"
#Gfortran compiler:
#The options here work in v4.6+. Python wrapper needs v4.9+.
F90C = gfortran
SFFLAGS = -shared -fPIC
FFLAGS = -O3 -fopenmp -ffast-math -fmax-errors=8
DEBUGFLAGS = -cpp -g -fbounds-check -fbacktrace -ffree-line-length-none -fmax-errors=8 -ffpe-trap=invalid,overflow,zero
MODOUT = -J$(OUTPUT_DIR)
SMODOUT = -J$(DLL_DIR)
ifneq ($(shell uname -s),Darwin)
#native optimization does not work on Mac
FFLAGS+=-march=native
endif
endif
endif
IFLAG = -I
#G95 compiler
#F90C = g95
#FFLAGS = -O2
#SGI, -mp toggles multi-processor. Use -O2 if -Ofast gives problems.
#F90C = f90
#FFLAGS = -Ofast -mp
#Digital/Compaq fortran, -omp toggles multi-processor
#F90C = f90
#FFLAGS = -omp -O4 -arch host -math_library fast -tune host -fpe1
#Absoft ProFortran, single processor:
#F90C = f95
#FFLAGS = -O2 -cpu:athlon -s -lU77 -w -YEXT_NAMES="LCS" -YEXT_SFX="_"
#NAGF95, single processor:
#F90C = f95
#FFLAGS = -DNAGF95 -O3
#PGF90
#F90C = pgf90
#FFLAGS = -O2 -DESCAPEBACKSLASH -Mpreprocess
#Sun V880
#F90C = mpf90
#FFLAGS = -O4 -openmp -ftrap=%none -dalign
#Sun parallel enterprise:
#F90C = f95
#FFLAGS = -O2 -xarch=native64 -openmp -ftrap=%none
#try removing -openmp if get bus errors. -03, -04 etc are dodgy.
#IBM XL Fortran, multi-processor (run gmake)
#F90C = xlf90_r
#FFLAGS = -DESCAPEBACKSLASH -DIBMXL -qsmp=omp -qsuffix=f=f90:cpp=F90 -O3 -qstrict -qarch=pwr3 -qtune=pwr3
#Settings for building camb_fits
#Location of FITSIO and name of library
FITSDIR ?= /usr/local/lib
FITSLIB = cfitsio
#Location of HEALPIX for building camb_fits
HEALPIXDIR ?= /usr/local/healpix
ifneq ($(FISHER),)
FFLAGS += -DFISHER
EXTCAMBFILES = Matrix_utils.o
else
EXTCAMBFILES =
endif
DEBUGFLAGS ?= FFLAGS
Debug: FFLAGS=$(DEBUGFLAGS)
include ./Makefile_main
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You got an ld error that told you exactly what to do to fix the issue. Did you try it? This is not a compile problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry Steve, I did not read properly what you said. I will do it by today and I'll show you the outcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
I fixed the issue. Now, everything is compiling smoothly. The output is the following:
mkdir -p Release
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c constants.f90 -o Release/constants.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c utils.F90 -o Release/utils.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c subroutines.f90 -o Release/subroutines.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c inifile.f90 -o Release/inifile.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c power_tilt.f90 -o Release/power_tilt.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c recfast.f90 -o Release/recfast.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c reionization.f90 -o Release/reionization.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c modules.f90 -o Release/modules.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c bessels.f90 -o Release/bessels.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c equations_bde_v3.f90 -o Release/equations_bde_v3.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c halofit_ppf.f90 -o Release/halofit_ppf.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c lensing.f90 -o Release/lensing.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c SeparableBispectrum.F90 -o Release/SeparableBispectrum.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c cmbmain.f90 -o Release/cmbmain.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c camb.f90 -o Release/camb.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ Release/constants.o Release/utils.o Release/subroutines.o Release/inifile.o Release/power_tilt.o Release/recfast.o Release/reionization.o Release/modules.o Release/bessels.o Release/equations_bde_v3.o Release/halofit_ppf.o Release/lensing.o Release/SeparableBispectrum.o Release/cmbmain.o Release/camb.o inidriver.F90 -cxxlib -L"/mnt/c/Users/jaloz/OneDrive/Desktop/Cosmo_codes/BDE_CAMB_ifort/odepack/" -lodepack -o camb
mkdir -p Releaselib
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c constants.f90 -o Releaselib/constants.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c utils.F90 -o Releaselib/utils.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c subroutines.f90 -o Releaselib/subroutines.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c inifile.f90 -o Releaselib/inifile.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c power_tilt.f90 -o Releaselib/power_tilt.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c recfast.f90 -o Releaselib/recfast.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c reionization.f90 -o Releaselib/reionization.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c modules.f90 -o Releaselib/modules.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c bessels.f90 -o Releaselib/bessels.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c equations_bde_v3.f90 -o Releaselib/equations_bde_v3.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c halofit_ppf.f90 -o Releaselib/halofit_ppf.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c lensing.f90 -o Releaselib/lensing.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c SeparableBispectrum.F90 -o Releaselib/SeparableBispectrum.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c cmbmain.f90 -o Releaselib/cmbmain.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb.f90 -o Releaselib/camb.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb_python.f90 -o Releaselib/camb_python.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ Releaselib/constants.o Releaselib/utils.o Releaselib/subroutines.o Releaselib/inifile.o Releaselib/power_tilt.o Releaselib/recfast.o Releaselib/reionization.o Releaselib/modules.o Releaselib/bessels.o Releaselib/equations_bde_v3.o Releaselib/halofit_ppf.o Releaselib/lensing.o Releaselib/SeparableBispectrum.o Releaselib/cmbmain.o Releaselib/camb.o Releaselib/camb_python.o -o Releaselib/camblib.so
cp Releaselib/camblib.so pycamb/camb
Now, when I execute the UNIX filed called camb obtained from the above compilation (the complete code with instructions can be found in GitHub - ealmaraz/Bound_Dark_Energy_CAMB: CAMB implementation of the Bound Dark Energy model) I got the following:
Reion redshift = 49.998
Om_b h^2 = NaN
Om_c h^2 = NaN
Om_nu h^2 = NaN
Om_K = NaN
Lambda_c = 44.024260
10^6 a_c = 2.484837
c_pot = 1.000000
H_0 = NaN
Om_m (1-Om_K-Om_L) = NaN
Om_DE^0 = NaN
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
camb 000000000077C7F0 Unknown Unknown Unknown
camb 00000000004B90E3 Unknown Unknown Unknown
camb 000000000040F9D4 Unknown Unknown Unknown
camb 000000000040F733 Unknown Unknown Unknown
camb 000000000040EE56 Unknown Unknown Unknown
camb 000000000040DA57 Unknown Unknown Unknown
camb 0000000000405282 Unknown Unknown Unknown
camb 00000000004031DD Unknown Unknown Unknown
camb 000000000077329A Unknown Unknown Unknown
camb 0000000000774B37 Unknown Unknown Unknown
camb 00000000004030B5 Unknown Unknown Unknown
The message "forrtl: severe (174): SIGSEGV, segmentation fault occurred" can be related to this odepack library? Is there a solution for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a bug in the CAMB source code that is detected by the current version of IFort (2021.10), but not by the older 14.0.4 version of the same compiler.
Subroutine SetupScalarArrayIndices in file equations_bde_v3.f90 has this USE statement:
use Quint
...
type(EvolutionVars) EV
and the source for module Quint, in the same source file, contains
use constants
The constants module, in file constants.f90, has this on line 27:
real(dl), parameter :: eV = 1.60217646e-19_dl
The bug consists of having the same name eV for the first dummy argument to subroutine SetupScalarArrayIndices, of type EvolutionVars, and as a real(dl) parameter that is exposed through USE association. This type of error is also present in a few more places in the source files that are part of CAMB. The comment lines that just precede the start of subroutine DVERK in file subroutines.f90 are quite revealing:
!This version is modified to pass an object parameter to the function on each call
!Fortunately Fortran doesn't do type checking on functions, so we can pretend the
!passed object parameter (EV) is any type we like. In reality it is just a pointer.
subroutine dverk (EV,n, fcn, x, y, xend, tol, ind, c, nw, w)
Naive common sense might have caused someone to insist on using an old compiler because it failed to detect (at least with the default options) this error at compile time, whereas the new version stopped the compilation upon discovering the error. In this instance, naive common sense was not a friend!
An error that is not caught at compile time may well result in generating an executable program that when run displays a seg-fault.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are some "good-enough-for-gubment-work" fixes to the CAMB sources that enabled me to build CAMB and run the two examples params_bfbdev3.ini and bdev3.1.4_bfbdev3_1k_params.ini using the current versions of ifort as well as ifx on Windows, and Gfortran on Cygwin-64. Someone familiar with the CAMB codes as well as cosmology should fix these name clash issues properly.
cmbmain.f90, line 961:
change
use Transfer
to
use Transfer, xcept => c, ycept => EV
equations_bde_v3.f90, line 996:
change
use Quint
to
use Quint, xcept => EV
equations_bde_v3.f90, lines 1698, 1699:
change
use lvalues
use ModelData
to
use lvalues, xcept => EV
use ModelData, ycept => EV
equations_bde_v3.f90, lines 2109 - 2111:
change
use constants
use ModelParams
use Quint
to
use constants, xcept => EV
use ModelParams, ycept => EV
use Quint, zcept => EV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank so much for your help! I will apply all these recommendations as you said in a new source code. I was struggling for a quite time with the errors and bugs.
I will post the output as soon as possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello mecej4,
I followed your instructions to compile the CAMB code (given in https://github.com/ealmaraz/Bound_Dark_Energy_CAMB). I compiled the code with ifort 2021.10.0 in WSL-Ubuntu on Windows 11 and I got the following output:
mkdir -p Release
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c constants.f90 -o Release/constants.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c utils.F90 -o Release/utils.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c subroutines.f90 -o Release/subroutines.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c inifile.f90 -o Release/inifile.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c power_tilt.f90 -o Release/power_tilt.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c recfast.f90 -o Release/recfast.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c reionization.f90 -o Release/reionization.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c modules.f90 -o Release/modules.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c bessels.f90 -o Release/bessels.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c equations_bde_v3.f90 -o Release/equations_bde_v3.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c halofit_ppf.f90 -o Release/halofit_ppf.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c lensing.f90 -o Release/lensing.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c SeparableBispectrum.F90 -o Release/SeparableBispectrum.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c cmbmain.f90 -o Release/cmbmain.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ -c camb.f90 -o Release/camb.o
ifort -fPIC -fast -W0 -WB -fpp -qopenmp -module Release -IRelease/ Release/constants.o Release/utils.o Release/subroutines.o Release/inifile.o Release/power_tilt.o Release/recfast.o Release/reionization.o Release/modules.o Release/bessels.o Release/equations_bde_v3.o Release/halofit_ppf.o Release/lensing.o Release/SeparableBispectrum.o Release/cmbmain.o Release/camb.o inidriver.F90 -cxxlib -cxxlib -L"/mnt/c/Users/jaloz/OneDrive/Desktop/Bound_Dark_Energy_CAMB/odepack/" -lodepack -o camb
ld: /opt/intel/oneapi/compiler/2023.2.1/linux/compiler/lib/intel64_lin/libiomp5.a(ompt-general.o): in function `ompt_pre_init':
(.text+0x2d24): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
mkdir -p Releaselib
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c constants.f90 -o Releaselib/constants.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c utils.F90 -o Releaselib/utils.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c subroutines.f90 -o Releaselib/subroutines.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c inifile.f90 -o Releaselib/inifile.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c power_tilt.f90 -o Releaselib/power_tilt.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c recfast.f90 -o Releaselib/recfast.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c reionization.f90 -o Releaselib/reionization.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c modules.f90 -o Releaselib/modules.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c bessels.f90 -o Releaselib/bessels.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c equations_bde_v3.f90 -o Releaselib/equations_bde_v3.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c halofit_ppf.f90 -o Releaselib/halofit_ppf.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c lensing.f90 -o Releaselib/lensing.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c SeparableBispectrum.F90 -o Releaselib/SeparableBispectrum.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c cmbmain.f90 -o Releaselib/cmbmain.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb.f90 -o Releaselib/camb.o
ifort -shared -fPIC -fast -W0 -WB -fpp -qopenmp -module Releaselib -IReleaselib/ -c camb_python.f90 -o Releaselib/camb_python.o
Cannot disable Fortran error message 6401
camb_python.f90(413): error #6401: The attributes of this name conflict with those made accessible by a USE statement. [C]
real(dl) c(24),w(EV%nvar,9), y(EV%nvar)
-------------^
Cannot disable Fortran error message 8284
camb_python.f90(430): error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic. [C]
call GaugeInterface_EvolveScal(EV,tau,y,tauend,tol1,ind,c,w)
-------------^
compilation aborted for camb_python.f90 (code 1)
make: *** [Makefile_main:126: Releaselib/camb_python.o] Error 1
It gives 2 errors in the source file "camb_python.f90". In my case, I was not able to build CAMB as it worked for you. Is this because of my linux terminal in Windows 11 or the source file "camb_python.f90" must be changed as well ?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page