Skip to content

Using and Installing CCL on NERSC

WeikangLin edited this page Sep 14, 2017 · 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 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.

To install CCL in a specific path on NERSC.

  1. To install CCL on your own on NERSC, 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 fftw
    • module load swig
    • export LDFLAGS+="-L$GSL_DIR/lib -L$FFTW_DIR"
    • export CPPFLAGS+="-I$GSL_DIR/include -I$FFTW_DIR/../include"
  2. 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
  3. Next, do the following to allow your compiled code to call CCL (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"
  4. Now you can compile your code calling CCL, e.g., ./tests/ccl_sample_run.c by

    • gcc -Wall -Wpedantic -g $CPPFLAGS -std=gnu99 -fPIC tests/ccl_sample_run.c -o tests/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