diff --git a/doc/binary_c-installation.lyx b/doc/binary_c-installation.lyx deleted file mode 100644 index b4259364795d8d45a549bba1b306305e6195dabf..0000000000000000000000000000000000000000 --- a/doc/binary_c-installation.lyx +++ /dev/null @@ -1,3431 +0,0 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 -\begin_document -\begin_header -\save_transient_properties true -\origin unavailable -\textclass article -\begin_preamble - - \usepackage[usenames,dvipsnames]{xcolor} -\usepackage{eurosym} -%\usepackage{eulervm} -\usepackage{enumitem} -\usepackage{latexsym} -\usepackage{multicol} -\usepackage{setspace} -%\usepackage{lmodern} -\date{} -\usepackage{tikz} -\usetikzlibrary{calc,shadings} -\usepackage[scaled=0.85]{beramono} - -%\usepackage[usenames, dvipsnames]{color} -\definecolor{Sectioncolour2}{RGB}{210,180,180} -\definecolor{Sectioncolour1}{RGB}{179,100,100} -\definecolor{Sectioncolour}{RGB}{159,29,35} - -% background - -%\usepackage{gradientframe} - -%\usepackage[pages=all,color=Sectioncolour,angle=90,hshift=-5cm,scale=1.5,contents={Nucleosynthesis in AGB Stars}]{background} - -%\usepackage{framed} -%\colorlet{shadecolor}{gray!25} % you may try 'blue' here -%\renewenvironment{leftbar}{% - % \def\FrameCommand{% -%{% -%\textcolor{Sectioncolour2}{\vrule width 2pt}% -%\textcolor{Sectioncolour1}{\vrule width 2pt}% -%\textcolor{Sectioncolour}{\vrule width 2pt}% -%\textcolor{Sectioncolour1}{\vrule width 2pt}% -%\textcolor{Sectioncolour2}{\vrule width 2pt}% -%}\hspace{10pt}}% -% \MakeFramed {\advance\hsize-\width \FrameRestore}}% -%{\endMakeFramed} - - -%\rule{0.4pt}{\textheight} - -% try this -%http://www.ctan.org/tex-archive/macros/latex/contrib/eso-pic/ -%http://stackoverflow.com/questions/2986240/latex-how-to-make-a-fullpage-vertical-rule-on-every-page - -\usepackage{eso-pic} -\usepackage{graphicx} -%\newcommand\BackgroundPic{} - -\newcommand\BackgroundPic{% -\put(0,0){% -\parbox[b][\paperheight]{\paperwidth}{% -\vfill -\centering -\includegraphics[width=\paperwidth,height=\paperheight,% -keepaspectratio]{images/falk2-low-lolores.eps}% -\vfill -}}} - -% remove background image (for speed) -%\renewcommand\BackgroundPic{} - -% redefine sections to use red colour -\usepackage{titlesec} -\titleformat{name=\section}% command to alter -{\color{Sectioncolour}\normalfont\itshape\bfseries\large\setstretch{0.5}}%format -{\thesection}%label -{1em}%sep -{}%before code -{}%after code - -% redefine subsections to use red colour -\titleformat{name=\subsection}% command to alter -{\color{Sectioncolour}\normalfont\itshape\bfseries\large\setstretch{0.5}}%format -{\thesubsection}%label -{1em}%sep -{}%before code -{}%after code - - -\def\aj{AJ} % Astronomical Journal -\def\araa{ARA\&A} % Annual Review of Astron and Astrophys -\def\apj{ApJ} % Astrophysical Journal -\def\apjl{ApJ} % Astrophysical Journal, Letters -\def\apjs{ApJS} % Astrophysical Journal, Supplement -\def\apss{Ap\&SS} % Astrophysics and Space Science -\def\aap{A\&A} % Astronomy and Astrophysics -\def\aapr{A\&A~Rev.} % Astronomy and Astrophysics Reviews -\def\aaps{A\&AS} % Astronomy and Astrophysics, Supplement -\def\mnras{MNRAS} % Monthly Notices of the RAS -\def\pra{Phys.~Rev.~A} % Physical Review A: General Physics -\def\prl{Phys.~Rev.~Lett.} % Physical Review Letters -\def\pasa{PASA} % Publications of the ASP -\def\pasp{PASP} % Publications of the ASP -\def\pasj{PASJ} % Publications of the ASJ -\def\nat{Nature} % Nature -\def\aplett{Astrophys.~Lett.} % Astrophysics Letters -\def\physrep{Phys.~Rep.} % Physics Reports% -\def\na{NewA} % new astronomy% - -\usepackage{natbibspacing} -\setlength{\bibspacing}{0mm} - -% header -\usepackage{fancyhdr} -\pagestyle{fancy} -\renewcommand{\headrulewidth}{0pt} -\fancyhead[LE,RO]{\color{Sectioncolour}\normalfont\itshape\bfseries{}} % page number in "outer" position of footer line -\fancyhead[RE,LO]{\color{Sectioncolour}\rightmark} % other info in "inner" position of footer line - -\raggedbottom -\end_preamble -\use_default_options true -\maintain_unincluded_children false -\language british -\language_package default -\inputencoding auto -\fontencoding global -\font_roman "utopia" "default" -\font_sans "default" "default" -\font_typewriter "default" "default" -\font_math "auto" "auto" -\font_default_family rmdefault -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 100 -\font_tt_scale 100 100 -\use_microtype false -\use_dash_ligatures false -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\paperfontsize 12 -\spacing single -\use_hyperref false -\papersize a4paper -\use_geometry true -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine natbib -\cite_engine_type authoryear -\biblio_style plainnat -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 1 -\use_minted 0 -\index Index -\shortcut idx -\color #008000 -\end_index -\leftmargin 2cm -\topmargin 3cm -\rightmargin 2cm -\bottommargin 3cm -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\is_math_indent 0 -\math_numbering_side default -\quotes_style english -\dynamic_quotes 0 -\papercolumns 1 -\papersides 2 -\paperpagestyle fancy -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\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 -Installation guide for -\family typewriter -binary_c -\family default - and -\family typewriter -binary_grid2 -\end_layout - -\begin_layout Standard -\align center - -\series bold -A guide to the installation of -\emph on -binary_c -\emph default - and -\emph on -binary_grid2 -\end_layout - -\begin_layout Standard -\align center - -\series bold -Version 2.1.4+ -\begin_inset Newline newline -\end_inset - - -\end_layout - -\begin_layout Standard -\align center - -\series bold -Warning: Version 2 of the combined -\emph on -binary_c -\emph default - and -\emph on -binary_grid2 -\emph default - is currently under development. - Details are likely to change. - -\end_layout - -\begin_layout Standard -\align center -Please see also other documentation, e.g. - -\end_layout - -\begin_layout Description -binary_cV2 for information about changes in -\emph on -binary_c -\emph default - V2.0+. -\end_layout - -\begin_layout Description -binary_grid2 for population grid instructions. -\end_layout - -\begin_layout Description -getting_binary_c for instructions about how to obtain -\emph on -binary_c -\emph default -. -\end_layout - -\begin_layout Standard -\begin_inset Newpage pagebreak -\end_inset - - -\end_layout - -\begin_layout Subsection -System Requirements -\end_layout - -\begin_layout Standard -\begin_inset CommandInset label -LatexCommand label -name "subsec:Requirements" - -\end_inset - -The following software is required on your system: -\end_layout - -\begin_layout Itemize -A -\emph on -C -\emph default - 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 - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -gcc -\emph default - (GNU compiler -\begin_inset Flex URL -status collapsed - -\begin_layout Plain Layout - -http://gcc.gnu.org/ -\end_layout - -\end_inset - -) this comes as standard on most Linux systems and is easily installed on - others. - -\emph on -gcc -\emph default -is free. -\end_layout - -\begin_layout Itemize - -\emph on -clang -\emph default - ( -\emph on -C -\emph default - compiler for LLVM -\begin_inset CommandInset href -LatexCommand href -target "http://clang.llvm.org/" -literal "false" - -\end_inset - -) 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 -Your system should include such a compiler unless you're using Windows. - -\emph on -Binary_c -\emph default - has been tested on Linux and various Solaris machines. - Note that (for an unknown reason!) it does not run (but does compile) on - old versions of MacOS X. - If you can fix this problem please let me know! Also, there has been trouble - with -\emph on -gcc -\emph default -on Xeon machines. - This is not my fault, please use -\emph on -icc -\emph default -. -\begin_inset Foot -status collapsed - -\begin_layout Plain Layout -This information may be out of date! Please test the build and let me know. -\end_layout - -\end_inset - - -\end_layout - -\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 -\emph on -binary_grid2 -\emph default -. - Perl is usually installed on your system, and for configuration of -\emph on -binary_c -\emph default - this should be sufficient. - You can download Perl at -\begin_inset Flex URL -status collapsed - -\begin_layout Plain Layout - -www.perl.com -\end_layout - -\end_inset - -, or use your system Perl, but I recommend -\emph on -Perlbrew -\emph default - instead. - Please try to use a version of Perl that is 5.16 or later: 5.25 is currently - the standard. -\end_layout - -\begin_layout Itemize - -\emph on -Perlbrew -\emph default - and -\emph on -cpanm -\emph default - are -\emph on -essential -\emph default -if you want to use -\series bold -\emph on -binary_grid2 -\series default -\emph default -. - These are standard tools. - I recommend downloading them on a per-user basis, but they could also be - installed as part of your system. -\end_layout - -\begin_layout Itemize -You will want to use -\emph on -git -\emph default - to get -\emph on -binary_c -\emph default -, see the document -\series bold -\emph on -getting_binary_c.pdf -\end_layout - -\begin_layout Itemize -Probably you want a debugger, e.g. - -\emph on -gdb -\emph default -, to be installed, if you plan to modify (and hence break) -\emph on -binary_c -\emph default -. - You may also want -\emph on -valgrind -\emph default - which is superior in many ways to -\emph on -gdb -\emph default -. -\end_layout - -\begin_layout Itemize -The -\emph on -GNU Scientific Library -\emph default - version 2.4 is required. - You may be able to install this as a system package, or you can get it - from -\begin_inset Flex URL -status collapsed - -\begin_layout Plain Layout - -https://www.gnu.org/software/gsl/ -\end_layout - -\end_inset - -. - I have a modified version at -\begin_inset Flex URL -status collapsed - -\begin_layout Plain Layout - -https://gitlab.eps.surrey.ac.uk/ri0005/GSL-2.4-RGI -\end_layout - -\end_inset - - which has minor fixes: please use this if you can. -\end_layout - -\begin_layout Itemize - -\emph on -libbsd -\emph default - is recommended. - Please install the libbsd-devel package also. - You can also install from the source available at -\begin_inset Flex URL -status collapsed - -\begin_layout Plain Layout - -https://libbsd.freedesktop.org/wiki/ -\end_layout - -\end_inset - -. -\end_layout - -\begin_layout Itemize - -\emph on -libbacktrace -\emph default - is recommended. - See -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -https://github.com/ianlancetaylor/libbacktrace -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize - -\emph on -libbfd -\emph default - is recommended. - This is part of the Linux -\emph on -binutils -\emph default - 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 -binary_c -\emph default - and -\emph on -binary_grid2 -\emph default - you are part of a community. - You are therefore jointly responsible for helping with the never-ending - process of improvement and bug fixing. - -\emph on - Binary_c -\emph default - (and its -\emph on -Perl -\emph default -modules, such as -\emph on -binary_grid -\emph default -2) is stored on an -\emph on -git -\emph default - server. - Please read the -\series bold -\emph on -LICENCE -\series default -\emph default - file before use. -\end_layout - -\begin_layout Standard -\begin_inset Newpage pagebreak -\end_inset - - -\end_layout - -\begin_layout Subsection -binary_c -\end_layout - -\begin_layout Standard -\begin_inset CommandInset label -LatexCommand label -name "sec:binary-c" - -\end_inset - - -\end_layout - -\begin_layout Subsubsection -Getting binary_c -\end_layout - -\begin_layout Itemize -You should obtain -\emph on -binary_c -\emph default - from the -\emph on -git -\emph default - server, currently at -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -https://gitlab.eps.surrey.ac.uk/ri0005/binary_c -\end_layout - -\end_inset - -. - Please see the document -\emph on -getting_binary_c -\emph default - (available in -\emph on -pdf -\emph default - and -\emph on -lyx -\emph default - formats). - -\end_layout - -\begin_layout Itemize -You should consider joining the mailing lists. -\end_layout - -\begin_layout Subsubsection -Building -\end_layout - -\begin_layout Standard -\begin_inset CommandInset label -LatexCommand label -name "subsec:Building" - -\end_inset - - -\end_layout - -\begin_layout Subsubsection -From git -\end_layout - -\begin_layout Standard -Assuming you have checked out your branch, or the trunk, from the -\emph on -git -\emph default - repository (see section -\begin_inset space ~ -\end_inset - - -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:SVN-access" - -\end_inset - -), go to that directory (which will be called the -\family typewriter -binary_c -\family default - directory below). -\end_layout - -\begin_layout Subsubsection -From a zip file or tarball -\end_layout - -\begin_layout Standard -If have been given a file zip file -\family typewriter -binary_c.zip, -\family default - or a tarball e.g. - -\family typewriter - binary_c.tar.gz -\family default - or -\family typewriter -binary_c.tar.bz2, -\family default - you should copy it to a directory (hereafter -\family typewriter -binary_c -\family default -, usually I put everything in -\family typewriter - -\begin_inset Formula $\sim$ -\end_inset - -/progs/stars/binary_c -\family default - where -\begin_inset Formula $\sim$ -\end_inset - - is your home directory – if you put it there then all the scripts will - work) and -\emph on -unzip -\emph default - it with one of the following commands (depending on the file you were given): -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -unzip binary_c.zip -\family default - -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -tar -xvzf binary_c.tar.gz -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -tar -xvjf binary_c.tar.bz2 -\end_layout - -\begin_layout Standard -which will unzip the files in the appropriate places. -\end_layout - -\begin_layout Subsubsection -Build with meson -\end_layout - -\begin_layout Standard -From inside -\end_layout - -\begin_layout Standard -Now, from the -\family typewriter -binary_c -\family default - directory, you need to run the configuration script with -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./configure -\end_layout - -\begin_layout Standard -which creates the -\family typewriter -Makefile -\family default -. - Now type -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./make -\end_layout - -\begin_layout Standard -to build the code. - The make script is a wrapper around GNU make that executes the build on - as many CPUs as you have, and pretties up the output so that it is more - readable.. -\begin_inset Newline newline -\end_inset - -Note that you may need to use -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -gmake -\end_layout - -\begin_layout Standard -from the -\family typewriter -src -\family default - directory if -\emph on -GNU -\emph default - make is not your default (e.g. - you are on something like Solaris). - -\begin_inset Newline newline -\end_inset - -The code will now build, assuming -\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 on Linux and will revert to -\family typewriter -gcc -\family default - as the default compiler if something goes wrong - it -\emph on -might -\emph default - detect -\family typewriter -icc -\family default - if it's on your system. - It is up to you to make your compiler work properly! -\end_layout - -\begin_layout Standard -The executable is called -\family typewriter -binary_c. -\end_layout - -\begin_layout Standard -Note: -\family typewriter -binary_c -\family default - is built as a single, possibly -\emph on -large -\emph default - (many MB) executable. - The reason for this is purely ease of use when transferring the executable - from one machine to another. - It is possible to build a shared library instead. -\end_layout - -\begin_layout Subsubsection -Building the shared library -\end_layout - -\begin_layout Standard -To build the shared library, run -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./configure -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -make libbinary_c.so -\end_layout - -\begin_layout Standard -This makes the -\family typewriter -libbinary_c.so -\family default - shared library which can be used, for example, by the -\emph on -C -\emph default - backend to -\emph on -binary_grid -\emph default -2, or to access -\emph on -binary_c -\emph default - through its -\emph on -API -\emph default -. -\end_layout - -\begin_layout Subsubsection -Alternative compiler -\end_layout - -\begin_layout Standard -You can build with another compiler, e.g. - -\emph on -clang -\emph default -, by doing -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -export CC=clang -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./configure -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./make -\end_layout - -\begin_layout Subsubsection -Debugging build -\end_layout - -\begin_layout Standard -To enable full debugging, run -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./configure debug -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./make -\end_layout - -\begin_layout Subsubsection -Testing binary_c -\end_layout - -\begin_layout Standard -Run the -\emph on -bash -\emph default - script to -\begin_inset Quotes eld -\end_inset - -test binary star evolution -\begin_inset Quotes erd -\end_inset - - called -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -tbse -\family default -\series default - -\begin_inset Newline newline -\end_inset - -You should see output. - -\begin_inset Newline newline -\end_inset - -You may have to symbolically link src/binary_c to binary_c in the directory - to make this work, e.g. -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -cd -\emph on -<binary_c_directory> -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -ln -s src/binary_c -\end_layout - -\begin_layout Subsubsection -tbse commands -\end_layout - -\begin_layout Standard - -\emph on -tbse -\emph default -can take extra arguments, which are usually passed to -\emph on -binary_c -\emph default - directly. -\end_layout - -\begin_layout Standard -There are also many commands which can be given to -\emph on -tbse -\emph default -, e.g. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -echo This outputs (to -\emph on -stdout -\emph default -) the arguments that would have been sent to -\emph on -binary_c -\emph default -. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -args Ignores settings in the -\emph on -tbse -\emph default -file and runs only with the extra arguments given on the command line. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -debug This runs -\emph on -binary_c -\emph default -with the gdb debugger -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -valgrind This runs -\emph on -binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -memcheck -\emph default - tool to detect memory leaks. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -massif This runs -\emph on -binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -massif -\emph default - heap checker. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -callgrind This runs -\emph on -binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -callgrind -\emph default -tool. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -cachegrind This runs -\emph on -binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -cachegrind -\emph default - tool. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -ptrcheck This runs -\emph on - binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -ptrcheck -\emph default - tool. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -sgcheck This runs -\emph on - binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -sgcheck -\emph default - tool. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -drd This runs -\emph on - binary_c -\emph default - through -\emph on -Valgrind -\emph default -'s -\emph on -drd -\emph default - tool. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -gprof This runs -\emph on -binary_c -\emph default - through -\emph on -gprof -\emph default -, the -\emph on -GNU -\emph default - profiler. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -gprof_lines This runs -\emph on -binary_c -\emph default - through -\emph on -gprof -\emph default -, the -\emph on -GNU -\emph default - profiler, doing line-by-line accounting. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -gprof_with_stdout This runs -\emph on -binary_c -\emph default - through -\emph on -gprof -\emph default -, the -\emph on -GNU -\emph default - profiler, showing -\emph on -stdout -\emph default -. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -pgo Profile guided optimization. - This builds -\emph on -binary_c -\emph default - once, runs a number of systems, then rebuilds with extra optimization based - on the profile generated by the runs. - This works for -\emph on -GCC -\emph default - and probably also -\emph on -clang -\emph default -. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -bug This runs -\emph on -binary_c -\emph default - and outputs information which is suitable for reporting a bug to Rob. -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - -multicore This runs -\emph on -binary_c -\emph default - on many CPU cores at once. - Exits immediately on failure, so this is useful for testing e.g. - Monte carlo kicks. - -\end_layout - -\begin_layout Description -tbse -\begin_inset space ~ -\end_inset - - -\emph on -<filename> -\emph default - This runs the set of arguments specified in the file given by -\emph on -filename -\emph default -. -\end_layout - -\begin_layout Standard -\begin_inset Newpage pagebreak -\end_inset - - -\end_layout - -\begin_layout Subsubsection -binary_grid2 -\end_layout - -\begin_layout Standard -This section describes in some detail the installation of -\emph on -binary_grid2 -\emph default -. - Note that sometimes you will require the latest version of pieces of software, - in particular -\emph on -Perl -\emph default - which should be at least version 5.16. - I show you how to do this -\emph on -without -\emph default - requiring root permissions on your machine. - Should you require packages to be installed that require root permission, - you can always set up -\emph on -binary_c -\emph default - and -\emph on -binary_grid2 -\emph default - on a -\emph on -virtual machine -\emph default - which runs as a guest on your operating system, I do this with -\emph on -Virtualbox -\emph default - ( -\begin_inset CommandInset href -LatexCommand href -target "https://www.virtualbox.org/" -literal "false" - -\end_inset - -). - This would be my advice if you are running on a non-standard operating - system, e.g. - -\emph on -Micro$oft Windows -\emph default -. - You will have the root password for your virtual machine, so there are - never permissions problems. -\end_layout - -\begin_layout Standard -You will need some basic tools installed to make everything work: -\emph on -bash -\emph default -, -\emph on -subversion -\emph default -, -\emph on -perl -\emph default -, -\emph on -gmake -\emph default -, -\emph on -wget -\emph default -, -\emph on -gcc -\emph default -. - These are available on all good operating systems, and come by default - – or after a simple install – with most flavours of Linux/Unix and MacOSX. -\end_layout - -\begin_layout Standard -Some -\emph on -Perl -\emph default -modules also require some other system libraries and development files. - It is difficult to know exactly what these would be for every operating - system. - You may have to use a web search to find out, but that's fine because you - are smart! -\end_layout - -\begin_layout Paragraph -Latest -\emph on -Perl -\emph default -: use -\emph on -perlbrew -\end_layout - -\begin_layout Standard -I highly recommend that you install the latest version of -\emph on -Perl -\emph default -using -\series bold -\emph on -perlbrew -\series default -\emph default - and install modules using -\series bold -\emph on -cpanm -\series default -. - -\emph default - I describe how to do this below, but also please see -\begin_inset CommandInset href -LatexCommand href -target "http://perlbrew.pl/" -literal "false" - -\end_inset - - and -\begin_inset CommandInset href -LatexCommand href -target "http://perlbrew.pl/Perlbrew-and-Friends.html " -literal "false" - -\end_inset - -for further instructions and documentation. -\end_layout - -\begin_layout Paragraph -Installing -\emph on -binary_c -\end_layout - -\begin_layout Standard -Please see Sec. -\begin_inset space ~ -\end_inset - - -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:binary-c" - -\end_inset - - above for details about how to install -\emph on -binary_c -\emph default -. - -\end_layout - -\begin_layout Paragraph -Installing -\emph on -binary_grid2 -\end_layout - -\begin_layout Standard -\begin_inset CommandInset label -LatexCommand label -name "subsec:installing binary_grid" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\emph on -binary_grid2 -\emph default - is written in -\emph on -Perl -\emph default - ( -\begin_inset CommandInset href -LatexCommand href -target "http://www.perl.org/" -literal "false" - -\end_inset - -) which is available on almost every modern operating system, although to - my knowledge -\emph on -binary_grid2 -\emph default - has never been tested on anything other than -\emph on -Linux -\emph default - ( -\begin_inset CommandInset href -LatexCommand href -target "http://www.linux.org/" -literal "false" - -\end_inset - -), -\emph on -Solaris -\emph default - and -\emph on -MacOSX -\emph default - (which is [currently] really -\emph on - BSD Unix -\emph default -). -\end_layout - -\begin_layout Standard -The newest -\emph on -binary_grid2 -\emph default - uses features from the latest -\emph on -Perl -\emph default - (5.16 or above, currently testing on 5.25) so you'll need a recent -\emph on -Perl -\emph default - to be installed. - Unfortunately most versions of -\emph on -Linux -\emph default - run an older -\emph on -Perl -\emph default - without support for many of the required features. - You will also need to have the latest versions of a number of -\emph on -Perl -\emph default - modules which come from either from the online resource -\emph on -CPAN -\emph default - -\begin_inset Foot -status open - -\begin_layout Plain Layout - -\emph on -Comprehensive Perl Archive Network -\end_layout - -\end_inset - - ( -\begin_inset CommandInset href -LatexCommand href -target "http://www.cpan.org/" -literal "false" - -\end_inset - -) or as part of the -\emph on -binary_c -\emph default - package. -\end_layout - -\begin_layout Standard -My recommendation is to use -\series bold -\emph on -perlbrew -\series default - -\emph default -to make your own -\emph on -Perl -\emph default - and -\emph on -cpanminus -\emph default - (the command is -\family typewriter -cpanm -\family default -) to install the modules. - -\end_layout - -\begin_layout Standard -You can find -\emph on -perlbrew -\emph default - at -\begin_inset CommandInset href -LatexCommand href -target "http://perlbrew.pl/" -literal "false" - -\end_inset - - : please follow the instructions on that page to install the latest -\emph on -Perl -\emph default - on your system if you do not trust my instructions below. - Typically do the following, but remember you -\emph on -must -\emph default - install -\emph on -perlbrew -\emph default - with -\begin_inset Quotes eld -\end_inset - - -\family typewriter --Dusethreads -\family default - -\begin_inset Quotes erd -\end_inset - - otherwise -\emph on -Perl -\emph default - will not use threads and you will lose the multi-CPU features of -\emph on -binary_grid -\emph default -2. - Please note that I assume you are using the -\emph on -bash -\emph default - shell. -\end_layout - -\begin_layout Enumerate - -\family typewriter -\series bold -wget --no-check-certificate -O - http://install.perlbrew.pl | bash -\begin_inset Newline newline -\end_inset - - -\family default -\series default -\emph on -or -\emph default - -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -curl -kL http://install.perlbrew.pl | bash -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - - -\family default -\series default -If you have problems with -\series bold -\emph on -wget -\series default -\emph default -, try removing the -\series bold -\emph on -–no-check-certificate -\series default -\emph default -. -\end_layout - -\begin_layout Enumerate -Run -\family typewriter -perlbrew available -\family default - to find a list of available versions, you should choose the newest, e.g. - -\family typewriter -perl-5.25 -\family default -, and then run the following command to install -\emph on -Perl -\emph default -: -\begin_inset Newline newline -\end_inset - - -\family typewriter - -\begin_inset Newline newline -\end_inset - - -\begin_inset Box Frameless -position "t" -hor_pos "c" -has_inner_box 1 -inner_pos "t" -use_parbox 0 -use_makebox 0 -width "95col%" -special "none" -height "1in" -height_special "totalheight" -thickness "0.4pt" -separation "3pt" -shadowsize "4pt" -framecolor "black" -backgroundcolor "none" -status open - -\begin_layout Plain Layout - -\family typewriter -\series bold -perlbrew -v install perl-5.25 --thread --multi --64bitall --notest -Dusethreads - -Duselargefiles -Dcccdlflags=-fPIC -Dpager=/usr/bin/sensible-pager -Doptimize=" --O3 -march=native -mtune=native" -Duseshrplib -j 8 -\end_layout - -\end_inset - - -\family default - -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -You can use -\family typewriter -\series bold --march=native -mtune=native -\family default -\series default - if you are quite sure you will not use this version of -\emph on -Perl -\emph default -, or its modules, on a machine with a different architecture. - If you are building for use with an -\emph on -HTCondor -\emph default - grid, I highly recommend using the -\family typewriter -generic -\family default - option and this is now the default. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note that the final -\emph on -8 -\emph default - should be replaced by the number of CPUs you wish to use for the build - (it is an option passed to -\emph on -make -\emph default -). -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note also that -\family typewriter --Duseshrplib -\family default - may no longer be required. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -I have recently added -\family typewriter ---thread –-multi –-64bitall -\family default - so if you have trouble, please remove these and try again. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -In -\emph on -Perl -\emph default - 5.25.5 there is a (known) bug in the test routines which may (or may not) - stop your installation. - For this reason the -\family typewriter ---notest -\family default - flag if set. - Remove this if you want testing back (beware it is slow). -\series bold - -\begin_inset Newline newline -\end_inset - - -\series default - -\begin_inset Newline newline -\end_inset - -The installation process can take a long time, go and have lunch\SpecialChar ldots - then: -\end_layout - -\begin_layout Enumerate -Do what -\emph on -perlbrew -\emph default - suggests with your -\family typewriter -.bashrc -\family default - (or whatever shell initialization script you use) to fix the -\family typewriter -PERLBREW_PATH -\family default -. -\end_layout - -\begin_layout Enumerate -Restart your shell (e.g. - close your terminal and open a new one, or just run -\family typewriter -bash -\family default - again) to update your environment and -\family typewriter -$PATH -\family default -. -\end_layout - -\begin_layout Enumerate -Check you're using the correct -\emph on -Perl -\emph default - with -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -perl -v -\family default -\series default - -\begin_inset Newline newline -\end_inset - -This should say something like -\begin_inset Newline newline -\end_inset - - -\family typewriter -\size small -This is perl 5, version 25, subversion 0 (v5.25.0) built for x86_64-linux-thread-m -ulti -\size default - -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - - -\family default -Check that the -\family typewriter --thread- -\family default - is there – without threads, -\emph on -binary_grid2 -\emph default - multi-CPU options will not function. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -If you have a previous version of -\emph on -Perl -\emph default - installed by -\emph on -perlbrew -\emph default -, you will have to do something like -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -perlbrew switch perl-5.25 -\end_layout - -\begin_layout Enumerate -If the installation was successful, but you see an older -\emph on -Perl -\emph default -, check that your -\family typewriter -$PATH -\family default - variable points to the new -\emph on -Perl -\emph default -, and check that -\family typewriter -$PERLBREW_PATH -\family default - exists. -\end_layout - -\begin_layout Enumerate -Install -\emph on -cpanminus -\emph default - by running -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -perlbrew install-cpanm -\end_layout - -\begin_layout Standard -Now you have the latest -\emph on -Perl -\emph default - and -\emph on -cpanm -\emph default - installed, you can start to install the modules needed for -\emph on -binary_grid -\emph default -2. - (Un?)fortunately, there are many of them, so I have made a script to do - it for you -\end_layout - -\begin_layout Enumerate -From the -\emph on -binary_c -\emph default - directory, go to -\family typewriter -src/perl -\family default - with -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -cd src/perl -\end_layout - -\begin_layout Enumerate -Run the install script which uses -\emph on -cpanminus -\emph default - to install the modules -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -./install_modules.pl -\end_layout - -\begin_layout Enumerate -Wait. - Watch the output flow past your eyes. -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - -Note that you can -\emph on -also -\emph default - install the modules yourself from their tarballs in -\family typewriter -src/perl/modules_targz -\family default -., e.g. - -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -cd src/perl/modules_targz -\begin_inset Newline newline -\end_inset - -cpanm ./<modname>.tar.gz -\begin_inset Newline newline -\end_inset - - -\family default -\series default -but please note the -\family typewriter -\series bold -./ -\family default -\series default - in the filename is -\emph on -required -\emph default -. -\end_layout - -\begin_layout Enumerate -In case of errors, try installing the module with verbose logging switched - on -\family typewriter -\series bold - -\begin_inset Newline newline -\end_inset - -cpanm -v ./<modname>.tar.gz -\end_layout - -\begin_layout Enumerate -Check the output. - If there is a failure, it should say. - You will have to fix it by looking at the output to see where it went wrong. - The most common cause of failure is that you need some kind of development - ( -\emph on --dev -\emph default - or -\emph on --devel -\emph default -) packages to be installed on your system, e.g. - through -\emph on -apt -\emph default -, -\emph on -yum -\emph default - or -\emph on -synaptic -\emph default - or the system package manager. - This may require root permission. -\begin_inset Newline newline -\end_inset - -If all else fails, you can ask Rob for help. -\end_layout - -\begin_layout Enumerate -Your installed modules are usually in (for -\emph on -Perl -\emph default - 5.25) -\begin_inset Newline newline -\end_inset - - -\family typewriter - $HOME/perl5/perlbrew/perls/5.25.0/lib/site_perl/5.25. -\family default -0 -\begin_inset Newline newline -\end_inset - -You should not have to set the -\emph on -PERL5LIB -\emph default - environment variable when installing with a modern cpanminus. -\begin_inset Newline newline -\end_inset - -If you -\emph on -do -\emph default - have trouble, try -\begin_inset Newline newline -\end_inset - - -\family typewriter -\series bold -export PERL5LIB=$HOME/perl5/perlbrew/perls/5.25.0/lib/site_perl/5.25.0 -\family default -\series default - -\begin_inset Newline newline -\end_inset - -(or similar). - -\end_layout - -\begin_layout Standard -Now you should have everything installed and be able to run a -\emph on -binary_grid -\emph default - script. -\end_layout - -\begin_layout Paragraph -Troubleshooting -\emph on -Perl -\end_layout - -\begin_layout Description -Module -\begin_inset space ~ -\end_inset - -not -\begin_inset space ~ -\end_inset - -found Check the -\family typewriter -PERL5LIB -\family default - environment variable. - When it is empty, -\emph on -cpanm/perlbrew -\emph default - should find your modules automatically, -\emph on -if -\emph default - they are installed correctly by -\emph on -cpanm -\emph default - (in the -\emph on -site_perl -\emph default - directory, see above). - You can try installing modules again with -\family typewriter -\series bold -cpanm --force --reinstall -\family default -\series default - to force a reinstallation, and with -\family typewriter -\series bold --v -\family default -\series default - for extra logging. -\end_layout - -\begin_layout Description -Module -\begin_inset space ~ -\end_inset - -fails -\begin_inset space ~ -\end_inset - -to -\begin_inset space ~ -\end_inset - -build Try -\family typewriter -\series bold -cpanm --notests -\family default -\series default - to not run all tests. - Sometimes these fail for spurious reasons, e.g. - in the case of -\emph on -binary_grid -\emph default - because there are -\emph on - no tests, -\emph default - but -\emph on - -\emph default -the module still functions. -\end_layout - -\begin_layout Description -Perlbrew -\begin_inset space ~ -\end_inset - -build -\begin_inset space ~ -\end_inset - -flags I would recommend at least -\begin_inset Newline newline -\end_inset - - -\family typewriter --Dusethreads -Duselargefiles -Doptimize="-O3 -march=native -mtune=native" -\begin_inset Newline newline -\end_inset - - -\family default -although you may wish to use -\family typewriter --O2 -\family default - if you feel mathematical precision is key to your application (I have never - noticed a problem with the above). -\begin_inset Newline newline -\end_inset - -I also recommend -\family typewriter --Dcccdlflags=-fPIC -\family default -so that module code is position independent and -\family typewriter --Duseshrplib -\family default - so that the appropriate threading library is used. - (These flags are passed to the -\emph on -C -\emph default - compiler that builds -\emph on -Perl -\emph default -.) -\end_layout - -\begin_layout Description -Rebuild -\begin_inset space ~ -\end_inset - -modules -\begin_inset space ~ -\end_inset - -for -\begin_inset space ~ -\end_inset - -new -\begin_inset space ~ -\end_inset - - -\emph on -Perl -\emph default - Let's say you had an old -\emph on -perl -\emph default -built with perlbrew, have installed a shiny new -\emph on -perl -\emph default - version with perlbrew, and now you want to rebuild all your existing modules. - Try this after the install, but before switching to the new -\emph on -perl -\emph default -, replacing -\family typewriter -5.xx.yy -\family default - with the new -\emph on -perl -\emph default - version: -\begin_inset Newline newline -\end_inset - - -\begin_inset Box Frameless -position "t" -hor_pos "c" -has_inner_box 1 -inner_pos "t" -use_parbox 0 -use_makebox 0 -width "100col%" -special "none" -height "1in" -height_special "totalheight" -thickness "0.4pt" -separation "3pt" -shadowsize "4pt" -framecolor "black" -backgroundcolor "none" -status open - -\begin_layout Plain Layout - -\family typewriter -\series bold -perlbrew list-modules | perlbrew exec --with 5.xx.yy cpanm -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Paragraph - -\emph on -binary_grid2 -\emph default - backends -\end_layout - -\begin_layout Standard -The -\begin_inset Quotes eld -\end_inset - -backend -\begin_inset Quotes erd -\end_inset - - is a set of interface code between -\emph on -binary_c -\emph default - and -\emph on -binary_grid2 -\emph default -. - -\end_layout - -\begin_layout Paragraph -Perl backend -\end_layout - -\begin_layout Standard -In -\emph on -binary_grid -\emph default -version 1, the only backend available was the Perl backend which communicates - with -\emph on -binary_c -\emph default - via a series of Unix pipes. - This is portable and flexible, and hence for many years was the default. - It does not, however, scale very well in multi-CPU architectures. - In binary_grid2 a pure -\emph on -Perl -\emph default -module is also provided, both for backwards compatibility and because the - code is well tested and stable. - The -\emph on -Perl -\emph default -backend is installed by default with -\emph on -binary_grid2 -\emph default -. - -\end_layout - -\begin_layout Standard -It is a simple matter of changing the -\family typewriter -prog -\family default - grid variable if you want to use a different version of -\emph on -binary_c -\emph default - with each grid script. -\end_layout - -\begin_layout Paragraph -C backend -\end_layout - -\begin_layout Standard -New to -\emph on -binary_grid2 -\emph default - is the -\emph on -C -\emph default - backend. - This features simpler code and uses -\emph on -binary_c -\emph default -'s -\emph on -API -\emph default - to access data directly, hence it is a lot faster than the -\emph on -Perl -\emph default - backend, and scales -\series bold -much -\series default -better on multi-core architectures. - The down side is that installation is more difficult, especially if you - have multiple projects. - -\end_layout - -\begin_layout Standard -If you see errors like: -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -perl: symbol lookup error: /.../perl5/perlbrew/perls/perl-5.25.0/lib/site_perl/5.25.0/x -86_64-linux-thread-multi/auto/binary_grid/C/C.so: undefined symbol: new_system -\end_layout - -\begin_layout Standard -then you have failed to build the shared library as required and you are - trying to use the -\emph on -C -\emph default - backend. -\begin_inset Newline newline -\end_inset - -To make the -\emph on -C -\emph default - backend work, you have to -\series bold -\emph on -first -\series default -\emph default - install -\emph on -libbinary_c.so -\emph default - and -\series bold -\emph on -then -\series default -\emph default - install -\emph on -binary_grid2 -\emph default -. - Essentially: -\end_layout - -\begin_layout Enumerate -Build -\emph on -binary_c -\emph default - as normal -\end_layout - -\begin_layout Enumerate -Make the shared library, -\emph on -libbinary_c.so -\emph default - (with -\family typewriter -\series bold -make libbinary_c.so -\family default -\series default -) -\end_layout - -\begin_layout Enumerate -Install -\emph on -binary_grid2 -\end_layout - -\begin_layout Standard -Because this module is written partly in -\emph on -C -\emph default - and partly in -\emph on -Perl -\emph default -, there are more things that can go wrong and it is harder to share installation -s (you cannot just copy the shared library to another filename). - The shared library -\emph on -libbinary_c.so -\emph default -must match with -\emph on -binary_grid2 -\emph default - -\series bold -at compile time -\series default -, and if you change anything in -\emph on -binary_c -\emph default - you probably have to follow the above instructions to reinstall the -\emph on -C -\emph default - backend. - -\end_layout - -\begin_layout Standard -There are ways around this problem. - You can change the name of the shared library by setting the environment - variable -\family typewriter -BINARY_C_LIB -\family default - to the name of the library, and pointing -\family typewriter -BINARY_C_SRC -\family default - to the -\family typewriter -src -\family default - directory in your -\emph on -binary_c -\emph default - tree. - Then rebuild, e.g., -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -export BINARY_C_LIB=binary_c_custom -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -export BINARY_C_SRC=$HOME/binary_c/src -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -./configure -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -make libbinary_c_custom.so -\end_layout - -\begin_layout Standard - -\family typewriter -\series bold -cpanm binary_grid2.tar.gz -\end_layout - -\begin_layout Standard -The -\emph on -binary_grid2 -\emph default - module respects the -\family typewriter -BINARY_C_LIB -\family default - environment variable. - -\end_layout - -\begin_layout Standard -I do not yet know how to have custom -\emph on -C -\emph default - backend modules with different shared libraries. - It is quite possible that you could use the -\family typewriter -PERL_INLINE_DIRECTORY -\family default - environment variable to have multiple builds, and point to the appropriate - one. - Please read -\begin_inset CommandInset href -LatexCommand href -target "http://search.cpan.org/~ingy/Inline-0.44/Inline.pod" -literal "false" - -\end_inset - - especially the section -\emph on -The Inline DIRECTORY -\emph default - for instructions on how it is best to set up production code for multiple - projects. - Let Rob know if it works, so better instructions can be put in here. -\end_layout - -\begin_layout Standard -There are a number of environment variables which can be set when installing - -\emph on -binary_grid2 -\emph default -'s -\emph on -C -\emph default - backend: -\end_layout - -\begin_layout Description -BINARY_GRID2_LIB The name of the shared library. - Usually this is 'binary_c'. -\end_layout - -\begin_layout Description -BINARY_GRID2_CC The name of the compiler used to build the C backend. - Usually 'gcc'. -\end_layout - -\begin_layout Description -BINARY_GRID2_LD The name of the linker used to build the C backend. - Usually 'ld'. -\end_layout - -\begin_layout Description -BINARY_GRID2_INC Include flags for the build. - Defaults to -\family typewriter --I -\emph on -srcdir -\family default - -\emph default -where -\emph on -srcdir -\emph default - is the -\emph on -binary_c -\emph default - -\family typewriter -src -\family default - directory (e.g. - set by -\family typewriter -BINARY_C_SRC -\family default -) -\end_layout - -\begin_layout Description -BINARY_GRID2_EXTRAINC Include flags to be postfixed to the -\emph on -inc -\emph default - flags set above. -\end_layout - -\begin_layout Description -BINARY_GRID2_LIBS Library flags. - Defaults to -\family typewriter --Lsrcdir -lbinary_c -lbfd -\family default -. -\end_layout - -\begin_layout Description -BINARY_GRID2_EXTRALIBS Library flags postfixed to the -\emph on -libs -\emph default - flags set above. -\end_layout - -\begin_layout Description -BINARY_GRID2_CCFLAGS Compiler flags. - Defaults to -\family typewriter --march=native -mtune=native -lm -lc -fPIC -ffunction-sections -lbfd -\end_layout - -\begin_layout Description -BINARY_GRID2_EXTRACCFLAGS C compiler flags postfixed to the -\emph on -ccflags -\emph default -set above. -\end_layout - -\begin_layout Standard -\begin_inset Newpage pagebreak -\end_inset - - -\end_layout - -\begin_layout Subsubsection -when proxies/authentication get in the way -\end_layout - -\begin_layout Standard -Many thanks to George Angelou for this guide to installing at the Max-Planck - Institiut f -\begin_inset ERT -status open - -\begin_layout Plain Layout - - -\backslash - -\begin_inset Quotes erd -\end_inset - - -\end_layout - -\end_inset - -ur Astronomie in Garching. -\begin_inset Newline newline -\end_inset - -We want the -\family typewriter --k -\family default - flag when getting -\emph on -perlbrew -\emph default - and to write to a file -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - - -\backslash -curl -kL -o perlbrew.sh https://install.perlbrew.pl | bash -\end_layout - -\end_inset - -Make it executable -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -chmod +x perlbrew.sh -\end_layout - -\end_inset - -Edit -\family typewriter -perlbrew.sh -\family default -. - Find: -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -echo -\end_layout - -\begin_layout Plain Layout - -if type curl >/dev/null 2>&1; then -\end_layout - -\begin_layout Plain Layout - -PERLBREWDOWNLOAD="curl -f -sS -Lo $LOCALINSTALLER $PERLBREWURL" -\end_layout - -\end_inset - -And add the ignore certificate flag -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -if type curl >/dev/null 2>&1; then -\end_layout - -\begin_layout Plain Layout - -PERLBREWDOWNLOAD="curl -kf -sS -Lo $LOCALINSTALLER $PERLBREWURL" -\end_layout - -\end_inset - -Execute -\family typewriter -perlbrew.sh -\family default - and we should get an error about -\emph on -patchperl -\emph default -Add the following to your -\family typewriter -tcshrc -\family default - (it will print out the -\emph on -bash -\emph default - equivalent on screen) -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -source ~/perl5/perlbrew/etc/cshrc -\end_layout - -\end_inset - -Close the terminal and open a new window. - -\begin_inset Newline newline -\end_inset - -Get -\emph on -patchperl -\emph default - manually: -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - - -\backslash -curl -kL https://raw.github.com/gugod/patchperl-packing/master/patchperl -\backslash - -\end_layout - -\begin_layout Plain Layout - - > $PERLBREW_ROOT/bin/patchperl -\end_layout - -\begin_layout Plain Layout - -chmod 755 $PERLBREW_ROOT/bin/patchperl -\end_layout - -\end_inset - - -\family typewriter -$PERLBREW_ROOT -\family default - is the path where -\emph on -perlbrew -\emph default - has been installed. - Follow Rob’s command for installing -\emph on -perl -\emph default - in -\emph on -multithread -\emph default - mode. - Hopefully this will install with no problems. - -\end_layout - -\begin_layout Standard -Make -\emph on -perl -\emph default - point to your new -\emph on -perlbrew -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -perlbrew switch perl.x.x.x -\end_layout - -\end_inset - -Install -\emph on -cpanminus -\emph default - manually -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -curl -kL https://cpanmin.us | perl - App::cpanminus -\end_layout - -\end_inset - -Make sure all is fine -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -perlbrew list-modules -\end_layout - -\end_inset - -And hopefully you see -\family typewriter -App::cpanminus -\family default - and -\family typewriter - Perl -\end_layout - -\begin_layout Standard -Good luck! -\begin_inset Newline newline -\end_inset - - -\begin_inset Newline newline -\end_inset - - -\series bold -Installing robs perl modules -\end_layout - -\begin_layout Standard -Running his script it failed on -\family typewriter -Inline::C. - -\family default - Its on the list twice anyway so I reran and got as far as Sys::Info -\emph on -. - MPA -\emph default - has its own OS that the module does not like and thinks is fake. - I edited the install_modules.pl file and commented out this module. - Rob says he doesn’t use it anymore so hopefully that will be fine. - -\end_layout - -\begin_layout Standard -It also failed at binning so I went into -\family typewriter -modules_targz -\family default - and used the install script there. - At first there are errors at it searches for the packages online then it - installs them locally. - -\family typewriter -perlbrew list-modules -\family default - suggests they are installed. - Going to scripts and testing the -\family typewriter -CNgrids.pl -\family default - I seem to get output. - So I assume all worked. -\end_layout - -\end_body -\end_document diff --git a/doc/binary_c-installation.pdf b/doc/binary_c-installation.pdf deleted file mode 100644 index 1a02d23883300fe36d40b02b4cf26afa1e6c1eae..0000000000000000000000000000000000000000 Binary files a/doc/binary_c-installation.pdf and /dev/null differ diff --git a/doc/binary_c2.lyx b/doc/binary_c2.lyx index 425cb50dae0abb583bd3a01627a712e95e175b5c..5bb03af5f242519a55a229a696db21851c436b93 100644 --- a/doc/binary_c2.lyx +++ b/doc/binary_c2.lyx @@ -1180,7 +1180,7 @@ Ubuntu status open \begin_layout Plain Layout -ubuntu_install.sh +ubuntu_install_binary_c.sh \end_layout \end_inset @@ -1210,17 +1210,17 @@ status open \begin_layout Plain Layout -wget http://personal.ph.surrey.ac.uk/~ri0005/ubuntu_install.sh +wget http://personal.ph.surrey.ac.uk/~ri0005/ubuntu_install_binary_c.sh \end_layout \begin_layout Plain Layout -chmod +x ubuntu_install.sh +chmod +x ubuntu_install_binary_c.sh \end_layout \begin_layout Plain Layout -./ubuntu_install.sh +./ubuntu_install_binary_c.sh \end_layout \end_inset @@ -3661,7 +3661,7 @@ noprefix "false" \begin_inset Formula $\binaryc$ \end_inset - is describe in section + is described in section \begin_inset space ~ \end_inset diff --git a/doc/getting_binary_c.lyx b/doc/getting_binary_c.lyx index 3eb0002b74567be8cc8faad9ae596ac51db590d9..076b92264e1083887cfa7a6b99e529d7506a1d0a 100644 --- a/doc/getting_binary_c.lyx +++ b/doc/getting_binary_c.lyx @@ -391,7 +391,155 @@ End \begin_body \begin_layout Subsubsection -Getting the source code +Getting the +\begin_inset Formula $\binaryc$ +\end_inset + + source code +\end_layout + +\begin_layout Description +With +\begin_inset space ~ +\end_inset + +git download the source code from +\begin_inset CommandInset href +LatexCommand href +target "https://gitlab.eps.surrey.ac.uk/ri0005/binary_c" +literal "false" + +\end_inset + +, e.g. +\begin_inset space ~ +\end_inset + +from the command line, +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +git clone https://gitlab.eps.surrey.ac.uk/ri0005/binary_c.git +\end_layout + +\end_inset + +or, if you have set up +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +SSH +\end_layout + +\end_inset + + keys on the +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +gitlab +\end_layout + +\end_inset + + server, +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +git clone gitlab@gitlab.eps.surrey.ac.uk:ri0005/binary_c.git +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Description +As +\begin_inset space ~ +\end_inset + +a +\begin_inset space ~ +\end_inset + +zip +\begin_inset space ~ +\end_inset + +file you can either download a release, e.g., +\begin_inset Newline newline +\end_inset + + +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://gitlab.eps.surrey.ac.uk/ri0005/binary_c/-/archive/2.1.6/binary_c-2.1.6.zip +\end_layout + +\end_inset + + +\begin_inset Newline newline +\end_inset + + +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://gitlab.eps.surrey.ac.uk/ri0005/binary_c/-/archive/2.1.6/binary_c-2.1.6.tar.gz +\end_layout + +\end_inset + + +\begin_inset Newline newline +\end_inset + + +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://gitlab.eps.surrey.ac.uk/ri0005/binary_c/-/archive/2.1.6/binary_c-2.1.6.tar.bz2 +\end_layout + +\end_inset + + +\begin_inset Newline newline +\end_inset + +or get the latest master branch from +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://gitlab.eps.surrey.ac.uk/ri0005/binary_c/-/archive/master/binary_c-master.zip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsubsection +Editing the source code \end_layout \begin_layout Standard @@ -417,8 +565,8 @@ literal "false" \end_inset . - Access requires permission which is done on a user-by-user basis and currently - only works easily if you have a Gmail account. + Write access requires permission which is done on a user-by-user basis + and currently only works easily if you have a Gmail account. If you don't, we can probably arrange something. \end_layout @@ -454,7 +602,16 @@ your account is locked! \end_layout \begin_layout Enumerate -Email me at r.izzard@surrey.ac.uk and tell me your account is +Email me at +\begin_inset CommandInset href +LatexCommand href +name "r.izzard@surrey.ac.uk" +type "mailto:" +literal "false" + +\end_inset + + and tell me your account is \begin_inset Quotes eld \end_inset @@ -596,9 +753,17 @@ You can access \emph default through +\begin_inset Flex Software +status open + +\begin_layout Plain Layout + \emph on docker -\emph default +\end_layout + +\end_inset + \begin_inset Foot status open @@ -620,14 +785,30 @@ target "https://www.docker.com/" \begin_layout Enumerate I assume you have installed and signed in to +\begin_inset Flex Software +status open + +\begin_layout Plain Layout + \emph on docker -\emph default +\end_layout + +\end_inset + . I cannot provide support for +\begin_inset Flex Software +status open + +\begin_layout Plain Layout + \emph on Docker -\emph default +\end_layout + +\end_inset + ! \end_layout @@ -702,8 +883,18 @@ docker pull robizzard/binary_c:master2.0pre32 \end_layout \begin_layout Enumerate -When you run Docker it inherits your stack settings, which may be too small - for binary_c to run. +When you run +\begin_inset Flex Software +status open + +\begin_layout Plain Layout +Docker +\end_layout + +\end_inset + + it inherits your stack settings, which may be too small for binary_c to + run. Use \begin_inset listings lstparams "language=bash" diff --git a/ubuntu_install.sh b/ubuntu_install.sh deleted file mode 100644 index d6c6cf8bca6d22f17d607010fa24ab194c96b8c5..0000000000000000000000000000000000000000 --- a/ubuntu_install.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -############################################################ -# -# script to install binary_c -# -# tested on Ubuntu 20.10 -# -# Note: this will ask you to choose python3.9 -# as your default python. You do NOT have to -# do this, but some software is only tested -# on python3.9. -# -# We default to using gcc-10 for the compilation. -# -############################################################ - - - -# update and install a KDE desktop :) -#sudo apt-get install synaptic kubuntu-desktop -#balooctl disable - -# update system -sudo apt-get update -sudo apt-get upgrade - -# install required packages -sudo apt-get install bash zip gcc-10 libgcc-10-dev gdb valgrind gawk python3.9 pipenv kcachegrind meson ninja-build emacs perl libgsl-dev global libbsd-dev binutils-dev libiberty-dev libjemalloc-dev zlib1g-dev unzip wget curl -sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 -sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2 -sudo update-alternatives --config python # >>> choose python3.9 <<< -pip install --upgrade meson -pip install --upgrade ninja - -# set up environment -export CC=gcc-10 -export BINARY_C=$HOME/progs/stars/binary_c - -if [ ! grep -q 'binary_c paths do not alter' ~/.bashrc ] -then - # set up bash paths : do this only once! - echo '# binary_c paths do not alter' >> ~/.bashrc - echo 'export LD_LIBRARY_PATH=$HOME/lib:$BINARY_C:$BINARY_C/src' >> ~/.bashrc # do this only once! - echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc # do this only once! -fi -export LD_LIBRARY_PATH=$HOME/lib:$BINARY_C:$BINARY_C/src -export PATH=$HOME/bin:$PATH - -# Install librinterpolate, libmemoize, librchash -cd $HOME -mkdir git -cd $HOME/git -wget https://gitlab.eps.surrey.ac.uk/ri0005/librinterpolate/-/archive/master/librinterpolate-master.zip -O librinterpolate-master.zip -unzip -o librinterpolate-master.zip -cd librinterpolate-master/ -meson --prefix=$HOME --buildtype=release builddir -ninja -C builddir install -cd .. - -wget https://gitlab.eps.surrey.ac.uk/ri0005/libmemoize/-/archive/master/libmemoize-master.zip -O libmemoize-master.zip -unzip -o libmemoize-master.zip -cd libmemoize-master/ -meson --prefix=$HOME --buildtype=release builddir -ninja -C builddir install -cd .. - -wget https://gitlab.eps.surrey.ac.uk/ri0005/librchash/-/archive/master/librchash-master.zip -O librchash-master.zip -unzip -o librchash-master.zip -cd librchash-master/ -meson --prefix=$HOME --buildtype=release builddir -ninja -C builddir install -cd .. - -# download and install binary_c -mkdir -p $BINARY_C -cd $BINARY_C/.. -wget http://personal.ph.surrey.ac.uk/~ri0005/binary_c-master.zip -O binary_c-master.zip -unzip -o binary_c-master.zip -rmdir binary_c -mv binary_c-master binary_c -cd binary_c -meson -Dbuildtype=release -Dvalgrind=true builddir -ninja -C builddir binary_c_install -./tbse - - -# install perlbrew and binary_grid -cd $HOME -\curl -L https://install.perlbrew.pl | bash - -if [ ! grep -q 'perlbrew paths do not alter' ~/.bashrc ] -then - echo "# perlbrew paths do not alter" >> ~/.bashrc - echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc # only do this once! -fi -source ~/perl5/perlbrew/etc/bashrc - - -export NTHREADS=`cat /proc/cpuinfo |grep cpu\ famil|wc -l` -export LATEST_PERL=`perlbrew available | grep "^[[:space:]]\+perl" | head -1` -perlbrew -v install $LATEST_PERL --thread --multi --64bitall --notest -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Dpager=/usr/bin/sensible-pager -Doptimize="-O3 -mtune=generic" -Duseshrplib -j $NTHREADS -perlbrew switch $LATEST_PERL -perlbrew install-cpanm -cd $BINARY_C/src/perl/modules_targz -./install_all.pl - -# run a test population -cd $BINARY_C -LD_PRELOAD=./src/libbinary_c.so ./src/perl/scripts2/template.pl diff --git a/ubuntu_install_binary_c.sh b/ubuntu_install_binary_c.sh new file mode 100755 index 0000000000000000000000000000000000000000..5160d4de2068ac7466b607d6446415a3c36d3eaa --- /dev/null +++ b/ubuntu_install_binary_c.sh @@ -0,0 +1,401 @@ +#!/bin/bash + +############################################################ +# +# script to install binary_c +# +# tested on Ubuntu 20.10/21.04, binary_c 2.2 +# +# Note: this will ask you to choose python3.9 +# as your default python. You do NOT have to +# do this, but some software is only tested +# on python3.9. +# +# Environment variables: +# +# CC : the C compiler, we default to gcc-10, but +# gcc should be fine. +# +# BINARY_C : the location of the binary_c root directory. +# +# GITROOT : the location in which we download the source code +# of libraries we require. +# +############################################################ +set -e # fail -> exit + +# Defaults for the environment variables that control +# installation locations, compiler etc. + +# set up compiler +: "${CC:="gcc-10"}" +# set up location of binary_c +: "${BINARY_C:="$HOME/binary_c"}" +# git download location +: "${GITROOT:="$HOME/git"}" + +export CC +export BINARY_C +export GITROOT + +echo +echo "#########################################################" +echo "Binary_c installation script for Ubuntu/Kubuntu 20/21+" +echo "#########################################################" +echo +echo "Press CTRL-C to exit at any time" +echo +echo "C compiler is set in CC" +echo "CC = $CC" +echo +echo "BINARY_C is the directory where binary_c will be installed" +echo "BINARY_C = $BINARY_C" +echo +echo "GITROOT is where source code for support libraries is downloaded" +echo "GITROOT = $GITROOT" +echo +echo "#########################################################" +echo +echo "Does the above look correct? (y/n)" +select s in "Yes" "No"; do + case $s in + "Yes" ) break;; + "No" ) exit; break;; + esac +done + +# Install librinterpolate, libmemoize, librchash +mkdir -p $GITROOT +cd $GITROOT + +############################################################ +versionsorter() { + [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] +} + +function setup_bash +{ + # set up bash and .bashrc + BASHRC="$HOME/.bashrc" + if ! grep -q 'binary_c paths do not alter' $BASHRC + then + # set up bash paths : do this only once! + echo '# binary_c paths do not alter' >> $BASHRC + echo 'export LD_LIBRARY_PATH=$HOME/lib:$BINARY_C:$BINARY_C/src' >> $BASHRC # do this only once! + echo 'export PATH=.:$HOME/bin:$HOME/.local/bin:$PATH' >> $BASHRC # do this only once! + echo "export BINARY_C=\"$BINARY_C\"" >> $BASHRC + + # psb, psbb, git functions etc. and completion of binary_c arguments + printf '%s' ' + +# source perlbrew +source $HOME/perl5/perlbrew/etc/bashrc + +# function to switch to progs/stars/binary_c +function psb +{ + cd $BINARY_C +} +function psbb +{ + cd $BINARY_C/builddir +} + +# git function for review number +git_rev () +{ + d=`date +%Y%m%d` + c=`git rev-list --full-history --all --abbrev-commit | /usr/bin/wc -l | /bin/sed -e "s/^ *//"` + h=`git rev-list --full-history --all --abbrev-commit | head -1` + echo ${c}:${d}:${h} +} + +alias new="ls -lrt |head -10" + +# git function to find the repository url +git_url () +{ + git config --get remote.origin.url +} + +# source autocompletion library +if [ -n "$BASH_VERSION" ]; then + [ -f /etc/bash_completion ] && . /etc/bash_completion +fi + +# completion of binary_c arguments +_binary_c() +{ + COMPREPLY=() + cmd="${COMP_WORDS[0]}" + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + binaryc_opts=$($BINARY_C_ROOT/binary_c help |/bin/grep -A2 "where the arguments are a selection of :"|tail -1|tr " " "\n") + # check if we match a binary_c argument + subcmd=( $(compgen -W "$binaryc_opts" "$prev") ) + if [[ $subcmd ]] ; then + # we do match an argument : try to get sub options + subopts=$($BINARY_C_ROOT/binary_c argopts $subcmd) + COMPREPLY=( $(compgen -W "$subopts" -- ${cur}) ) + else + # we do not, so list the arguments + COMPREPLY=( $(compgen -W "$binaryc_opts" -- ${cur}) ) + fi + return 0 +} +complete -F _binary_c binary_c +complete -F _binary_c tbse +complete -F _binary_c tbse.mint +complete -F _binary_c tbse.IRAS +' >> $BASHRC + fi + + # some of the above we require now + export LD_LIBRARY_PATH=$HOME/lib:$BINARY_C:$BINARY_C/src + export PATH=$HOME/bin:$HOME/.local/bin:$PATH + if [ -f $HOME/perl5/perlbrew/etc/bashrc ]; + then + source $HOME/perl5/perlbrew/etc/bashrc + fi +} + + +function install_from_surrey_git +{ + PACKAGE=$1 + + # download and install $PACKAGE + mkdir -p $GITROOT + cd $GITROOT + wget https://gitlab.eps.surrey.ac.uk/ri0005/$PACKAGE/-/archive/master/$PACKAGE-master.zip -O $PACKAGE-master.zip + unzip -o $PACKAGE-master.zip + cd $PACKAGE-master/ + if [ -d builddir ]; + then + rm -r builddir + fi + meson --prefix=$HOME --buildtype=release builddir + ninja -C builddir install +} + +function install_binary_c_from_zip +{ + # download and install binary_c + if [ -d $BINARY_C ]; + then + echo "Directory $BINARY_C already exists: please remove any old binary_c installation before installing a new one" + exit + fi + cd /tmp # work from /tmp + wget https://gitlab.eps.surrey.ac.uk/ri0005/binary_c/-/archive/master/binary_c-master.zip -O binary_c-master.zip + unzip -o binary_c-master.zip + rm binary_c-master.zip + mv binary_c-master $BINARY_C + cd $BINARY_C + meson -Dbuildtype=release -Dvalgrind=true builddir + ninja -C builddir binary_c_install + ./tbse + cd $HOME +} + +function install_binary_c_from_git_https +{ + # download and install binary_c + echo "Install to BINARY_C=$BINARY_C" + git clone --branch master --single-branch https://gitlab.eps.surrey.ac.uk/ri0005/binary_c.git $BINARY_C + rm -rf $BINARY_C/builddir 2>/dev/null + cd $BINARY_C + meson -Dbuildtype=release -Dvalgrind=true $BINARY_C/builddir + ninja -C $BINARY_C/builddir binary_c_install + $BINARY_C/binary_c-config version +} + + +function install_binary_c_from_git_ssh +{ + # download and install binary_c + cd $BINARY_C/.. + git clone gitlab@gitlab.eps.surrey.ac.uk:ri0005/binary_c.git + cd binary_c + meson -Dbuildtype=release -Dvalgrind=true builddir + ninja -C builddir binary_c_install + ./binary_c-config version +} + +function run_test_population +{ + # run a test population + cd $BINARY_C + LD_PRELOAD=./src/libbinary_c.so ./src/perl/scripts2/template.pl +} + +function install_binary_c_perl_modules +{ + # install the binary_c Perl modules + cd $BINARY_C/src/perl/modules_targz + ./install_all.pl +} + +function install_perl +{ + # install perlbrew and binary_grid + cd $HOME + \curl -L https://install.perlbrew.pl | bash + + if ! grep -q 'perlbrew paths do not alter' ~/.bashrc + then + echo "# perlbrew paths do not alter" >> ~/.bashrc + echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc # only do this once! + fi + source ~/perl5/perlbrew/etc/bashrc 2>&1 || true + export NTHREADS=`cat /proc/cpuinfo |grep cpu\ famil|wc -l` + export CURRENT_PERL=`perl -e '$v=$^V;$v=~s/v//;print "perl-$v\n";'` + export LATEST_PERL=`perlbrew available | grep "^[[:space:]i]\+perl" | sed s/^i// | sed s/^[[:space:]]*// | sed s/[[:space:]]*\\$// | head -1` + echo "CURRENT_PERL = \"$CURRENT_PERL\"" + echo "LATEST_PERL = \"$LATEST_PERL\"" + + if [ "$CURRENT_PERL" == "$LATEST_PERL" ]; + then + echo "You already have the latest Perl" + else + NEWER_PERL=`echo -e "$CURRENT_PERL\n$LATEST_PERL" | sort -Vr | head -1` + if [ "$NEWER_PERL" == "$LATEST_PERL" ]; + then + echo "Installing $LATEST_PERL" + perlbrew -v install $LATEST_PERL --thread --multi --64bitall --notest -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Dpager=/usr/bin/sensible-pager -Doptimize="-O3 -mtune=generic" -Duseshrplib -j $NTHREADS + # clean the build + echo "Cleaning perlbrew/build" + rm -rf $HOME/perl5/perlbrew/build 2>/dev/null + else + echo "No newer Perl has been found : sticking with $CURRENT_PERL" + fi + echo "Source perlbrew" + source ~/perl5/perlbrew/etc/bashrc 2>&1 || true + echo "Switch to use $LATEST_PERL" + perlbrew switch $LATEST_PERL + fi + + source ~/perl5/perlbrew/etc/bashrc 2>&1 || true + echo "Install cpanm" + perlbrew -f install-cpanm +} + +function update_packages +{ + # update and install a KDE desktop :) + #sudo apt-get install synaptic kubuntu-desktop + #balooctl disable + + # update system + sudo apt-get update + sudo apt-get upgrade + + # install required packages + sudo apt-get install bash zip gcc-10 libgcc-10-dev gdb valgrind gawk python3.9 pipenv kcachegrind meson ninja-build emacs perl libgsl-dev global libbsd-dev binutils-dev libiberty-dev libjemalloc-dev zlib1g-dev unzip wget curl git + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 +# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2 2>/dev/null + echo "You should normally choose Python 3.9" + sudo update-alternatives --config python # >>> choose python3.9 <<< + sudo apt-get clean + pip install --upgrade meson + pip install --upgrade ninja +} + +function download_MINT_data +{ + # download MINT data + mkdir -p $HOME/data/MINT + cd $HOME/data/MINT + rm -f sync + wget http://personal.ph.surrey.ac.uk/~ri0005/MINT/sync + chmod +x sync + ./sync +} + +############################################################ + +# set up bash (always do this) +setup_bash + +# install/check system packages +echo "Do you wish to check and, if necessary, install system packages? (requires sudo permissions)" +select yn in "Yes" "No"; do + case $yn in + Yes ) update_packages; break;; + No ) break;; + esac +done + +# install perl from perlbrew +echo "Install perlbrew and custom Perl?" +select yn in "Yes" "No"; do + case $yn in + Yes ) install_perl; break;; + No ) break;; + esac +done + +# install librinterpolate +echo "Install librinterpolate?" +select yn in "Yes" "No"; do + case $yn in + Yes ) install_from_surrey_git librinterpolate; break;; + No ) break;; + esac +done + +# install libmemoize +echo "Install libmemoize?" +select yn in "Yes" "No"; do + case $yn in + Yes ) install_from_surrey_git libmemoize; break;; + No ) break;; + esac +done + +# install librchash +echo "Install librchash?" +select yn in "Yes" "No"; do + case $yn in + Yes ) install_from_surrey_git librchash; break;; + No ) break;; + esac +done + +# install binary_c +echo "Install binary_c from ... ?" +select s in "git (https)" "git (ssh, keys must be set up)" "git (zip, no version control)" "No"; + do case $s in + "git (https)" ) install_binary_c_from_git_https; break;; + "git (ssh, keys must be set up)" ) install_binary_c_from_git_ssh; break;; + "git (zip, no version control)" ) install_binary_c_from_zip; break;; + "No" ) break;; + esac +done + +# install binary_c's perl modules +echo "Install binary_c Perl modules?" +select yn in "Yes" "No"; do + case $yn in + Yes ) install_binary_c_perl_modules; break;; + No ) break;; + esac +done + +# install MINT data? +echo "Download MINT data?" +select yn in "Yes" "No"; do + case $yn in + Yes ) download_MINT_data; break;; + No ) break;; + esac +done + +# run test population +echo "Run a test stellar population to make sure everything works?" +select yn in "Yes" "No"; do + case $yn in + Yes ) run_test_population; break;; + No ) break;; + esac +done