Skip to content

Using and Installing CCL on NERSC

Francois Lanusse edited this page Jul 21, 2018 · 21 revisions

To use the central installation of pyCCL at NERSC.

  • Using the CCL Python module in the shared environment :
    • Setup the environment: source /global/common/software/lsst/common/miniconda/
    • Quick test to be sure things are set up correctly You can check whether pyccl has been set up correctly by running python -c "import pyccl" and checking that no errors are returned.


  • Run Example Notebooks

    source /global/common/software/lsst/common/miniconda/kernels/

    • Clone the CCL repo to your NERSC $HOME directory

    git clone

    • Start up jupyter-dev in your web browser.
      1. Choose either

        • The simple notebook editor:


        • The more full-featured JupyterLab available by pointing your browser to:


          Replace $USER with your NERSC username, and $HOME with the full path to your NERSC $HOME directory (e.g /global/homes/p/pjm43)

      2. Open your notebook

      3. Change the kernel to desc-stack

      4. Run your notebook

To Build the CCL Paper

  • git clone
  • cd CCL
  • git checkout ccl_paper
  • module load python/3.6-anaconda-4.4
  • module load latex
  • pip install --user mkauthlist
  • export MKAUTHLIST=$HOME/.local/cori/3.6-anaconda-4.4/bin/mkauthlist
  • cd doc/ccl_paper
  • make apj

C Library Installation

[OUTDATED] These are old notes for building the C library. Leaving this here for now.

  1. If class is not installed already (The last step needs to be done in CCL installation directory).

    • export CFLAGS=-fPIC
    • export CRAYPE_LINK_TYPE=dynamic
    • export XTPE_LINK_TYPE=dynamic
    • python
  2. Load the necessary modules. You can run the steps as follows (or put them in a script, e.g.,, and do source

    • module load gsl/2.1
    • module load cray-fftw
    • module load swig
    • export LDFLAGS+="-L$GSL_DIR/lib -L$FFTW_DIR"
    • export CPPFLAGS+="-I$GSL_DIR/include -I$FFTW_DIR/../include"
  3. Then you can go to the CCL directory and install CCL in /path/you/choose by running

    • ./configure --prefix=/path/you/choose
    • make
    • make install
  4. Next, do the following to allow your compiled code to call CCL (only need to do once, or write to your .bashrc file):

    • export LD_LIBRARY_PATH=/path/you/choose/lib:$LD_LIBRARY_PATH.

    and add /path/you/choose to LDFLAGS and CPPFLAGS by (pay attention to the space before -L)

    • export LDFLAGS+=" -L/path/you/choose/lib"
    • export CPPFLAGS+=" -I/path/you/choose/include"
  5. Now you can compile your code calling CCL, e.g., ./examples/ccl_sample_run.c by

    • gcc -Wall -Wpedantic -g $CPPFLAGS -std=gnu99 -fPIC examples/ccl_sample_run.c -o examples/ccl_sample_run $LDFLAGS -lgsl -lgslcblas -lm -lccl

    and run it.

You can’t perform that action at this time.