To ensure the port of cctbx.xfel to Cori goes smoothly, it is necessary to identify and outline the relevant steps required to process data from LCLS.

As a quick guide, I will outline the steps required for this, and introduce example code where necessary.

Installing the psana-cctbx.xfel toolchain

Firstly, we must ensure that the environment is correctly initialised to process the data. The following steps are a summary of those given for psana, and for cctbx.xfel. It is encouraged to read the documentation at these locations for further information. The following commands assume a bash environment by default (alternative shells should also work, with alternative instructions given where necessary).

  1. Install Miniconda for Python 2.7.
  2. Once installed, source the conda installation and update the base environment (note, psana-conda needs packages in the ‘free’ channel which has been deprecated, so we restore it here):

      source ./miniconda/etc/profile.d/conda.sh
      conda update -y conda
      conda config --set restore_free_channel true
    
  3. Create a conda environment for the installation:

     conda create -n myEnv
    
  4. Activate the newly created conda environment:

     conda activate myEnv
    
  5. Install psana from the LCLS conda channel, replacing X with the appropriate RH Linux version {5,6,7}:

     conda install -y --channel lcls-rhelX psana-conda
    
  6. Install the following additional dependencies for building and running psana and cctbx*:

     conda install future h5py mpich2 wxpython pillow libtiff mock pytest jinja2 scikit-learn tabulate tqdm
     conda install --channel conda-forge orderedset
     python -m pip install procrunner
    

    *see alternate instructions for rh6 below

  7. Create a permanent location to install and build cctbx (referred to as $PERM in the following steps):

     export PERM=<my_dir>; mkdir $PERM
    
  8. Copy the experiment name database from SLAC to your local system. This step assumes the end-user has a SLAC account, and can access psexport.slac.stanford.edu. A public facing database will be included with the psana conda installation at a later date.

     mkdir -p $PERM/psdm/data/ExpNameDb;
     rsync -t psexport.slac.stanford.edu:/reg/g/psdm/data/ExpNameDb/experiment-db.dat $PERM/psdm/data/ExpNameDb/
    
  9. Export the following psana environment variables:

     export SIT_DATA=$PERM/psdm/data
     export SIT_ROOT=$PERM/psdm/data
     export SIT_PSDM_DATA=$SIT_ROOT
    
  10. Create a cctbx.xfel directory, and acquire the bootstrap program for building and installation (--no-check-certificate can often be required):

    mkdir $PERM/cctbx.xfel; cd $PERM/cctbx.xfel
    wget https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py --no-check-certificate
    
  11. Download and build the cctbx.xfel packages using the conda environment activated python.

    python bootstrap.py hot --builder=dials
    python bootstrap.py update --builder=dials
    
  12. Assuming C++ compilers exist on the path, the following step will build the XFEL version of cctbx; specify the number of available cores to enable parallel compilation:

    python bootstrap.py build --builder=dials --with-python=`which python` --nproc=<# cores available for compile>
    
  13. The path environment variables are set up by running the following command:

    source $PERM/cctbx.xfel/build/setpaths.sh #Bash users
    

    or

    source $PERM/cctbx.xfel/build/setpaths.csh #csh users
    

With the above steps the psana-cctbx.xfel build should now be installed, with all accessible commands working. A script for the above commands can be found here.

Alternate step 6 for rh6

For rh6, after installing psana-conda, uninstall the mpi it came with and reinstall mpi4py:

conda uninstall openmpi mpi4py --force
conda install mpi4py

Then proceed with step 6 as listed.