Ha14 installation: Difference between revisions

From cctbx_xfel
Jump to navigation Jump to search
m (Use % for the csh prompt.)
m (Aaron moved page Installation to Ha14 installation: deprecated installation instructions)
 
(43 intermediate revisions by 4 users not shown)
Line 1: Line 1:
IMPORTANT: installing ''cctbx.xfel'' is not necessary for most users, as ''cctbx.xfel'' is installed at SLAC already and is generally accessible.  General users should instead go to [[setup]] to configure their unix account at SLAC to run ''cctbx.xfel.''
== Prerequisites ==


This document aims to be a step-by-step installation guide for ''cctbx.xfel''Note that in this text <code>$</code> denotes the prompt of any unprivileged user on the system.  Certain shells may be configured to use <code>%</code> or <code>&gt;</code> for that purposeThe user prompt is distinct from <code>#</code>, which denotes the prompt of the superuser.  This installation can be performed by any regular user—no superuser privileges are required.
While these tutorials assume you wish to process XTC streams at SLAC, some users have stills collected from other sources and do not need the full PSDM suiteIf this is the case, see the installation directions below for installing on a non PSDM system.  Otherwise, it is assumed that the [[Set up PSDM software | PSDM software distribution has been set up]]Note again that several sites already have ''cctbx.xfel'' installed, and so regular users not involved in the development of the software will not need the instructions here.


== Prerequisite: install and set up the PSDM suite ==
Once ''cctbx.xfel'' has been installed it must be [[Setup | set up]] before it can be used.  Developers may additionally want to [[Set up ssh-agent | set up an ssh-agent]]. 


See [[Set up PSDM software]]. It is assumed that <code>ana_env.sh</code> or <code>ana_env.csh</code> has been sourced, a release directory has been configured in <code>~/myrelease</code> or <code>~/analisys-rel</code>, and that an empty analysis package has been set up in <code>~/myrelease/my_ana_pkg</code> or <code>~/analisys-rel/my_ana_pkg</code>
Finally, you must have a user account on cci.lbl.gov in order to proceed, or else you will not be able to download the sources. A sourceforge account is only needed if you wish to commit changes back to the repository. If you don't have or don't want to use a sourceforge account, you can leave it off in the below commands where it is specified.


