Building XGC with GNU Make

The GNU make environment used by XGC consists of

  • A platform-independent makefile ([repo name]/Makefile)

  • An auxiliary file ([repo name]/build/rules.mk) defining the make targets (e.g. xgc-es, xgc-em, xgca,…)

  • An auxiliary file ([repo name]/build/defs.mk) defining the names of the object (.o) files required for building the targets defined in [repo name]/build/rules.mk

  • An auxiliary file for defining preprocessor macros at compile time ([repo name]/build/xgc_flags.mk)

  • A platform specific makefile ([repo name]/build/make.inc.{platform}) that holds all settings that are specific to the targeted computing system (e.g. location of libraries, etc.)

The files Makefile, rules.mk, defs.mk, and make.inc.{platform} are unlikely to need frequent modifications. If you feel that something needs to be modified in those files, discuss with senior developers. The file xgc_flags.mk is for you to change when you compile XGC, but do not push any modifications to this file to the repository. Preprocessor options that are always defined should be in Makefile.

If you add a platform specific makefile for a new system, start from make.inc.generic and adhere to the style set forth in this template. If your system uses a package manager such as “module” at NERSC, ALCF, and OLCF, copy+paste a list of the modules you loaded to the start of the new platform specific makefile.

Instructions for building XGC

  1. Look for an existing make configuration for your target platform (–> make.inc.{platform}) in the folder “build” or adjust and rename make.inc.generic for your platform.

  2. Set debugging options and target platform by

export XGC_PLATFORM={platform}
export DEBUG={0|1}

or

DEBUG={0|1} XGC_PLATFORM={platform} make ...
  1. Adjust build/xgc_flags.mk if you want to use any optional compile time options (pre-processor macros).

  2. Select the directory by either prepending PREFIX={path} to the make command or by export PREFIX={path} before running make. If omitted, the default setting PREFIX=$(PWD)/xgc_build will be used.

  3. Compile XGC by running [DEBUG={0|1} XGC_PLATFORM={platform} PREFIX={path}] make {target} where {target} is one of

    • xgc-es: XGC1 electrostatic

    • xgc-es-gpu: XGC1 electrostatic with GPU support

    • xgc-es-vec: XGC1 with MVX512 optimization

    • xgc-em: XGC1 electromagnetic (kinetic-fluid hybrid)

    • xgca: XGCa (axisymmetric)

    • xgca-gpu: XGCa with GPU support

    • xgca-vec: XGCa with MVX512 optimization