Controlling the Programming Environment
Categories: Compiling
Changing Compilers
If a different compiler is required, it is important to use the correct environment for each compiler. To aid users in pairing the correct compiler and environment, programming environment modules are provided. The programming environment modules will load the correct pairing of compiler version, message passing libraries, and other items required to build and run. We highly recommend that the programming environment modules be used when changing compiler vendors.
The following programming environment modules are available on Titan:
- PrgEnv-pgi
- PrgEnv-gnu
- PrgEnv-cray
- PrgEnv-intel
To change the default loaded PGI environment to the default GCC environment use:
$ module unload PrgEnv-pgi $ module load PrgEnv-gnu
Or alternatively:
$ module swap PrgEnv-pgi PrgEnv-gnu
Changing Versions of the Same Compiler
To use a specific compiler version, you must first ensure the compiler’s PrgEnv module is loaded, and then swap to the correct compiler version. For example, the following will configure the environment to use the GCC compilers, then load a non-default GCC compiler version:
$ module swap PrgEnv-pgi PrgEnv-gnu $ module swap gcc gcc/4.6.1
General Programming Environment Guidelines
We recommend the following general guidelines for using the programming environment modules:
- Do not purge all modules; rather, use the default module environment provided at the time of login, and modify it.
- Do not swap or unload any of the Cray provided modules (those with names like
xt-*
,xe-*
,xk-*
, orcray-*
). - Do not swap moab, torque, or MySQL modules after loading a programming environment modulefile.