diff --git a/README b/README index e1d7da54a13466ad281d328d5df6a17d44daa15c..31d6f7f4ea8a4e92594c11cd224b8afb9e99f9e7 100644 --- a/README +++ b/README @@ -41,15 +41,27 @@ Documentation is in the doc/ directory. ------ +Installation is, as of binary_c 2.1.4, performed using Meson (https://mesonbuild.com/) and Ninja. + +You can install Meson using your system package installer, but probably you require Meson 0.52.0 or later. You should install Python3 and pip, then install meson with + +--- +pip3 install meson +--- + +The old Perl configure script will remain in the binary_c tree for a while, but is officially deprecated. + +------ + You require the GNU scientific library from https://www.gnu.org/software/gsl/ -Binary_c is tested with GSL 2.4. Binary_c will look in GSL_DIR and $HOME/gsl for your GSL installation, -but you will need to tell binary_c if you have installed GSL in a non-system location, e.g. by -setting the environment variables LD_LIBRARY_PATH and LIBRARY_PATH with, +Binary_c is tested with GSL 2.5. +Binary_c will look in GSL_DIR and $HOME/gsl for your GSL installation, +but you will need to tell binary_c if you have installed GSL in a non-system location, e.g. by setting the environment variables LD_LIBRARY_PATH and LIBRARY_PATH with, -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:newgslpath -export LIBRARY_PATH=$LD_LIBRARY_PATH:newgslpath +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<newgslpath> +export LIBRARY_PATH=$LD_LIBRARY_PATH:<newgslpath> -where "newgslpath" is the location of the libgsl.so shared library. +where "<newgslpath>" is the location of the libgsl.so shared library. If you cannot find libgsl.so (which may be libgsl.so.23 or similar) you cannot run binary_c. GSL can be found at https://www.gnu.org/software/gsl/ diff --git a/binary_c-config b/binary_c-config index 54a1737212d885aef56439e3dcd6a5fe5042fadb..034315b665ab3b73d203b520ab44a1bb871cf268 100755 --- a/binary_c-config +++ b/binary_c-config @@ -20,7 +20,7 @@ ############################################################ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -BIN="$DIR/src/binary_c" +BIN="$DIR/binary_c" if [[ ! -x "$BIN" ]];then echo -e "\e[91m" diff --git a/configure b/configure index ce553583144690114004dec749b13b68d87efb32..c1e65d042cd2b1ba9cf8eb2497f0bb1a52727963 100755 --- a/configure +++ b/configure @@ -44,6 +44,8 @@ # or # ./configure gcov +print STDERR "binary_c's configure script is now deprecated. You should install using Meson instead. configure will be removed at some point - you have been warned! :)\n"; + use strict; use warnings; diff --git a/disc_slow_runs b/disc_slow_runs deleted file mode 100644 index dea83c15b150690a51a22815a8800e31304a32da..0000000000000000000000000000000000000000 --- a/disc_slow_runs +++ /dev/null @@ -1,9 +0,0 @@ - binary_c --M_1 1.84047512867673 --M_2 2.05307166963857 --orbital_period 0 --separation 129.77605868919 --metallicity 0.02 --max_evolution_time 15000 --comenv_disc_mass_fraction 0.01 --comenv_disc_angmom_fraction 0.5 --cbdisc_gamma 1.66666666666667 --cbdisc_alpha 0.00496891714145382 --cbdisc_kappa 0.143852469834572 --cbdisc_torquef 0.00678912760451139 --cbdisc_mass_loss_constant_rate 0 --cbdisc_mass_loss_inner_viscous_multiplier 39.4794721680935 --cbdisc_mass_loss_inner_viscous_accretion_method 0 --cbdisc_mass_loss_inner_L2_cross_multiplier 0.0440220279254824 --cbdisc_mass_loss_ISM_pressure 1310.95227133604 --cbdisc_mass_loss_ISM_ram_pressure_multiplier 60.4082493332708 --cbdisc_mass_loss_FUV_multiplier 0 --cbdisc_mass_loss_Xray_multiplier 32.6025987642574 --cbdisc_viscous_photoevaporation_coupling 1 --cbdisc_inner_edge_stripping 1 --cbdisc_outer_edge_stripping 0 --cbdisc_eccentricity_pumping_method 1 --cbdisc_resonance_multiplier 37.6599105823292 --cbdisc_resonance_damping 1 --disc_log 0 --disc_timestep_factor 0.01 --cbdisc_minimum_luminosity 0.0001 --cbdisc_minimum_mass 1e-06 --cbdisc_minimum_fRing 0.2 --cbdisc_fail_ring_inside_separation 0 --cbdisc_max_lifetime 1000000 - - binary_c --M_1 5.5165222628393 --M_2 4.48486229138998 --orbital_period 0 --separation 1548.76183110106 --metallicity 0.02 --max_evolution_time 15000 --comenv_disc_mass_fraction 0.01 --comenv_disc_angmom_fraction 0.5 --cbdisc_gamma 1.66666666666667 --cbdisc_alpha 0.0365044562273362 --cbdisc_kappa 0.646882802786714 --cbdisc_torquef 0.00459982435709256 --cbdisc_mass_loss_constant_rate 0 --cbdisc_mass_loss_inner_viscous_multiplier 51.6970666788662 --cbdisc_mass_loss_inner_viscous_accretion_method 2 --cbdisc_mass_loss_inner_L2_cross_multiplier 0.734431102282148 --cbdisc_mass_loss_ISM_pressure 12655.4492020609 --cbdisc_mass_loss_ISM_ram_pressure_multiplier 30.7706084010714 --cbdisc_mass_loss_FUV_multiplier 0 --cbdisc_mass_loss_Xray_multiplier 0.649410320944099 --cbdisc_viscous_photoevaporation_coupling 0 --cbdisc_inner_edge_stripping 0 --cbdisc_outer_edge_stripping 0 --cbdisc_eccentricity_pumping_method 1 --cbdisc_resonance_multiplier 12.0027407857354 --cbdisc_resonance_damping 1 --disc_log 0 --disc_timestep_factor 0.01 --cbdisc_minimum_luminosity 0.0001 --cbdisc_minimum_mass 1e-06 --cbdisc_minimum_fRing 0.2 --cbdisc_fail_ring_inside_separation 0 --cbdisc_max_lifetime 1000000 - -binary_c --M_1 2.34800412697258 --M_2 4.97674463119345 --orbital_period 0 --separation 1285.20409640316 --metallicity 0.02 --max_evolution_time 15000 --comenv_disc_mass_fraction 0.01 --comenv_disc_angmom_fraction 0.5 --cbdisc_gamma 1.66666666666667 --cbdisc_alpha 0.000678289948194627 --cbdisc_kappa 0.000101247348366322 --cbdisc_torquef 0.000830405666758338 --cbdisc_mass_loss_constant_rate 0 --cbdisc_mass_loss_inner_viscous_multiplier 20.5598866933581 --cbdisc_mass_loss_inner_viscous_accretion_method 0 --cbdisc_mass_loss_inner_L2_cross_multiplier 0.544446172574897 --cbdisc_mass_loss_ISM_pressure 2308.36086370124 --cbdisc_mass_loss_ISM_ram_pressure_multiplier 95.675649788404 --cbdisc_mass_loss_FUV_multiplier 0 --cbdisc_mass_loss_Xray_multiplier 11.1486390273392 --cbdisc_viscous_photoevaporation_coupling 1 --cbdisc_inner_edge_stripping 0 --cbdisc_outer_edge_stripping 0 --cbdisc_eccentricity_pumping_method 1 --cbdisc_resonance_multiplier 15.1719431382976 --cbdisc_resonance_damping 1 --disc_log 0 --disc_timestep_factor 0.01 --cbdisc_minimum_luminosity 0.0001 --cbdisc_minimum_mass 1e-06 --cbdisc_minimum_fRing 0.2 --cbdisc_fail_ring_inside_separation 0 --cbdisc_max_lifetime 1000000 - -binary_c --M_1 4.19515431321848 --M_2 2.31704326943836 --orbital_period 0 --separation 1141.40998406809 --metallicity 0.02 --max_evolution_time 15000 --comenv_disc_mass_fraction 0.01 --comenv_disc_angmom_fraction 0.5 --cbdisc_gamma 1.66666666666667 --cbdisc_alpha 0.00103653117338109 --cbdisc_kappa 0.000326131878848017 --cbdisc_torquef 0.00962159018496431 --cbdisc_mass_loss_constant_rate 0 --cbdisc_mass_loss_inner_viscous_multiplier 11.3672284601041 --cbdisc_mass_loss_inner_viscous_accretion_method 0 --cbdisc_mass_loss_inner_L2_cross_multiplier 0.621557583891413 --cbdisc_mass_loss_ISM_pressure 12999.1171104964 --cbdisc_mass_loss_ISM_ram_pressure_multiplier 13.803554139125 --cbdisc_mass_loss_FUV_multiplier 0 --cbdisc_mass_loss_Xray_multiplier 31.1455461160108 --cbdisc_viscous_photoevaporation_coupling 1 --cbdisc_inner_edge_stripping 0 --cbdisc_outer_edge_stripping 0 --cbdisc_eccentricity_pumping_method 1 --cbdisc_resonance_multiplier 66.0967694438224 --cbdisc_resonance_damping 1 --disc_log 0 --disc_timestep_factor 0.01 --cbdisc_minimum_luminosity 0.0001 --cbdisc_minimum_mass 1e-06 --cbdisc_minimum_fRing 0.2 --cbdisc_fail_ring_inside_separation 0 --cbdisc_max_lifetime 1000000 - - diff --git a/doc/README b/doc/README index 2609e436ebb1447e922ddb27c424ccbf6bd2f9da..914efa077b0b0cc3862fb058ef8b029760ea2d61 100644 --- a/doc/README +++ b/doc/README @@ -2,11 +2,7 @@ Welcome to binary_c's documentation repository * Instructions for getting binary_c are in getting_binary_c.pdf -* Installation instructions are in binary_c-installation.pdf - -* To learn about the binary_c stellar evolution code, look at binary_c2.pdf - -* To learn about changes implemented in binary_c V2.0+ see binary_cV2.pdf +* To learn about everything, look at binary_c2.pdf * A flow chart describing binary_c is at "Binary_c Flowchart.pdf" diff --git a/doc/binary_c-installation.lyx b/doc/binary_c-installation.lyx index 9c8370c89f10beca1127dbcf5aae9a6ba0397a1c..b4259364795d8d45a549bba1b306305e6195dabf 100644 --- a/doc/binary_c-installation.lyx +++ b/doc/binary_c-installation.lyx @@ -195,6 +195,23 @@ keepaspectratio]{images/falk2-low-lolores.eps}% \begin_body +\begin_layout Title +This document is deprecated. + Please see binary_c2.lyx/pdf instead. +\end_layout + +\begin_layout Standard +\begin_inset CommandInset line +LatexCommand rule +offset "0.5ex" +width "100col%" +height "1pt" + +\end_inset + + +\end_layout + \begin_layout Title \series bold @@ -224,7 +241,7 @@ binary_grid2 \align center \series bold -Version 2.1 (git revision ) +Version 2.1.4+ \begin_inset Newline newline \end_inset @@ -300,8 +317,17 @@ A \emph on C \emph default - compiler e.g. - + compiler. + Binary_c has been tested on +\emph on +gcc +\emph default + and +\emph on +clang +\emph default +. + Other options are available, but probably will not work. \begin_inset Separator latexpar \end_inset @@ -326,26 +352,12 @@ http://gcc.gnu.org/ \end_inset ) this comes as standard on most Linux systems and is easily installed on - others -\end_layout - -\begin_layout Itemize - + others. + \emph on -icc +gcc \emph default - (Intel compiler -\begin_inset Flex URL -status collapsed - -\begin_layout Plain Layout - -http://software.intel.com/en-us/articles/intel-compilers/ -\end_layout - -\end_inset - -) this costs money +is free. \end_layout \begin_layout Itemize @@ -368,6 +380,31 @@ literal "false" ) is also free, and may be faster than \emph on gcc +\emph default +. +\end_layout + +\begin_layout Itemize + +\emph on +icc +\emph default + (Intel compiler +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://software.intel.com/en-us/articles/intel-compilers/ +\end_layout + +\end_inset + +) this costs money and +\emph on +binary_c +\emph default + has not been tested with it recently. \end_layout \begin_layout Standard @@ -405,10 +442,44 @@ This information may be out of date! Please test the build and let me know. \end_deeper \begin_layout Itemize +\emph on +Python3 +\emph default +, +\emph on +Meson +\emph default + and +\emph on +Ninja +\emph default + are required for installation. + You can install all of these on your system, e.g. + with the following on +\emph on +Ubuntu 18.04 +\emph default +, +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +sudo apt-get install python3 meson ninja-build +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize + \emph on Perl \emph default - - this is required for the configuration script and + - this is required for \emph on binary_grid2 \emph default @@ -587,6 +658,52 @@ binutils package. \end_layout +\begin_layout Itemize + +\emph on +libmemoize +\emph default + can be downloaded from +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://gitlab.eps.surrey.ac.uk/ri0005/libmemoize +\end_layout + +\end_inset + + but a version is included in +\emph on +binary_c +\emph default +if you do not have it. +\end_layout + +\begin_layout Itemize + +\emph on +librinterpolate +\emph default + can be downloaded from +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://gitlab.eps.surrey.ac.uk/ri0005/librinterpolate +\end_layout + +\end_inset + + but a version is included in +\emph on +binary_c +\emph default +if you do not have it. +\end_layout + \begin_layout Standard By using \emph on @@ -802,8 +919,11 @@ which will unzip the files in the appropriate places. \end_layout \begin_layout Subsubsection -And then\SpecialChar ldots +Build with meson +\end_layout +\begin_layout Standard +From inside \end_layout \begin_layout Standard diff --git a/doc/binary_c2.lyx b/doc/binary_c2.lyx index 24bb2e4c8318de9e2da672265052e0bed8b92750..a1eba77ece1cbd03d2814d946171b8573721779b 100644 --- a/doc/binary_c2.lyx +++ b/doc/binary_c2.lyx @@ -1487,6 +1487,31 @@ Change to the \end_inset and its shared library. + Note: if builddir already exists, you need to add +\begin_inset listings +lstparams "language=bash" +inline true +status open + +\begin_layout Plain Layout + +--reconfigure +\end_layout + +\end_inset + + to the +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +Meson +\end_layout + +\end_inset + + command. + \begin_inset listings inline false status open @@ -1498,22 +1523,32 @@ cd $BINARY_C \begin_layout Plain Layout -./configure generic +meson builddir \end_layout \begin_layout Plain Layout -make cleanall +cd builddir \end_layout \begin_layout Plain Layout -make +ninja \end_layout \begin_layout Plain Layout -make libbinary_c.so +ninja libbinary_c.so +\end_layout + +\begin_layout Plain Layout + +ninja libbinary_c_symlink +\end_layout + +\begin_layout Plain Layout + +cd .. \end_layout \end_inset @@ -1577,7 +1612,7 @@ wget --no-check-certificate -O - http://install.perlbrew.pl | bash \begin_layout Plain Layout -perlbrew -v install perl-5.31.3 --thread --multi --64bitall --notest -Dusethreads +perlbrew -v install perl-5.31.5 --thread --multi --64bitall --notest -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Dpager=/usr/bin/sensible-pager -Doptimize=" -O3 mtune=generic" -Duseshrplib -j $NTHREADS \end_layout @@ -3247,12 +3282,22 @@ status open \begin_layout Plain Layout -./configure +meson builddir \end_layout \begin_layout Plain Layout -make +cd builddir +\end_layout + +\begin_layout Plain Layout + +ninja --buildtype release +\end_layout + +\begin_layout Plain Layout + +cd .. \end_layout \begin_layout Plain Layout @@ -3525,7 +3570,7 @@ MacOS \end_inset - systems and is easily installed on others, + systems and is easily installed on others, and is free software. \end_layout \begin_layout Itemize @@ -3533,77 +3578,77 @@ MacOS status open \begin_layout Plain Layout -icc +clang \end_layout \end_inset - (Intel compiler -\begin_inset CommandInset href -LatexCommand href -target "http://software.intel.com/en-us/articles/intel-compilers/" - -\end_inset - -) this costs money but it is probably faster than + ( +\emph on +C +\emph default + compiler for \begin_inset Flex Software status open \begin_layout Plain Layout - -\emph off -gcc +LLVM \end_layout \end_inset -, -\end_layout + +\begin_inset CommandInset href +LatexCommand href +target "http://clang.llvm.org/" +literal "false" -\begin_layout Itemize +\end_inset + +) is also free, and may be faster than \begin_inset Flex Software status open \begin_layout Plain Layout -clang +gcc \end_layout \end_inset - ( + \emph on -C -\emph default - compiler for +. +\end_layout + +\begin_layout Itemize \begin_inset Flex Software status open \begin_layout Plain Layout -LLVM +icc \end_layout \end_inset - + (Intel compiler \begin_inset CommandInset href LatexCommand href -target "http://clang.llvm.org/" -literal "false" +target "http://software.intel.com/en-us/articles/intel-compilers/" \end_inset -) is also free, and may be faster than +) this costs money but it is probably faster than \begin_inset Flex Software status open \begin_layout Plain Layout + +\emph off gcc \end_layout \end_inset - -\emph on . \end_layout @@ -3719,22 +3764,88 @@ This information may be out of date! Please test the build and let me know. status open \begin_layout Plain Layout -Perl +Python \end_layout \end_inset - - this is required for the configuration script and, should you wish to - evolve stellar populations, the -\emph on +, +\begin_inset Flex Software +status open + +\begin_layout Plain Layout + +\emph off +meson +\end_layout + +\end_inset + + and +\begin_inset Flex Software +status open + +\begin_layout Plain Layout + +\emph off +ninja +\end_layout -\begin_inset Formula $\binarygrid$ \end_inset +. + You can install these tools on your system. + You should make sure you have +\begin_inset Flex Software +status open -\emph default - software. - +\begin_layout Plain Layout + +\emph off +meson +\end_layout + +\end_inset + + V0.52.0 or later. + If you have +\begin_inset Flex ScriptingLanguage +status open + +\begin_layout Plain Layout +Python3 +\end_layout + +\end_inset + + installed, you can update +\begin_inset Flex Software +status open + +\begin_layout Plain Layout + +\emph off +meson +\end_layout + +\end_inset + + with +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +pip3 install meson +\end_layout + +\end_inset + +which should get you the latest version. +\end_layout + +\begin_layout Itemize \begin_inset Flex ScriptingLanguage status open @@ -3744,16 +3855,26 @@ Perl \end_inset - is usually installed on your system, and for configuration of + - this is required for the \emph on -\begin_inset Formula $\binaryc$ +\begin_inset Formula $\binarygrid2$ \end_inset \emph default - this should be sufficient. - You can download + software. + +\begin_inset Flex ScriptingLanguage +status open + +\begin_layout Plain Layout +Perl +\end_layout + +\end_inset + + is usually installed on your system, or you can download \begin_inset Flex ScriptingLanguage status open @@ -3763,7 +3884,7 @@ Perl \end_inset - at + at \begin_inset CommandInset href LatexCommand href name "www.perl.com" @@ -3771,20 +3892,18 @@ literal "false" \end_inset -, or use your system -\begin_inset Flex ScriptingLanguage +, but I recommend +\begin_inset Flex Software status open \begin_layout Plain Layout -Perl + +\emph off +Perlbrew \end_layout \end_inset -, but I recommend -\emph on -Perlbrew -\emph default instead. Please try to use a version of \begin_inset Flex ScriptingLanguage @@ -3796,7 +3915,7 @@ Perl \end_inset - that is 5.16 or later: 5.29.8 is currently the latest version and works just + that is 5.16 or later: 5.31.5 is currently the latest version and works just fine. \emph on @@ -3832,13 +3951,10 @@ cpanm essential \emph default if you want to use -\begin_inset Formula $\binarygrid$ +\begin_inset Formula $\binarygrid2$ \end_inset . - These are standard tools. - I recommend downloading them, but they could also be installed on your - system as packages. \end_layout \begin_layout Itemize @@ -3855,6 +3971,14 @@ git \emph default , see the document +\emph on +getting_binary_c +\begin_inset space ~ +\end_inset + + +\emph default +. \end_layout \begin_layout Itemize @@ -4182,7 +4306,7 @@ unzip \end_layout \begin_layout Subsubsection -Configuration +Building with Meson \begin_inset CommandInset label LatexCommand label name "subsec:Configuration" @@ -4203,13 +4327,20 @@ binary_c \end_inset - directory, you need to run the configuration script with + directory, you need to use +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +meson \end_layout -\begin_layout Standard +\end_inset + to make a build directory, e.g., \family typewriter \series bold + \begin_inset listings lstparams "language=bash" inline false @@ -4217,27 +4348,25 @@ status open \begin_layout Plain Layout -./configure +meson builddir --buildtype release \end_layout \end_inset -\end_layout - -\begin_layout Standard -which creates some object files and the -\begin_inset Flex File +\family default +\series default +and now you should go to that directory to build the code using +\begin_inset Flex Software status open \begin_layout Plain Layout -Makefile +ninja, \end_layout \end_inset -. - Now type + \end_layout \begin_layout Standard @@ -4251,134 +4380,124 @@ status open \begin_layout Plain Layout -./make +cd builddir +\end_layout + +\begin_layout Plain Layout + +ninja \end_layout \end_inset +\family default +\series default +The code will now build, assuming everything worked ok. + If it does +\emph on +not +\emph default + work then please try to fix it (using, e.g. + +\emph on +Google +\emph default +) before running to me with complaints. + It works fine on +\begin_inset Flex OS +status open + +\begin_layout Plain Layout +Linux \end_layout -\begin_layout Standard -to build the code. - The make script is a wrapper around +\end_inset + + and will revert to \begin_inset Flex Software status open \begin_layout Plain Layout -GNU make +gcc \end_layout \end_inset - that executes the build on as many CPUs as you have, and pretties up the - output so that it is more readable. - Note that you may need to use + as the default compiler if something goes wrong. + \end_layout \begin_layout Standard - -\family typewriter -\series bold -\begin_inset listings -lstparams "language=bash" -inline false +You can change the +\begin_inset Flex Args status open \begin_layout Plain Layout - -gmake +buildtype \end_layout \end_inset + to debug if you want to build for testing (this is the default if you do + not include any +\begin_inset Flex Args +status open -\end_layout - -\begin_layout Standard -from the -\begin_inset Flex File -status open - -\begin_layout Plain Layout -src +\begin_layout Plain Layout +buildtype \end_layout \end_inset - directory if -\begin_inset Flex Software +) – see +\begin_inset Flex URL status open \begin_layout Plain Layout -GNU make + +https://mesonbuild.com/Running-Meson.html \end_layout \end_inset - is not your default (e.g. -\begin_inset space ~ -\end_inset + for details. +\end_layout -on -\begin_inset Flex OS +\begin_layout Standard +The executable is called +\begin_inset Flex File status open \begin_layout Plain Layout -Solaris +binary_c \end_layout \end_inset -). - -\begin_inset Newline newline -\end_inset - -The code will now build, assuming +. + To run a star go back to the main binary_c directory and run tbse, e.g., \family typewriter -configure -\family default - worked ok. - If configure does -\emph on -not -\emph default - work then please try to fix it before running to me with complaints. - It works fine on -\begin_inset Flex OS -status open - -\begin_layout Plain Layout -Linux -\end_layout - -\end_inset +\series bold - and will revert to -\begin_inset Flex Software +\begin_inset listings +lstparams "language=bash" +inline false status open \begin_layout Plain Layout -gcc -\end_layout -\end_inset - - as the default compiler if something goes wrong. - The executable is called -\begin_inset Flex File -status open +cd .. +\end_layout \begin_layout Plain Layout -binary_c + +tbse \end_layout \end_inset -\family typewriter -. \end_layout \begin_layout Standard @@ -4411,6 +4530,75 @@ for use with distributed computing). versions will probably use environment variables to point to data directories. \end_layout +\begin_layout Subsubsection +Cleaning the build tree +\end_layout + +\begin_layout Standard +You can clean the build directory with +\family typewriter +\series bold + +\begin_inset listings +lstparams "language=bash" +inline false +status open + +\begin_layout Plain Layout + +cd builddir +\end_layout + +\begin_layout Plain Layout + +ninja clean +\end_layout + +\end_inset + + +\family default +\series default +This does not clean the data objects, which are built only once. + If you want to clean these as well (equivalent to a +\begin_inset listings +lstparams "language=bash" +inline true +status open + +\begin_layout Plain Layout + +make cleanall +\end_layout + +\end_inset + + of old) you should run, +\family typewriter +\series bold + +\begin_inset listings +lstparams "language=bash" +inline false +status open + +\begin_layout Plain Layout + +./meson/clean_data_objects.sh +\end_layout + +\end_inset + + +\family default +\series default +from within the +\begin_inset Formula $\binaryc$ +\end_inset + + main directory. +\end_layout + \begin_layout Subsubsection Building the shared library \begin_inset Formula $\libbinaryc$ @@ -4420,7 +4608,7 @@ Building the shared library \end_layout \begin_layout Standard -To build the shared library, run +To build the shared library, go back into the builddir and run, \end_layout \begin_layout Standard @@ -4431,12 +4619,17 @@ status open \begin_layout Plain Layout -./configure +cd builddir \end_layout \begin_layout Plain Layout -make libbinary_c.so +ninja libbinary_c.so +\end_layout + +\begin_layout Plain Layout + +ninja libbinary_c_symlink \end_layout \end_inset @@ -4482,6 +4675,39 @@ C API \emph default functions. + The +\begin_inset Flex Args +status open + +\begin_layout Plain Layout +libbinary_c_symlink +\end_layout + +\end_inset + + build sets up a symbolic link in the +\begin_inset Formula $\binaryc$ +\end_inset + + +\begin_inset Flex File +status open + +\begin_layout Plain Layout +src +\end_layout + +\end_inset + + directory which allows +\begin_inset Formula $\binarygrid$ +\end_inset + + +\emph on +2 +\emph default +to function. \end_layout \begin_layout Subsubsection @@ -4507,7 +4733,18 @@ clang \emph default -, with +, by setting the +\begin_inset Flex Envvar +status open + +\begin_layout Plain Layout +CC +\end_layout + +\end_inset + + environment variable. + If you have not yet made a builddir, do the following. \end_layout \begin_layout Standard @@ -4523,12 +4760,55 @@ export CC=clang \begin_layout Plain Layout -./configure +meson builddir --buildtype release +\end_layout + +\begin_layout Plain Layout + +cd builddir +\end_layout + +\begin_layout Plain Layout + +ninja +\end_layout + +\end_inset + +and if you already have a +\begin_inset Flex File +status open + +\begin_layout Plain Layout +builddir +\end_layout + +\end_inset + +, do the following, +\begin_inset listings +lstparams "language=bash" +inline false +status open + +\begin_layout Plain Layout + +export CC=clang +\end_layout + +\begin_layout Plain Layout + +cd builddir \end_layout \begin_layout Plain Layout -./make +meson --reconfigure --buildtype release +\end_layout + +\begin_layout Plain Layout + +ninja \end_layout \end_inset @@ -4541,10 +4821,20 @@ Debugging build \end_layout \begin_layout Standard -To enable full debugging, run +To enable full debugging, run, from within +\begin_inset Flex File +status open + +\begin_layout Plain Layout +builddir \end_layout -\begin_layout Standard +\end_inset + +, +\family typewriter +\series bold + \begin_inset listings lstparams "language=bash" inline false @@ -4552,27 +4842,70 @@ status open \begin_layout Plain Layout -./configure debug +meson builddir --buildtype debug \end_layout \begin_layout Plain Layout -./make +ninja \end_layout \end_inset +\family default +\series default +or just \family typewriter \series bold -\begin_inset Newline newline +\begin_inset listings +lstparams "language=bash" +inline false +status open + +\begin_layout Plain Layout + +meson builddir +\end_layout + +\begin_layout Plain Layout + +cd builddir +\end_layout + +\begin_layout Plain Layout + +ninja +\end_layout + \end_inset \family default \series default -You require debugging to use +because +\begin_inset Flex Args +status open + +\begin_layout Plain Layout +debug +\end_layout + +\end_inset + + is the default +\begin_inset Flex Args +status open + +\begin_layout Plain Layout +buildtype +\end_layout + +\end_inset + +. + You require debugging to use \begin_inset Flex Software status open @@ -4638,6 +4971,9 @@ gcc \end_inset 's various flags to improve accuracy with +\family typewriter +\series bold + \begin_inset listings lstparams "language=bash" inline false @@ -4645,7 +4981,7 @@ status open \begin_layout Plain Layout -./configure accurate +meson -Daccurate=true \end_layout \end_inset @@ -4713,7 +5049,7 @@ status open \begin_layout Plain Layout -./configure generic +meson -Dgeneric=true \end_layout \end_inset @@ -4766,17 +5102,108 @@ literal "false" \begin_inset Formula $\binaryc$ \end_inset - just in case you cannot install them, and a standard system -\begin_inset Flex Software + just in case you cannot install them, and a standard system +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +GSL +\end_layout + +\end_inset + + should work. +\end_layout + +\begin_layout Standard +You should make sure +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +Meson +\end_layout + +\end_inset + + knows about the locations of your libraries. + Usually it is sufficient to set their locations (i.e. +\begin_inset space ~ +\end_inset + +the directories in which they reside) in the environment variables +\begin_inset Flex Envvar +status open + +\begin_layout Plain Layout +LIBRARY_PATH +\end_layout + +\end_inset + + (for compilation) and +\begin_inset Flex Envvar +status open + +\begin_layout Plain Layout +LD_LIBRARY_PATH +\end_layout + +\end_inset + + (at runtime). + For example, to point to the directories +\begin_inset Flex File +status open + +\begin_layout Plain Layout +$HOME/lib +\end_layout + +\end_inset + + and +\begin_inset Flex File +status open + +\begin_layout Plain Layout +$HOME/otherlibs +\end_layout + +\end_inset + +, using +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +bash +\end_layout + +\end_inset + +, +\family typewriter +\series bold + +\begin_inset listings +lstparams "language=bash" +inline false status open \begin_layout Plain Layout -GSL + +export LIBRARY_PATH=$HOME/lib:$HOME/otherlibs +\end_layout + +\begin_layout Plain Layout + +export LD_LIBRARY_PATH=$HOME/lib:$HOME/otherlibs \end_layout \end_inset - should work. + \end_layout \begin_layout Subsubsection @@ -4881,7 +5308,11 @@ test binary star evolution \begin_inset Quotes erd \end_inset - called, + which is located in the main +\begin_inset Formula $\binaryc$ +\end_inset + + directory, called, \end_layout \begin_layout Standard @@ -4902,24 +5333,11 @@ You should see some output. \begin_inset Newline newline \end_inset -You may have to symbolically link the executable at -\begin_inset Flex File -status open - -\begin_layout Plain Layout -src/binary_c to binary_c -\end_layout - -\end_inset - - in the root -\begin_inset Formula $\binaryc$ -\end_inset - - directory to make this work, e.g., -\end_layout +Note: You may have to symbolically link the executable to make this work. + You can do this manually by going into the builddir and running +\family typewriter +\series bold -\begin_layout Standard \begin_inset listings lstparams "language=bash" inline false @@ -4927,12 +5345,7 @@ status open \begin_layout Plain Layout -cd <binary_c_directory> -\end_layout - -\begin_layout Plain Layout - -ln -s src/binary_c +ninja binary_c_symlink \end_layout \end_inset @@ -5516,7 +5929,42 @@ unit_tests \end_inset - contains some test components + contains some test components (likely to be updated in later versions) +\end_layout + +\begin_layout Itemize +\begin_inset Flex File +status open + +\begin_layout Plain Layout +builddir +\end_layout + +\end_inset + + contains the +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +Meson +\end_layout + +\end_inset + +/ +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +Ninja +\end_layout + +\end_inset + + build information. + You can delete this at any time, but you will have to rebuild everything + from scratch. \end_layout \begin_layout Standard @@ -7759,7 +8207,17 @@ BINARY_C \emph default tree. - Then rebuild, e.g., + Then rebuild, e.g., assuming you already have a +\begin_inset Flex File +status open + +\begin_layout Plain Layout +builddir +\end_layout + +\end_inset + +, \end_layout \begin_layout Standard @@ -7780,12 +8238,32 @@ export BINARY_C=$HOME/binary_c \begin_layout Plain Layout -./configure +cd builddir +\end_layout + +\begin_layout Plain Layout + +meson --reconfigure -Dlibname=binary_c_custom +\end_layout + +\begin_layout Plain Layout + +ninja libbinary_c_custom.so +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +# ... + change directory to where you have binary_grid2.tar.gz ... + \end_layout \begin_layout Plain Layout -make libbinary_c_custom.so \end_layout \begin_layout Plain Layout @@ -13063,7 +13541,7 @@ name "subsec:Advanced-Configuration" \end_layout \begin_layout Standard -There are three main configuration files which affect how the +There are three main C header files which affect how the \begin_inset Formula $\binaryc$ \end_inset @@ -13098,99 +13576,45 @@ nucsyn/nucsyn_parameters.h \end_inset . -\end_layout - -\begin_layout Standard -Also, some options are enabled via the -\begin_inset Flex File -status open - -\begin_layout Plain Layout -Makefile -\end_layout - -\end_inset - - (set up by the -\emph on - -\begin_inset Flex Perlscript + Some low-level configuration is also performed by the +\begin_inset Flex Software status open \begin_layout Plain Layout - -\emph off -configure +Meson \end_layout \end_inset - -\emph default -script). - + build process. \end_layout \begin_layout Subsection -configure +Meson configuation \end_layout \begin_layout Standard -The -\begin_inset Flex Perlscript -status open - -\begin_layout Plain Layout -configure -\end_layout - -\end_inset - - -\emph on - -\emph default -script should be run before you do anything else. - It makes the -\begin_inset Flex File -status open - -\begin_layout Plain Layout - -\emph off -Makefile -\end_layout - -\end_inset - - and also makes a source file called +When you change something in \begin_inset Flex HeaderFile status open \begin_layout Plain Layout -nucsyn/nucsyn_unrolled_functions.h +binary_structures.h \end_layout \end_inset -. - This function contains loop–unrolled versions of a few bottleneck functions - which execute more quickly than if they were in loops (yes, even telling - the compiler to unroll the loops is not as fast). -\end_layout - -\begin_layout Standard -When you change something in -\begin_inset Flex HeaderFile +, or one of the other header files, you may have to reconfigure +\begin_inset Flex Software status open \begin_layout Plain Layout -binary_structures.h +Meson \end_layout \end_inset - you may have to rerun configure because this in turn reruns + because this in turn reruns \begin_inset Flex Perlscript status open @@ -13594,11 +14018,11 @@ Makefile -D\SpecialChar ldots \begin_layout Standard Some options are set up by -\begin_inset Flex Command +\begin_inset Flex Software status open \begin_layout Plain Layout -configure +Meson \end_layout \end_inset @@ -13607,17 +14031,7 @@ configure \emph on \emph default -and passed into the -\begin_inset Flex File -status open - -\begin_layout Plain Layout -Makefile -\end_layout - -\end_inset - - +and passed \emph on \emph default @@ -13739,6 +14153,7 @@ reference "subsec:git-revision" \end_inset for more details. + \end_layout \begin_layout Subsection @@ -13777,15 +14192,7 @@ SEGFAULTS ACML \family default should be set if you wish to use the AMD math (sic) library. - This should not be set here, but with in the -\emph on -Makefile -\emph default - with the -\emph on -configure -\emph default - script. + Note: this has not been tested for a long time. \end_layout \begin_layout Itemize @@ -13794,15 +14201,7 @@ configure DUMA \family default should be set if you wish to use the DUMA memory checking library. - This should not be set here, but with in the -\emph on -Makefile -\emph default - with the -\emph on -configure -\emph default - script. + Note: this has not been tested for a long time. \end_layout \begin_layout Itemize @@ -14061,9 +14460,10 @@ stderr \family typewriter UNROLL_NUCSYN_LOOPS \family default - allows use of the automatically generated loop unrolling as done in the - configure script (see above). - This seems to work, and is generally faster, but you should check. + allows use of the automatically generated loop unrolling. + +\series bold +Note: this option is deprecated. \end_layout \begin_layout Itemize @@ -17565,85 +17965,7 @@ LES experiments to introduce lithium as a function of mass and pulse number \begin_layout Standard Now you have edited this file to your specifications you need to rebuild the code. - The simplest way is -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=bash" -inline false -status open - -\begin_layout Plain Layout - -make -\end_layout - -\end_inset - -but if the compile fails, try -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=bash" -inline false -status open - -\begin_layout Plain Layout - -make clean -\end_layout - -\begin_layout Plain Layout - -make -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Flex Command -status open - -\begin_layout Plain Layout -configure -\end_layout - -\end_inset - - is supposed to detect your CPU but I have limited machines on which to - test this feature. - Please add your machine to the list in -\begin_inset Flex File -status open - -\begin_layout Plain Layout -configure -\end_layout - -\end_inset - - if it fails, or as a last resort try, -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "language=bash" -inline false -status open - -\begin_layout Plain Layout - -./configure generic -\end_layout - -\end_inset - - + \end_layout \begin_layout Standard @@ -17869,7 +18191,7 @@ status open \end_inset -Then rebuild with +Then rebuild with debugging enabled, \begin_inset listings lstparams "language=bash" inline false @@ -17877,17 +18199,17 @@ status open \begin_layout Plain Layout -./configure +cd builddir \end_layout \begin_layout Plain Layout -make cleanall +meson --reconfigure --buildtype=debug \end_layout \begin_layout Plain Layout -make +ninja \end_layout \end_inset @@ -18147,17 +18469,22 @@ status open \begin_layout Plain Layout -./configure debug +cd builddir \end_layout \begin_layout Plain Layout -make clean +meson --reconfigure --buildtype=debug \end_layout \begin_layout Plain Layout -make +ninja +\end_layout + +\begin_layout Plain Layout + +cd .. \end_layout \end_inset @@ -18282,17 +18609,22 @@ status open \begin_layout Plain Layout -./configure debug +cd builddir \end_layout \begin_layout Plain Layout -make clean +meson --reconfigure --buildtype=debug \end_layout \begin_layout Plain Layout -make +ninja +\end_layout + +\begin_layout Plain Layout + +cd .. \end_layout \end_inset diff --git a/meson.build b/meson.build index e7506fdcf77826e203371359886d7ade72bbb42b..b1f20029e548586b7a2d1bef43223c7491dc5ba6 100644 --- a/meson.build +++ b/meson.build @@ -10,12 +10,12 @@ ############################################################ # TODO: # -# automate symlink of libbinary_c.so -# -# 'accurate', 'generic', 'gprof'/'gcov' builds -# test non-debug version (meson builds generic by default) +# automate symlink of libbinary_c.so? +# 'gprof'/'gcov' builds # profile-guided optimization # build with various old compilers +# build data_objects in builddir, not in source tree +# (perhaps? we really want these to be persistent...) # ############################################################ # @@ -84,20 +84,48 @@ cflags = ['-fPIC','-DALIGNSIZE=16'] if have_gnu99 cflags += [ '-std=gnu99' ] endif -if have_avx +if have_avx and get_option('generic') == false cflags += [ '-mavx' ] endif ############################################################ # optional C flags -optional_flags = ['-march=native', + +optional_flags = [ ] + +# generic build +if get_option('generic') == true + optional_flags += [ + '-mtune=generic', + ] +else + optional_flags += [ + '-march=native', '-mtune=native', - '-ffast-math', + ] +endif + +# accurate mathematical options +if get_option('accurate') == true + optional_flags += [ + '-frounding-math', + '-fno-stack-protector', + '-ffloat-store', + '-fno-fast-math' + ] +else + optional_flags += [ + '-ffast-math', + '-fno-associative-math', + ] +endif + +optional_flags += [ '-fno-finite-math-only', '-fsignaling-nans', '-fomit-frame-pointer', '-fvisibility=hidden', - '-fno-associative-math'] + ] ############################################################ # debug C flags @@ -201,11 +229,12 @@ if libgsl_dep.found() incdirs += run_command('sh','-c','gsl-config --prefix').stdout().strip()+'/include' endif + ############################# -# optional libraries # -# libbacktrace, libbfd etc. # +# required libraries # +# libgsl etc. # # -foreach libname : ['gsl','bfd','backtrace','bsd','iberty','memoize','rinterpolate'] +foreach libname : ['gsl'] _dep = compiler.find_library(libname,required:false) if _dep.found() cflags += '-D__HAVE_LIB' + libname.to_upper() +'__' @@ -213,6 +242,19 @@ foreach libname : ['gsl','bfd','backtrace','bsd','iberty','memoize','rinterpolat endif endforeach +############################# +# optional libraries # +# libbacktrace, libbfd etc. # +# +if get_option('generic') == false + foreach libname : ['bfd','backtrace','bsd','iberty','memoize','rinterpolate'] + _dep = compiler.find_library(libname,required:false) + if _dep.found() + cflags += '-D__HAVE_LIB' + libname.to_upper() +'__' + libs += '-l' + libname + endif + endforeach +endif ########### # drand48 # # @@ -285,13 +327,18 @@ incdirs += [my_incdirs] ############################################################ # data objects # -data_objects = run_command('meson/data_object_list.sh').stdout().strip().split(' ') +# list and build them +data_objects = run_command('meson/data_object_list_and_build.sh').stdout().strip().split(' ') + +if get_option('clean_data_objects') == true + run_command('meson/clean_data_objects.sh') +endif ############################################################ # source files # -c_sourcefiles = run_command('meson/c_sourcefiles.sh',).stdout().strip().split('\n') -h_sourcefiles = run_command('meson/h_sourcefiles.sh',).stdout().strip().split('\n') +c_sourcefiles = run_command('meson/c_sourcefiles.sh').stdout().strip().split('\n') +h_sourcefiles = run_command('meson/h_sourcefiles.sh').stdout().strip().split('\n') ############################################################ @@ -341,6 +388,9 @@ cflags += warn_flags ############################################################ # make precompiled headers (PCH) # + +if get_option('usepch') == true + if compiler.get_id() == 'clang' _pch = binary_c_src + '/binary_c.h.pch' # old binary_c _pch = 'binary_c.h.pch' @@ -376,6 +426,11 @@ precompiled_headers = custom_target( depend_files : [h_sourcefiles], ) +else + precompiled_headers = [] +endif + + ############################################################ # @@ -395,10 +450,10 @@ libbinary_c_symlink = custom_target( # run: ninja libbinary_c.so # binary_c_shared_library = shared_library( - 'binary_c', + get_option('libname'), build_by_default : false, install: true, - sources : [c_sourcefiles, h_sourcefiles, precompiled_headers], + sources : [c_sourcefiles, h_sourcefiles, precompiled_headers ], include_directories: include_directories(incdirs), dependencies : [ libgsl_dep ], c_args : [ cflags, quoted_cflags_list, '-fvisibility=hidden' ], @@ -416,10 +471,17 @@ binary_c_shared_library = shared_library( binary_c_executable = executable( 'binary_c', install: true, - sources : [c_sourcefiles, h_sourcefiles, precompiled_headers], + sources : [ + c_sourcefiles, + h_sourcefiles, + precompiled_headers + ], include_directories: include_directories(incdirs), dependencies : [ libgsl_dep ], - c_args : [ cflags, quoted_cflags_list ], + c_args : [ + cflags, + quoted_cflags_list + ], link_args : libs, objects : data_objects, ) @@ -428,7 +490,7 @@ binary_c_executable = executable( ############################################################ # # symlink executable to binary_c directory -# run : ninja binary_c_symlnik +# run : ninja binary_c_symlink # binary_c_symlink = custom_target('symlink_binary_c', build_by_default: true, diff --git a/meson/clean_data_objects.sh b/meson/clean_data_objects.sh new file mode 100755 index 0000000000000000000000000000000000000000..47f37c5e955c65123a6bd634a3eceeb3bf5d8a20 --- /dev/null +++ b/meson/clean_data_objects.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# clean data objects for a complete rebuild + +FILES=`./meson/data_object_list.sh` +rm $FILES diff --git a/meson/data_object_list.sh b/meson/data_object_list.sh index 24fd33777a67222f067535c2896b37b543cc979f..275a69d72e4fc0c287f7d1e6435752ba489f34e3 100755 --- a/meson/data_object_list.sh +++ b/meson/data_object_list.sh @@ -1,5 +1,9 @@ #!/bin/bash # wrapper for data_object_list.sh + +# list them cd src env INCDIRS="-I. -I/usr/include -I/home/izzard/include -I/usr/include/libiberty " ../data_object_list.sh | sed -e s/^/src\\// | sed s/\ /\ src\\//g + + diff --git a/meson/data_object_list_and_build.sh b/meson/data_object_list_and_build.sh new file mode 100755 index 0000000000000000000000000000000000000000..2b2dc86f18514e50f479599bdc9aa1d9664fcd28 --- /dev/null +++ b/meson/data_object_list_and_build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# wrapper for data_object_list.sh + +############################################################ +# build them if they don't exist +#>&2 echo "Building data objects" +/usr/bin/env perl ./meson/make_dataobjects.pl >/dev/null + +############################################################ +# list them +cd src +env INCDIRS="-I. -I/usr/include -I/home/izzard/include -I/usr/include/libiberty " ../data_object_list.sh | sed -e s/^/src\\// | sed s/\ /\ src\\//g + + diff --git a/meson/make_dataobjects.pl b/meson/make_dataobjects.pl new file mode 100755 index 0000000000000000000000000000000000000000..d819271fe75a53f344316b0bab390b9840141b21 --- /dev/null +++ b/meson/make_dataobjects.pl @@ -0,0 +1,61 @@ +#!/usr/bin/env perl +use strict; + +############################################################ +# +# Short perl script for Meson build: this checks subdirs and +# builds data objects that haven't been built +# +# If environment variable REBUILD_BINARY_C_DATA_OBJECTS +# is 1, rebuild them even if they already exist. +# +############################################################ + +my $vb=0; +my $cc=$ENV{CC}//'cc'; +my $objdump = `objdump -f /bin/ls 2>\&1`; +my $binary_arch = ($objdump=~/architecture\:\s+([^,]+)/)[0]; +my $output_target = ($objdump=~/file format (\S+)/)[0]; +my $objcopy_opts = "-I binary -B $binary_arch -O $output_target"; +make_dataobjects(); +exit 0; + +sub make_dataobjects +{ + # each src/* directory can contain a script + # called make_data_objects.sh + # + # If found, run the script to generate the + # appropriate data objects. This means you + # don't have to put data into .h files anymore, + # it can be stored in ascii files which are converted + # with these scripts. + # + # Note that these script can also use sed/grep/tr etc. + # to convert .h files into ascii which is then + # converted into a data object. This is done for legacy code. + # + my @dataobjects; + print "making dataobjects\n"if($vb); + opendir(my $src,'./src') or die ("opendir() on ./src failed : $!\n"); + while(my $d = readdir($src)) + { + next if ($d eq '.' || $d eq '..'); + my $f = "./src/$d/make_data_objects.sh"; + if(defined $d && -d './src/'.$d && -f -e -s $f) + { + my $cmd = "cd src/$d; CC=$cc OBJCOPY_OPTS=\"$objcopy_opts\" ./make_data_objects.sh"; + print "Running $f ... "; + my @objects = split(/\n/,`$cmd`); + print "done\n"; + map + { + s/^/$d\//; + }@objects; + push(@dataobjects,@objects); + } + } + closedir $src; + chomp @dataobjects; + print "Linking in the following data objects : @dataobjects\n"; +} diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000000000000000000000000000000000..85a580e59dc4a8c401cfda8792d3d2719698691b --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,8 @@ + +# Meson options for binary_c + +option('accurate', type : 'boolean', value: false) +option('generic', type : 'boolean', value: false) +option('libname', type : 'string', value: 'binary_c') +option('usepch', type : 'boolean', value: true) +option('clean_data_objects', type : 'boolean', value : false) diff --git a/src/binary_c_code_options.h b/src/binary_c_code_options.h index d2137d222bc7fc6231c95771c3f109cf51bfc1b6..a050b1394a6984c3baa38fa55b15560c141ef349 100644 --- a/src/binary_c_code_options.h +++ b/src/binary_c_code_options.h @@ -605,12 +605,6 @@ void Print_trace(void); */ #define USE_NATIVE_ISNAN -/* - * Perhaps unroll loops? - * Tests show this *may* speed up execution but isn't supported anymore - */ -//#define UNROLL_NUCSYN_LOOPS - /* * Use tick timer */ diff --git a/src/binary_c_debug.h b/src/binary_c_debug.h index b145358c2f3429f739d02f831a86718d7f9cc006..2139922716f9ee9bc31f10740e36aa36ab2d637f 100644 --- a/src/binary_c_debug.h +++ b/src/binary_c_debug.h @@ -36,7 +36,7 @@ * * See below for further options. */ -#define DEBUG 0 +#define DEBUG 1 /* * To remove debugging possibility from the code, globally, hence diff --git a/src/binary_c_structures.h b/src/binary_c_structures.h index 5a4552cf5b3060ddc95431393d1a2e196bf84f04..98dbe620122a1f7f725c19c9d1efb38225c3bfaf 100644 --- a/src/binary_c_structures.h +++ b/src/binary_c_structures.h @@ -2008,6 +2008,7 @@ struct stardata_t { unsigned int n_stardata_stack; Boolean cpu_is_warm; Boolean evolving; + }; #define __HAVE_STARDATA_T diff --git a/src/binary_c_version.h b/src/binary_c_version.h index c6a1c24969790966eef4046d29a977b80aab1183..f6a41650eca9f969ebbe2c6e0689d691b69020f7 100644 --- a/src/binary_c_version.h +++ b/src/binary_c_version.h @@ -30,7 +30,7 @@ * * Patch is zero for a major release. */ -#define BINARY_C_VERSION "2.1.3" +#define BINARY_C_VERSION "2.1.4" /* and a CEMP run version */ #define CEMP_VERSION "prelim10-O1-noCNEMPs" diff --git a/src/maths/nancheck.c b/src/maths/nancheck.c index aecdbf8579bece647007f136ca7746b2c2397b9c..1b9c85a3af6e6beca0e9e5aa1e44745ff0306d0b 100644 --- a/src/maths/nancheck.c +++ b/src/maths/nancheck.c @@ -44,13 +44,6 @@ void _nancheck(struct stardata_t * RESTRICT const stardata, /* check pointer is not null */ if(unlikely(x==NULL)) return ; - /* the LOOP ITSELF is the often slowest part of the check! */ -#ifdef UNROLL_NUCSYN_LOOPS -#define LOOP7 -#else -#define LOOP4 -#endif - unsigned int i = s; while(i) { diff --git a/src/nucsyn/nucsyn_burning_cycles.c b/src/nucsyn/nucsyn_burning_cycles.c index 1e5bbaad4f48b3861b1521d0a9ce62d0021f760a..0715cf4975c98e200d3d23946b8cc650daa997c6 100644 --- a/src/nucsyn/nucsyn_burning_cycles.c +++ b/src/nucsyn/nucsyn_burning_cycles.c @@ -38,7 +38,7 @@ void nucsyn_burning_cycles(Abundance * RESTRICT const N, Reaction_network i; for(i=0;i<5;i++) { - Dprint("dtguess[%d]=%g\n",i,dtguess[i]); + Dprint("dtguess[%u]=%g\n",i,dtguess[i]); } } #endif diff --git a/src/nucsyn/nucsyn_check_abundance_array.c b/src/nucsyn/nucsyn_check_abundance_array.c index 9eacdb0b79799a0b33265490edfd598d941c8c60..6211a5fcc8f78155cece3acbb95fcb9458d461eb 100644 --- a/src/nucsyn/nucsyn_check_abundance_array.c +++ b/src/nucsyn/nucsyn_check_abundance_array.c @@ -1,17 +1,13 @@ #include "../binary_c.h" #ifdef NUCSYN -#ifdef UNROLL_NUCSYN_LOOPS -#include "../nucsyn/nucsyn_unrolled_functions.h" -#endif -#ifndef UNROLL_NUCSYN_LOOPS + static void nucsyn_check_abundance_array_oops(struct stardata_t * RESTRICT const stardata, const Abundance * const RESTRICT X, const Isotope i, const char *const s) ; -#endif//UNROLL_NUCSYN_LOOPS void nucsyn_check_abundance_array(struct stardata_t * RESTRICT const stardata, const Abundance * RESTRICT const X, @@ -36,9 +32,6 @@ void nucsyn_check_abundance_array(struct stardata_t * RESTRICT const stardata, // check for nans, <0 -#ifdef UNROLL_NUCSYN_LOOPS - NUCSYN_UNROLLED_LESS_THAN_ZERO_OR_NANCHECK; -#else Isotope i; Isotope_loop(i) { @@ -51,10 +44,8 @@ void nucsyn_check_abundance_array(struct stardata_t * RESTRICT const stardata, nucsyn_check_abundance_array_oops(stardata,X,i,s); } } -#endif } -#ifndef UNROLL_NUCSYN_LOOPS static void nucsyn_check_abundance_array_oops(struct stardata_t * RESTRICT const stardata, const Abundance * RESTRICT const X, const Isotope i, @@ -64,5 +55,5 @@ static void nucsyn_check_abundance_array_oops(struct stardata_t * RESTRICT const "X[%u] = %g : error : %s\nX : H1=%g He4=%g C12=%g N14=%g O16=%g Fe56=%g\n", i,X[i],s,X[XH1],X[XHe4],X[XC12],X[XN14],X[XO16],X[XFe56]); } -#endif // UNROLL_NUCSYN_LOOPS + #endif diff --git a/src/nucsyn/nucsyn_effective_molecular_weight.c b/src/nucsyn/nucsyn_effective_molecular_weight.c index 3055e7f8c3085d2ffd94b89ce869c2dd36200470..4549d0b098c5c8a7fabad6e3084e6923c5a45760 100644 --- a/src/nucsyn/nucsyn_effective_molecular_weight.c +++ b/src/nucsyn/nucsyn_effective_molecular_weight.c @@ -3,9 +3,6 @@ #include "../binary_c_stellar_types.h" -#ifdef UNROLL_NUCSYN_LOOPS -#include "../nucsyn/nucsyn_unrolled_functions.h" -#endif double Pure_function nucsyn_effective_molecular_weight(const Abundance * const RESTRICT X, const Stellar_type stellar_type, @@ -53,18 +50,12 @@ double Pure_function nucsyn_effective_molecular_weight(const Abundance * const R else { /* non-degenerate star */ - -#ifdef UNROLL_NUCSYN_LOOPS - mu = NUCSYN_UNROLLED_MOLECULAR_WEIGHT; -#else mu=0.0; Isotope i; Isotope_loop(i) { mu += X[i] ? (X[i] * molweights[i]) : 0.0; } -#endif //UNROLL_NUCSYN_LOOPS - mu = 1.0 / (AMU_GRAMS * mu); } diff --git a/src/nucsyn/nucsyn_molecular_weight.c b/src/nucsyn/nucsyn_molecular_weight.c index cb7c57ace0acee6d247ca50e4d1ff9fad0111bbf..a27a721762d89de21633c092d406d79d36a81364 100644 --- a/src/nucsyn/nucsyn_molecular_weight.c +++ b/src/nucsyn/nucsyn_molecular_weight.c @@ -3,9 +3,6 @@ #include "../binary_c_stellar_types.h" -#ifdef UNROLL_NUCSYN_LOOPS -#include "../nucsyn/nucsyn_unrolled_functions.h" -#endif double Pure_function nucsyn_molecular_weight(const Abundance * RESTRICT X, const struct stardata_t * RESTRICT const stardata, diff --git a/src/nucsyn/nucsyn_sn_chieffi_limongi_2004.c b/src/nucsyn/nucsyn_sn_chieffi_limongi_2004.c index 4effc30b0651ba8145dbc04f55f0ef02e2156dc6..4a5881f5501f3632e80fac569a1f768b04a4023b 100644 --- a/src/nucsyn/nucsyn_sn_chieffi_limongi_2004.c +++ b/src/nucsyn/nucsyn_sn_chieffi_limongi_2004.c @@ -217,7 +217,7 @@ void nucsyn_sn_chieffi_limongi_2004(struct stardata_t * const stardata, Ordered_isotope_loop(i) { sum+=X[i]; - Dprint("Isotope %d = %g (sum=%g)\n",i,X[i],sum); + Dprint("Isotope %u = %g (sum=%g)\n",i,X[i],sum); } #endif diff --git a/src/nucsyn/nucsyn_totalX.c b/src/nucsyn/nucsyn_totalX.c index 85a48122f0d0756a336b33ca6c9325f48f72d3e4..9393aa5b13c94cd73fd1f7d95b5bbd93af893603 100644 --- a/src/nucsyn/nucsyn_totalX.c +++ b/src/nucsyn/nucsyn_totalX.c @@ -3,10 +3,6 @@ #ifdef NUCSYN -#ifdef UNROLL_NUCSYN_LOOPS -#include "../nucsyn/nucsyn_unrolled_functions.h" -#endif - double Pure_function Nonnull_some_arguments(1,2) nucsyn_totalX(struct stardata_t * const stardata, const Abundance * const RESTRICT X, @@ -17,11 +13,7 @@ double Pure_function Nonnull_some_arguments(1,2) nucsyn_totalX(struct stardata_t Isotope i; if(Xmax==ISOTOPE_ARRAY_SIZE && Xmin==0) { -#ifdef UNROLL_NUCSYN_LOOPS - Xsum = NUCSYN_UNROLLED_TOTALX; -#else Xsum = XXsum(stardata,X); -#endif } else { @@ -38,9 +30,6 @@ double Pure_function Nonnull_some_arguments(1,2) XXsum(const struct stardata_t * const Abundance * RESTRICT const X) { -#ifdef UNROLL_NUCSYN_LOOPS - return (NUCSYN_UNROLLED_TOTALX); -#else Abundance Xsum = 0.0; Isotope i; Isotope_loop(i) @@ -49,9 +38,6 @@ double Pure_function Nonnull_some_arguments(1,2) XXsum(const struct stardata_t * Xsum += X[i]; } return Xsum; - -#endif //UNROLL_NUCSYN_LOOPS - } #endif// NUCSYN diff --git a/src/setup/version.c b/src/setup/version.c index 6e4cc91b5156414137d9063d08efa2fe4ebc636b..6d2195f0371a8c155b8b9e8fa76625498fcdaa91 100644 --- a/src/setup/version.c +++ b/src/setup/version.c @@ -876,8 +876,7 @@ void version(struct stardata_t * RESTRICT const stardata) Macrotest(BATCHMODE); Macrotest(NANCHECKS); Macrotest(USE_NATIVE_ISNAN); - Macrotest(UNROLL_NUCSYN_LOOPS); - + Show_int_macro(EVOLUTION_ALGORITHM_BINARY_C); Show_int_macro(EVOLUTION_ALGORITHM_BSE);