Differences
This shows you the differences between two versions of the page.
| abstract:darwin:install_software:udbuild [2021-04-22 11:33] – created anita | abstract:darwin:install_software:udbuild [2021-04-22 11:37] (current) – anita | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== UDBUILD Software Deployment ===== | ||
| + | The software installed and deployed on the DARWIN cluster each has it's own | ||
| + | methods for compiling and installing. | ||
| + | has a set of standards and technology used to reduce complexity and bring | ||
| + | consistency to the process. | ||
| + | Software is built, installed, and accessed using the | ||
| + | [[software: | ||
| + | developed a set of software helper functions which can be access using VALET | ||
| + | by importing the '' | ||
| + | |||
| + | This page describes the filesystem layout used by IT, and the anatomy of the | ||
| + | '' | ||
| + | it is helpful to have an understanding of how to use | ||
| + | [[software: | ||
| + | environment. | ||
| + | |||
| + | ==== Filesystem ==== | ||
| + | Software is deployed to ''/ | ||
| + | The '' | ||
| + | location. | ||
| + | environment variable before initializing the ubuild environment. | ||
| + | value for this environment variable for workgroup software is | ||
| + | '' | ||
| + | '' | ||
| + | |||
| + | Beneath this directory should be an '' | ||
| + | software bundles, optionally an '' | ||
| + | optional add-ons, and one sub-directory for each package installed. | ||
| + | These sub-directories should always be in all lower-case letter. | ||
| + | layer down should be a directory for each version of the software installed. | ||
| + | It is important understand that on a complex cluster like DARWIN, the same | ||
| + | release of a software package may have multiple installations due to various | ||
| + | compiler and dependency package requirements. | ||
| + | software installation roots. | ||
| + | |||
| + | Underneath the installation root should be a directory called '' | ||
| + | is the un-packed source bundle. | ||
| + | '' | ||
| + | |||
| + | An illustrated example of the software directory structure is as such: | ||
| + | |||
| + | * opt | ||
| + | * shared | ||
| + | * atlas | ||
| + | * 3.10.3 | ||
| + | * 3.10.3-intel | ||
| + | * attic | ||
| + | * '' | ||
| + | * python | ||
| + | * 2.7.8 | ||
| + | * 3.2.5 | ||
| + | * add-ons | ||
| + | * python2.7.15 | ||
| + | * mpi | ||
| + | * 20180613 | ||
| + | * python3.2.5 | ||
| + | * attic | ||
| + | * '' | ||
| + | |||
| + | ==== Building ==== | ||
| + | When building software, the base directory structure (including the '' | ||
| + | directory) should be created by you before proceeding further. | ||
| + | You should download the software source bundle into '' | ||
| + | unpack the software bundle and rename the directory to '' | ||
| + | above. | ||
| + | '' | ||
| + | |||
| + | Examples of builds are provided below (after the udbuild function | ||
| + | documentation). | ||
| + | |||
| + | === udbuild functions === | ||
| + | |||
| + | == init_udbuildenv == | ||
| + | This function initializes the udbuild environment. It ensures that you have | ||
| + | the required '' | ||
| + | not have VALET packages loaded before '' | ||
| + | might affect your build), sets compiler variables like CC, FC, etc., then | ||
| + | finally sets your '' | ||
| + | command-line. | ||
| + | |||
| + | * none - This is equivalent to not supplying any parameters | ||
| + | * python-addon - Ensure a python VALET package is loaded, and set PREFIX \ | ||
| + | appropriately for that python version' | ||
| + | * r-addon - Ensure an R VALET package is loaded, and set PREFIX \ | ||
| + | appropriately for that R version' | ||
| + | * node-addon - Ensure a Node.JS version is loaded and set the PREFIX \ | ||
| + | appropriately for that Node.JS versions' | ||
| + | * Any other arguments are treated as the names of VALET packages which are \ | ||
| + | loaded and added to the '' | ||
| + | |||
| + | After all of this, your '' | ||
| + | |||
| + | ${UDBUILD_HOME: | ||
| + | |||
| + | == debug == | ||
| + | Drop into a debug shell. | ||
| + | udbuild script will continue from there. | ||
| + | when creating a udbuild script. | ||
| + | on documentation, | ||
| + | make step to verify the environment looks sane. After the first successful | ||
| + | compile, you can then remove the debug line. | ||
| + | |||
| + | == download == | ||
| + | The '' | ||
| + | first, argument is the URL to download. | ||
| + | the last part of the URL unless the optional second argument is specified. | ||
| + | case, the resulting file will be named after the second argument. | ||
| + | |||
| + | If a file with the same name already exists, the download exits successfully without | ||
| + | doing anything. | ||
| + | one. | ||
| + | |||
| + | == unpack == | ||
| + | The '' | ||
| + | first, argument is the name of an archive file (tar.gz, tar.bz2, tar.xz, zip, etc.) | ||
| + | to extract. | ||
| + | install prefix (versioned directory for installation) unless the optional second argument | ||
| + | is specified, then it will be used in place of the name '' | ||
| + | its parents if necessary, will be created prior to extraction. | ||
| + | the '' | ||
| + | the package name and version, this is automatically stripped from the extracted archive. | ||
| + | After completing the extraction process, the '' | ||
| + | script into the newly created directory to prepare the script for configure and make | ||
| + | steps. | ||
| + | |||
| + | If the '' | ||
| + | extracted over it. In this case, the function returns successfully without doing | ||
| + | anything. | ||
| + | '' | ||
| + | |||
| + | == create_valet_template == | ||
| + | Create a YAML based valet package file template and place it in the '' | ||
| + | if one can be found, and the same directory as the udbuild script if one cannot. | ||
| + | template is helpful, but usually cannot just be copied into place. | ||
| + | knows about the version of the software it is installing, and copying the file blindly would | ||
| + | remove entries for all other versions. | ||
| + | all loaded valet packages, even if they are dependencies of dependencies, | ||
| + | to be explicitly listed. | ||
| + | |||
| + | == valet == | ||
| + | This function takes either the name of a package (e.g. '' | ||
| + | package name/ | ||
| + | is a VALET package loaded to satisfy this dependency, and false otherwise. | ||
| + | |||
| + | This function can be used along with any other shell constructs, such as | ||
| + | '' | ||
| + | |||
| + | == version == | ||
| + | This function takes a string and validates that it exists as a complete | ||
| + | entry (i.e. starts, stops, or is bounded by hyphens) in the VERSION string. | ||
| + | |||
| + | This function can be used along with any other shell constructs, such as | ||
| + | '' | ||
| + | |||
| + | == package == | ||
| + | This function takes a string and validates that it exists as part of | ||
| + | the final package name, which may include features. | ||
| + | matching features which are specified to configure a software build but | ||
| + | don't show up in the version string or require a valet package be | ||
| + | available, the string " | ||
| + | this feature. | ||
| + | |||
| + | == ifvalet == | ||
| + | This function is shorthand for '' | ||
| + | to make udbuild scripts simple to read and code. | ||
| + | |||
| + | == ifversion == | ||
| + | This function is shorthand for '' | ||
| + | to make udbuild scripts simple to read and code. | ||
| + | |||
| + | == ifpackage == | ||
| + | This function is shorthand for '' | ||
| + | to make udbuild scripts simple to read and code. | ||
| + | |||
| + | == udbuildcapture == | ||
| + | Put all screen output into a capture file. The main purpose of this is to | ||
| + | log questions answered during an interactive isntall, to document what | ||
| + | choices were made. | ||
| + | |||
| + | == udbuildmon == | ||
| + | This script is helpful to be run during the install phase of a build, for | ||
| + | example: | ||
| + | |||
| + | udbuildmon make install | ||
| + | |||
| + | It will log all '' | ||
| + | a file named '' | ||
| + | build did not write any files to unknown locations. | ||
| + | be necessary with [[http:// | ||
| + | store this information in an '' | ||
| + | |||
| + | == apath == | ||
| + | Append a path to a variable and ensure that variable is exported. | ||
| + | first argument is the environment variable name, all remaining arguments are | ||
| + | paths to append to the end of the environment variable. | ||
| + | is used as the delimiter, as is standard in path environment variables. | ||
| + | |||
| + | == ppath == | ||
| + | Prepend a path to a variable similar to '' | ||
| + | path to the end, add it to the beginning. | ||
| + | |||
| + | == rpath == | ||
| + | Remove a path from an environment variable. | ||
| + | environment variable name. All remaining arguments are removed from the | ||
| + | environment variable. | ||
| + | removed. | ||
| + | |||
| + | == aflag == | ||
| + | Append a flag to an environment variable. | ||
| + | environment variable name. All remaining arguments are added to the environment | ||
| + | variable. | ||
| + | status of the first argument. | ||
| + | type, then the remaining arguments are added as new elements in the array. | ||
| + | all other cases, the remaining arguments are added to the string using a space | ||
| + | character as a delimiter. | ||
| + | |||
| + | Using a bash array has the advantage of allowing flags which contain whitespace | ||
| + | characters. | ||
| + | |||
| + | CONFIG=() | ||
| + | aflag CONFIG --prefix=" | ||
| + | aflag CONFIG --title=" | ||
| + | ./ | ||
| + | |||
| + | == pflag == | ||
| + | Prepend flags to an environment variable. | ||
| + | function, but it puts its arguments at the beginning of the variable. | ||
| + | arguments are identical. | ||
| + | |||
| + | == rflag == | ||
| + | Remove a flag from an environment variable. | ||
| + | '' | ||
| + | |||
| + | == udexpect == | ||
| + | This is a wrapper around the TCL '' | ||
| + | answering questions for interactive builds. | ||
| + | script as STDIN (the normal method is via HERE-DOC) and provides all the basics | ||
| + | of running '' | ||
| + | process: | ||
| + | |||
| + | - enter - Send a carrige return as if the user pressed their " | ||
| + | - yes - Send the string " | ||
| + | - no - Send " | ||
| + | - y - Send " | ||
| + | - n - Send " | ||
| + | - respond text - Send //text// and press " | ||
| + | - keypress c - Send the character //c// and DO NOT press " | ||
| + | - user - Prompt the person at the keyboard for a respone, and send it, press " | ||
| + | |||
| + | == makeflags_set == | ||
| + | Update a file (presumably a Makefile and specified as the first argument) which uses | ||
| + | the syntax " | ||
| + | third argument. | ||
| + | information in a Makefile. | ||
| + | |||
| + | == makeflags_prepend == | ||
| + | Update a file similar to '' | ||
| + | existing value, instead of replacing it. | ||
| + | |||
| + | == makeflags_append == | ||
| + | Update a file similar to '' | ||
| + | existing value, instead of replacing it. | ||
| + | |||
| + | === udbuild script examples === | ||
| + | |||
| + | == simple == | ||
| + | In this example, an easy-to-install software package called cmake is built | ||
| + | and isntalled. | ||
| + | '' | ||
| + | open source software packages. | ||
| + | |||
| + | To prepare for this build, you would want to create the following directories: | ||
| + | |||
| + | |||
| + | <file sh udbuild> | ||
| + | #/bin/bash -l | ||
| + | |||
| + | PKGNAME=cmake | ||
| + | VERSION=3.11.3 | ||
| + | #Setting the " | ||
| + | #helpful later. | ||
| + | SITEURL=https:// | ||
| + | |||
| + | PKGINFO=' | ||
| + | URLINFO=http:// | ||
| + | |||
| + | vpkg_devrequire udbuild/ | ||
| + | init_udbuildenv | ||
| + | |||
| + | #Download the source file if it doesn' | ||
| + | download $SITEURL/ | ||
| + | unpack $PKGNAME-$VERSION.tar.gz | ||
| + | |||
| + | create_valet_template | ||
| + | #can't just copy this into place) | ||
| + | |||
| + | ./configure --prefix=$PREFIX | ||
| + | #having to define your own PREFIX | ||
| + | #variable, because ' | ||
| + | #that for you. | ||
| + | |||
| + | make #normal make commands | ||
| + | |||
| + | udbuildmon make install | ||
| + | #' | ||
| + | #and directories were changed. | ||
| + | </ | ||
| + | |||
| + | It is imperitive to start udbuild scripts with the string ''# | ||
| + | because this instructs bash to setup the VALET system. | ||
| + | |||
| + | == medium == | ||
| + | <file sh udbuild> | ||
| + | #!/bin/bash -l | ||
| + | |||
| + | PKGNAME=cdo | ||
| + | VERSION=1.9.4 | ||
| + | SITEURL=https:// | ||
| + | |||
| + | vpkg_devrequire udbuild/2 eccodes/ | ||
| + | vpkg_devrequire netcdf/ | ||
| + | init_udbuildenv | ||
| + | |||
| + | create_valet_template | ||
| + | |||
| + | download $SITEURL/ | ||
| + | unpack $PKGNAME-$VERSION.tar.gz | ||
| + | |||
| + | aflag CONFIG --with-szlib=" | ||
| + | aflag CONFIG --with-hdf5=" | ||
| + | aflag CONFIG --with-netcdf=" | ||
| + | aflag CONFIG --with-eccodes=" | ||
| + | aflag CONFIG --with-proj=" | ||
| + | aflag CONFIG --with-udunits2=" | ||
| + | aflag CONFIG --with-threads=yes | ||
| + | aflag CONFIG --with-curl=yes | ||
| + | aflag CONFIG --with-libxml=yes | ||
| + | |||
| + | ./configure --prefix=" | ||
| + | |||
| + | sed -i ' | ||
| + | |||
| + | make | ||
| + | |||
| + | udbuildmon make install | ||
| + | </ | ||
| + | |||
| + | In this example, we use '' | ||
| + | needed to build the '' | ||
| + | to ''/ | ||
| + | |||
| + | == complex == | ||
| + | <file sh udbuild> | ||
| + | #!/bin/bash -l | ||
| + | |||
| + | PKGNAME=hdf4 | ||
| + | VERSION=4.2.13 | ||
| + | SITEURL=https:// | ||
| + | |||
| + | PKGINFO=' | ||
| + | URLINFO=http:// | ||
| + | |||
| + | vpkg_devrequire udbuild szip/2.1.1 | ||
| + | init_udbuildenv | ||
| + | |||
| + | create_valet_template | ||
| + | |||
| + | download $SITEURL/ | ||
| + | unpack hdf-$VERSION.tar.bz2 | ||
| + | |||
| + | aflag CFLAGS -fPIC | ||
| + | if valet intel; then | ||
| + | aflag CFLAGS -qopt-jump-tables=large | ||
| + | fi | ||
| + | |||
| + | aflag CONFIG --disable-netcdf | ||
| + | aflag CONFIG --with-szlib=$SZIP_PREFIX | ||
| + | |||
| + | # Make shared libraries (sans fortran support): | ||
| + | ./configure --prefix=" | ||
| + | | ||
| + | make install | ||
| + | |||
| + | make clean | ||
| + | |||
| + | # Make fortran enabled HDF4: | ||
| + | ./configure --prefix=" | ||
| + | |||
| + | make install | ||
| + | |||
| + | </ | ||
| + | |||
| + | In this more complicated example, we still need dependencies, | ||
| + | one of them will affect the '' | ||
| + | be used, and PREFIX will be set to ''/ | ||
| + | |||
| + | Furthermore, | ||
| + | This example also illustrates how the '' | ||
| + | we would set additional flags for the '' | ||
| + | string were set to '' | ||
| + | to build multiple versions of a package, and with only minor changes near | ||
| + | the top of the script (namely to the '' | ||
| + | '' | ||
| + | |||
| + | Another interesting thing we do here is to make sure the installation is | ||
| + | as complete as possible. | ||
| + | fortran libraries. | ||
| + | then we enable fortran and ensure the full compliment of archive '' | ||
| + | are present. | ||
| + | |||
| + | == python == | ||
| + | <file sh udbuild-cdf> | ||
| + | #!/bin/bash -l | ||
| + | |||
| + | PKGNAME=cdf | ||
| + | VERSION=20180613 | ||
| + | PY_VER=3.6.5 | ||
| + | NETCDF_VER=4.6.1 | ||
| + | |||
| + | PKGINFO=' | ||
| + | URLINFO=https:// | ||
| + | |||
| + | vpkg_devrequire udbuild python/ | ||
| + | init_udbuildenv python-addon | ||
| + | |||
| + | create_valet_template | ||
| + | |||
| + | ppath PATH " | ||
| + | apath LD_RUN_PATH " | ||
| + | |||
| + | pip_install CDF cdflib netCDF4 h5netCDF wera2netcdf Puppy nco | ||
| + | pip_install python-hdf4 hdf5able hdf5pickle hdf5storage | ||
| + | pip_install dtt2hdf ascii2hdf5 h5json h5pyd hdf5_matlab_reader | ||
| + | pip_install HDFconvert mrr2c hdfdict LazyHDF5 simpletraj mdtraj | ||
| + | pip_install mriqc ncagg | ||
| + | pip_install ' | ||
| + | </ | ||
| + | |||
| + | The python example above is used to install the cdf and related modules as an add-on for python version 3.6.5. It is also considered a complex example since it displays the use of the option '' | ||
| + | |||
| + | <file sh python-cdf.vpkg_yaml> | ||
| + | python-cdf: | ||
| + | description: | ||
| + | url: https:// | ||
| + | prefix: | ||
| + | | ||
| + | default-version: | ||
| + | | ||
| + | versions: | ||
| + | " | ||
| + | description: | ||
| + | prefix: | ||
| + | dependencies: | ||
| + | - | ||
| + | - | ||
| + | - | ||
| + | - | ||
| + | - | ||
| + | </ | ||