<!-- XXX In addition, these software packages need to be available: reportlab, h5py, etc -->
== Standard installation using PSDM  ==
===Quick start===
This step has to be performed on a host with Internet access. Not all hosts at SLAC have that, but the members of <i>e.g.</i> pslogin pool do. Make and change to a working directory to contain the new source code and build (this directory should be accessible from any computing nodes ''cctbx.xfel'' will be run. Then download these bootstrap modules:


== Download and extract ''cctbx'' and ''LABELIT'' source bundles ==
  wget https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py


<!-- XXX Seems to be important to source ana_env.sh before building! XXX Stored in /net/cci/auto_build/cctbx/results -->
Then:


<!-- XXX This is probably the only place where the developer installation is different from the standard installation.  Investigate and accommodate! -->
  python bootstrap.py hot update --builder=xfel --cciuser=<cciusername> --sfuser=<githubusername>


This step has to be performed on a host with Internet access. Not all hosts at SLAC have that, but the members of <i>e.g.</i> psexport pool do. In what follows, the absolute path <code>/path/to/cctbx/directory</code> should be replaced with something more appropriate. The directory should accessible everywhere ''cctbx.xfel'' is to be run.
This command instructs bootstrap.py to download static packages required for ''cctbx.xfel'' (hot), and then to checkout the rest of the sources from cci.lbl.gov and github (update), using the user accounts specified by the cciuser and sfuser parameters, respectively.
$ mkdir -p /path/to/cctbx/directory
$ cd /path/to/cctbx/directory
$ wget http://cci.lbl.gov/cctbx_build/results/2013_08_13_0005/cctbx_bundle.tar.gz
$ wget http://cci.lbl.gov/~hattne/labelit/labelit_bundle_20130814.tar.gz
Note: new bundles are automatically prepared nightly. It is, however, not advisable to automatically update from the latest bundle. Please check with the program authors before upgrading a critical installation. <!-- This should probably be some kind of warning box, see http://www.mediawiki.org/wiki/Template:Mbox XXX Note also that downloads of the labelit bundle are intentionally "disabled". -->


Extract the sources:
===Alternate instructions for non-LBNL developers===
$ mkdir cctbx_project
Our non-LBNL colleagues will now realize that the "python bootstrap" step does not work without cci username credentials, needed to obtain source code for the program LABELIT. Developers are instructed to use the following alternate procedure:
$ tar -xpvzf cctbx_bundle.tar.gz -C cctbx_project --strip-components=1
$ tar -xpvzf labelit_bundle_20130814.tar.gz


Add the <code>cxi_user</code> directory and its <code>__init__.py</code> module.  This defines the default integration algorithm used by ''cctbx.xfel''.
  python bootstrap.py hot --builder=xfel --sfuser=<githubusername> # download the static packages
$ mkdir cxi_user
  python bootstrap.py update --builder=dials --sfuser=<githubusername> # download the github code for dials & cctbx
  $ cat > cxi_user/__init__.py << EOF
  mkdir modules/cxi_xdr_xes # create a stub directory for experiment-specific python code
from xfel.mono_simulation.mono_treatment import post_outlier_rejection
   
  from xfel.mono_simulation.mono_treatment import pre_get_predictions
Then download phenix from http://phenix-online.org and untar the packageLocate the modules directory in the phenix directory tree, and copy-paste the labelit subdirectory into the modules directory of your current working area.
EOF


== Configure the source tree ==
===Finish up the build===
This next two steps require access to a C++ compiler and a Python interpreter, any minor version between 2.5 and 2.7.  At SLAC, the members of the psexport pool do not have any compilers installed, but the interactive nodes, reachable <i>via</i> psanacs, doThe Python interpreter used to configure the source tree must be the same interpreter the PSDM suite uses.  That interpreter can be located using find(1), <i>e.g.</i>
After downloading the sources, you need to be sure you have the appropriate compilers before executing the next command.  At SLAC, that means you need to ssh to one of the psana nodes, as the pslogin nodes do not have the requisite compilers.  When ready, configure and compile thusly:
$ find $SIT_ROOT -executable -name python -type f
At SLAC this interpreter is located somewhere under <code>/reg/g/psdm/sw/external/python</code>.  Then create and initialize the build directory and compile the sources using the appropriate Python interpreter.
$ mkdir cctbx_build
$ cd cctbx_build
$ <b><i>python</i></b> ../cctbx_project/libtbx/configure.py xfel
where <code><b><i>python</i></b></code> should be substituted with output of the previous find(1) command.


Now, initialise the running shell using the newly created configuration files. bash(1)-users should do
  python bootstrap.py build --builder=xfel --with-python=`which python` --nproc=<# cores available for compile>
$ . setpaths.sh
while csh(1)-users should instead run
% source setpaths.csh


== Compile the sources ==
On SLAC's interactive nodes, this takes just over 6 minutes. To avoid problems with run-time dynamic linking of Python extensions, the Python interpreter required for the above command must be the one provided by the PSDM software distribution.  That interpreter can be located using find, <i>e.g.</i>
$ make
$ find $SIT_ROOT/sw/external/python -perm /0111 -type f -wholename "*/$SIT_ARCH/*/python" 2> /dev/null
On SLAC's interactive nodes, this takes just over 6 minutes.
At SLAC this interpreter is located somewhere under <code>/reg/g/psdm/sw/external/python</code>.  Here we use `which python` to get this path automatically. 


<!-- It used to be necessary to run make twice, but that seems to no longer be the case. -->
Initialise the running shell using the newly created configuration files.  bash-users should
$ . build/setpaths.sh
while csh-users will instead need to run
% source build/setpaths.csh


== Edit shell configuration files ==
To finalize the installation, see [[Setup]].
To make the changes to the environment persistent, bash(1) users are encouraged to add these lines to <code>~/.bashrc</code>
test -r "/path/to/cctbx/directory/cctbx-build/setpaths.sh" && \
  . "/path/to/cctbx/directory/cctbx-build/setpaths.sh"


csh(1) users should instead add these lines to ~/.cshrc
Note, you may also follow this procedure if you are on a machine where you have your own python that you want to use, instead of the one provided by PSDM.
test -r "/path/to/cctbx/directory/cctbx-build/setpaths.csh" && \
  source "/path/to/cctbx/directory/cctbx-build/setpaths.csh"
Note: to avoid surprises when running ''cctbx.xfel'' from a non-interactive shell, it is recommended that bash(1) users edit <code>~/.bash_profile</code> and put this line near the top:
test -r "${HOME}/.bashrc" && . "${HOME}/.bashrc"
A job submitted to the cluster will typically run ''cctbx.xfel'' from a non-interactive shell.


== Link ''cctbx.xfel'' modules to the PSDM suite. ==
== Installation on a non-PSDM system ==
$ cd ~/myrelease/my_ana_pkg
$ ln -fns /path/to/cctbx/directory/cctbx_project/xfel/cxi/cspad_ana src
$ cd ..
$ scons


<!-- XXX Should check this with Andy or so; this can probably be done better.  Perhaps note that using -fns will zap any old src link in place. -->
If you find yourself on a machine without PSDM and won't be dealing with XTC directly, for example if you have your own data collected as stills from a non-XFEL source, you can use the below commands in a new directory (again assuming you have a cci user account):


== Test the installation ==
  # On Linux:
At SLAC, test that it is working by <i>e.g.</i>
  wget https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py
$ cd ~/myrelease
  # On MacOSX:
$ cxi.pyana -c /reg/d/ffb/cxi/temp/cctbx/tutorials/setup/test.cfg /reg/d/ffb/cxi/temp/Feb2013calib/e290-r0069-s00-c00.xtc
  curl https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py > bootstrap.py
This should start a viewer, displaying dark-subtracted averages from an XTC stream.


  python bootstrap.py hot update base build --builder=xfel --cciuser=<cciusername> --sfuser=<sourceforgeusername>
Here, in addition to hot, update and build, there's a command called 'base', which downloads a python and needed packages and compiles it.  After this process completes, source the installation (for details see above), and then add scipy to it:
  . build/setpaths.sh
  libtbx.python -m easy_install scipy
Please contact the authors if with any issues.  Some gotchas:
1) On a Mac, you will need to make sure you have the latest version of xcode installed.  Consider the command xcode-select --install. [NOTE: Xcode v. 8.2.1. for Mac OS 10.12 (Sierra) does not include a gFortran compiler. You will need to install gFortran separately if you need scipy.]
2) On linux you will likely need to install some dependencies, including gFortran. [Note: gFortran is needed only for the scipy installation, not for the core build based on cctbx.  Therefore, only install gFortran if you need scipy.]


