Skip to content

Using and Installing CCL on NERSC

WeikangLin edited this page May 22, 2018 · 23 revisions

To use the central installation of CCL on NERSC (not to install on your own).

  1. There is a central installation of CCL (now version 0.2) on NERSC. To use it, one can run

    • source /global/common/cori/contrib/lsst/ccl/setupPyCCL.sh

    which will load the required modules and set some path flags.

  2. Then we can compile, e.g., ./tests/ccl_sample_run.c by

    • gcc -Wall -Wpedantic -g -I$CCL_NERSC_DIR/$CCL_NERSC_VER/include $CPPFLAGS -std=gnu99 -fPIC tests/ccl_sample_run.c -o tests/ccl_sample_run -L$CCL_NERSC_DIR/$CCL_NERSC_VER/lib $LDFLAGS -lgsl -lgslcblas -lm -lccl

    and run ./tests/ccl_sample_run.

Note that the current central installed CCL on NERSC is of version 0.2. The package of version 0.2 can be obtained from /global/common/cori/contrib/lsst/ccl/downloads/0.2.tar.gz, where sample codes are provided. To use the latest version of CCL, one may follow the instructions below to install it on his own.

To install CCL in a specific path on NERSC.

  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 class_install.py
  2. Load the necessary modules. You can run the steps as follows (or put them in a script, e.g., CCL_setup.sh, and do source CCL_setup.sh)

    • 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.

P.S. A script file of environment setup for developers to build CCL may be provided in future.

Clone this wiki locally