== External links ==
== External links ==

Latest revision as of 23:13, 6 November 2018

Prerequisites

While these tutorials assume you wish to process XTC streams at SLAC, some users have stills collected from other sources and do not need the full PSDM suite. If this is the case, see the installation directions below for installing on a non PSDM system. Otherwise, it is assumed that the PSDM software distribution has been set up. Note again that several sites already have cctbx.xfel installed, and so regular users not involved in the development of the software will not need the instructions here.

Once cctbx.xfel has been installed it must be set up before it can be used. Developers may additionally want to set up an ssh-agent.

Finally, you must have a user account on cci.lbl.gov in order to proceed, or else you will not be able to download the sources. A sourceforge account is only needed if you wish to commit changes back to the repository. If you don't have or don't want to use a sourceforge account, you can leave it off in the below commands where it is specified.

Standard installation using PSDM

Quick start

This step has to be performed on a host with Internet access. Not all hosts at SLAC have that, but the members of e.g. pslogin pool do. Make and change to a working directory to contain the new source code and build (this directory should be accessible from any computing nodes cctbx.xfel will be run. Then download these bootstrap modules:

 wget https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py

Then:

 python bootstrap.py hot update --builder=xfel --cciuser=<cciusername> --sfuser=<githubusername>

This command instructs bootstrap.py to download static packages required for cctbx.xfel (hot), and then to checkout the rest of the sources from cci.lbl.gov and github (update), using the user accounts specified by the cciuser and sfuser parameters, respectively.

Alternate instructions for non-LBNL developers

Our non-LBNL colleagues will now realize that the "python bootstrap" step does not work without cci username credentials, needed to obtain source code for the program LABELIT. Developers are instructed to use the following alternate procedure:

 python bootstrap.py hot --builder=xfel --sfuser=<githubusername> # download the static packages
 python bootstrap.py update --builder=dials --sfuser=<githubusername> # download the github code for dials & cctbx
 mkdir modules/cxi_xdr_xes # create a stub directory for experiment-specific python code

Then download phenix from http://phenix-online.org and untar the package. Locate the modules directory in the phenix directory tree, and copy-paste the labelit subdirectory into the modules directory of your current working area.

Finish up the build

After downloading the sources, you need to be sure you have the appropriate compilers before executing the next command. At SLAC, that means you need to ssh to one of the psana nodes, as the pslogin nodes do not have the requisite compilers. When ready, configure and compile thusly:

 python bootstrap.py build --builder=xfel --with-python=`which python` --nproc=<# cores available for compile>

On SLAC's interactive nodes, this takes just over 6 minutes. To avoid problems with run-time dynamic linking of Python extensions, the Python interpreter required for the above command must be the one provided by the PSDM software distribution. That interpreter can be located using find, e.g.

$ find $SIT_ROOT/sw/external/python -perm /0111 -type f -wholename "*/$SIT_ARCH/*/python" 2> /dev/null

At SLAC this interpreter is located somewhere under /reg/g/psdm/sw/external/python. Here we use `which python` to get this path automatically.

Initialise the running shell using the newly created configuration files. bash-users should

$ . build/setpaths.sh

while csh-users will instead need to run

% source build/setpaths.csh

To finalize the installation, see Setup.

Note, you may also follow this procedure if you are on a machine where you have your own python that you want to use, instead of the one provided by PSDM.

Installation on a non-PSDM system

If you find yourself on a machine without PSDM and won't be dealing with XTC directly, for example if you have your own data collected as stills from a non-XFEL source, you can use the below commands in a new directory (again assuming you have a cci user account):

 # On Linux:
 wget https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py
 # On MacOSX:
 curl https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py > bootstrap.py
 python bootstrap.py hot update base build --builder=xfel --cciuser=<cciusername> --sfuser=<sourceforgeusername>

Here, in addition to hot, update and build, there's a command called 'base', which downloads a python and needed packages and compiles it. After this process completes, source the installation (for details see above), and then add scipy to it:

 . build/setpaths.sh
 libtbx.python -m easy_install scipy

Please contact the authors if with any issues. Some gotchas:

1) On a Mac, you will need to make sure you have the latest version of xcode installed. Consider the command xcode-select --install. [NOTE: Xcode v. 8.2.1. for Mac OS 10.12 (Sierra) does not include a gFortran compiler. You will need to install gFortran separately if you need scipy.]

2) On linux you will likely need to install some dependencies, including gFortran. [Note: gFortran is needed only for the scipy installation, not for the core build based on cctbx. Therefore, only install gFortran if you need scipy.]

External links