Compile programs on Big Red 200 at IU

On this page:


Available programming environments

Big Red 200 provides programming environments for the Cray, Intel, NVIDIA HPC, and GNU Compiler Collection (GCC) compilers. Each programming environment defines system paths and environment variables specific to its associated compiler collection.

Big Red 200 uses the Lmod module management system to allow users to customize their software environments.

Programming environment module Compiler collection
PrgEnv-cray Cray
PrgEnv-intel Intel
PrgEnv-nvidia NVIDIA
PrgEnv-gnu GCC

Once the desired programming environment module is loaded, use the appropriate compiler driver command to invoke the desired compiler; for information about each compiler driver command, see its manual page:

Compiler driver command Description Manual page
cc Invokes the C compiler for the currently loaded programming environment man cc
CC Invokes the C++ compiler for the currently loaded programming environment man CC
ftn Invokes the Fortran compiler for the currently loaded programming environment man ftn
Note:
  • To compile a program that will run on the compute nodes, you must use the appropriate compiler driver command. Do not directly invoke the Cray, GCC, Intel, or NVIDIA compilers unless you intend to run your executable only on the login or service nodes. For example, if you compile a C++ code using nvc++ or g++ compiler instead of the CC compiler driver command, the resulting executable will not run on the compute nodes.
  • The only switches that are common to all three compiler driver commands (and work across all programming environments) are -shared, -static, -dynamic, and -hugetlbfs (which links 2 MB pages instead of the default 4 KB). Additionally, the Fortran compiler driver has a -default64 switch available that works across all programming environments; it promotes all integers and real numbers to a 64-bit default, and is compatible with the 64-bit MPI libraries.

The compiler driver commands also take most of the switches associated with the compilers they target, as determined by the currently loaded programming environment. For more, see the "Options and switches" sections in the following information about the Cray, GNU, Intel, and NVIDIA programming environments.

Use the Cray programming environment

Set up your user environment

The Cray programming environment module (PrgEnv-cray) supplies the system paths and environment variables needed to use the Cray C, C++, and Fortran compilers on Big Red 200. To determine which programming environment is currently loaded, view the list of currently loaded modules; on the command line, enter:

module list

To switch to a programming environment that is not currently loaded, use the module swap command; for example, on Big Red 200, to replace the default programming environment (PrgEnv-gnu) with the Cray programming environment (PrgEnv-cray), on the command line, enter:

module swap PrgEnv-gnu PrgEnv-cray

You can save your customized user environment so that it loads every time you start a new session; for instructions, see Use modules to manage your software environment on IU research supercomputers.

Examples

With the PrgEnv-cray module loaded, use the cc, CC, and ftn compiler driver commands to invoke the craycc, crayCC, and crayftn compilers, respectively. For example:

  • To compile the C program my_program.c to create the binary my_program, on the command line, enter:
    cc -o my_program my_program.c
  • To compile the C++ program my_program.CC to create the binary my_program, on the command line, enter:
    CC -o my_program my_program.CC
  • To compile the Fortran program my_program.f95 to create the binary my_program, on the command line, enter:
    ftn -o my_program my_program.f95
Important:
To compile a program that will run on the Big Red 200 compute nodes, you must use the appropriate compiler driver command. Do not directly invoke the Cray compilers unless you intend to run your executable only on a login or service node. For example, if you compile a C++ code using the crayCC compiler instead of the CC compiler driver command, the resulting executable will not run on the Big Red 200 compute nodes.

Options and switches

  • Compiler driver switches: The only switches that are common to all three compiler driver commands (and work across all programming environments) are -shared, -static, -dynamic, and -hugetlbfs (which links 2 MB pages instead of the default 4 KB). Additionally, the Fortran compiler driver has a -default64 switch available (it promotes all integers and real numbers to a 64-bit default, and is compatible with the 64-bit MPI libraries).
  • Cray compiler options: With the PrgEnv-cray module loaded, the compiler driver commands (cc, CC, and ftn) take many of the same options available to the Cray compilers they invoke. Additionally, you can access the manual page for each Cray compiler to view the options available to it; at the command prompt, enter:
    • man craycc
    • man crayCC
    • man crayftn
    Note:
    The Cray compiler switches are heavily treed. The top-level switches contain most legacy switches, such as -o (output file), -O (optimization; default is -O2), -l (library name), and -L (library directory). Other switches, such as -e (enable compiling options), -d (disable compiling options), and -h (arguments), have multiple sub-options.

Use the GNU programming environment

Set up your user environment

The GNU programming environment module (PrgEnv-gnu) supplies the system paths and environment variables needed to use the GCC C, C++, and Fortran compilers on Big Red 200. To determine which programming environment is currently loaded, view the list of currently loaded modules; on the command line, enter:

module list

To switch to a programming environment that is not currently loaded, use the module swap command; for example, on Big Red 200, to replace a different programming environment such as PrgEnv-intel with the GNU programming environment (PrgEnv-gnu), on the command line, enter:

module swap PrgEnv-intel PrgEnv-gnu

You can save your customized user environment so that it loads every time you start a new session; for instructions, see Use modules to manage your software environment on IU research supercomputers.

Examples

With the PrgEnv-gnu module loaded, use the cc, CC, and ftn compiler driver commands to invoke the gcc, g++, and gfortran compilers, respectively. For example:

  • To compile the C program my_program.c to create the binary my_program, on the command line, enter:
    cc -o my_program my_program.c
  • To compile the C++ program my_program.CC to create the binary my_program, on the command line, enter:
    CC -o my_program my_program.CC
  • To compile the Fortran program my_program.f95 to create the binary my_program, on the command line, enter:
    ftn -o my_program my_program.f95
Important:
To compile a program that will run on the Big Red 200 compute nodes, you must use the appropriate compiler driver command. Do not directly invoke the GCC compilers unless you intend to run your executable only on a login or service node. For example, if you compile a C++ code using the g++ compiler instead of the CC compiler driver command, the resulting executable will not run on the Big Red 200 compute nodes.

Options and switches

  • Compiler driver switches: The only switches that are common to all three compiler driver commands (and work across all programming environments) are -shared, -static, -dynamic, and -hugetlbfs (which links 2 MB pages instead of the default 4 KB). Additionally, the Fortran compiler driver has a -default64 switch available (it promotes all integers and real numbers to a 64-bit default, and is compatible with the 64-bit MPI libraries).
  • GCC compiler options: With the PrgEnv-gnu module loaded, the compiler driver commands (cc, CC, and ftn) take many of the same options available to the GCC compilers they invoke. Additionally, you can access the manual page for each GCC compiler to view the options available to it; at the command prompt, enter:
    • man gcc
    • man g++
    • man gfortran

Use the Intel programming environment

Set up your user environment

The Intel programming environment module (PrgEnv-intel) supplies the system paths and environment variables needed to use the Intel C, C++, and Fortran compilers on Big Red 200. To determine which programming environment is currently loaded, view the list of currently loaded modules; on the command line, enter:

module list

To switch to a programming environment that is not currently loaded, use the module swap command; for example, on Big Red 200, to replace the default programming environment (PrgEnv-gnu) with the Intel programming environment (PrgEnv-intel), on the command line, enter:

module swap PrgEnv-gnu PrgEnv-intel

You can save your customized user environment so that it loads every time you start a new session; for instructions, see Use modules to manage your software environment on IU research supercomputers.

Examples

With the PrgEnv-intel module loaded, use the cc, CC, and ftn compiler driver commands to invoke the icc, icpc, and ifort compilers, respectively. For example:

  • To compile the C program my_program.c to create the binary my_program, on the command line, enter:
    cc -o my_program my_program.c
  • To compile the C++ program my_program.CC to create the binary my_program, on the command line, enter:
    CC -o my_program my_program.CC
  • To compile the Fortran program my_program.f95 to create the binary my_program, on the command line, enter:
    ftn -o my_program my_program.f95
Important:
To compile a program that will run on the Big Red 200 compute nodes, you must use the appropriate compiler driver command. Do not directly invoke the Intel compilers unless you intend to run your executable only on a login or service node. For example, if you compile a C++ code using the icpc compiler instead of the CC compiler driver command, the resulting executable will not run on the Big Red 200 compute nodes.

Options and switches

  • Compiler driver switches: The only switches that are common to all three compiler driver commands (and work across all programming environments) are -shared, -static, -dynamic, and -hugetlbfs (which links 2 MB pages instead of the default 4 KB). Additionally, the Fortran compiler driver has a -default64 switch available (it promotes all integers and real numbers to a 64-bit default, and is compatible with the 64-bit MPI libraries).
  • Intel compiler options: With the PrgEnv-intel module loaded, the compiler driver commands (cc, CC, and ftn) take many of the same options available to the Intel compilers they invoke. Additionally, you can access the manual page for each Intel compiler to view the options available to it; at the command prompt, enter:
    • man icc
    • man icpc
    • man ifort

Use the NVIDIA programming environment

Set up your user environment

The NVIDIA programming environment module (PrgEnv-nvidia) supplies the system paths and environment variables needed to use the NVIDIA C, C++, and Fortran compilers on Big Red 200. To determine which programming environment is currently loaded, view the list of currently loaded modules; on the command line, enter:

module list

To switch to a programming environment that is not currently loaded, use the module swap command; for example, on Big Red 200, to replace the default programming environment (PrgEnv-gnu) with the NVIDIA programming environment (PrgEnv-nvidia), on the command line, enter:

module swap PrgEnv-gnu PrgEnv-nvidia

You can save your customized user environment so that it loads every time you start a new session; for instructions, see Use modules to manage your software environment on IU research supercomputers.

Examples

With the PrgEnv-nvidia module loaded, use the cc, CC, and ftn compiler driver commands to invoke the nvc, nvc++, and nvfortran compilers, respectively. For example:

  • To compile the C program my_program.c to create the binary my_program, on the command line, enter:
    cc -o my_program my_program.c
  • To compile the C++ program my_program.CC to create the binary my_program, on the command line, enter:
    CC -o my_program my_program.CC
  • To compile the Fortran program my_program.f95 to create the binary my_program, on the command line, enter:
    ftn -o my_program my_program.f95
Important:
To compile a program that will run on the Big Red 200 compute nodes, you must use the appropriate compiler driver command. Do not directly invoke the Intel compilers unless you intend to run your executable only on a login or service node. For example, if you compile a C++ code using the nvc++ compiler instead of the CC compiler driver command, the resulting executable will not run on the Big Red 200 compute nodes.

Options and switches

  • Compiler driver switches: The only switches that are common to all three compiler driver commands (and work across all programming environments) are -shared, -static, -dynamic, and -hugetlbfs (which links 2 MB pages instead of the default 4 KB). Additionally, the Fortran compiler driver has a -default64 switch available (it promotes all integers and real numbers to a 64-bit default, and is compatible with the 64-bit MPI libraries).
  • NVIDIA compiler options: With the PrgEnv-nvidia module loaded, the compiler driver commands (cc, CC, and ftn) take many of the same options available to the NVIDIA compilers they invoke. Additionally, you can access the manual page for each NVIDIA compiler to view the options available to it; at the command prompt, enter:
    • man nvc
    • man nvc++
    • man nvfortran

Get help

If you have questions about compilers on the IU research supercomputers or need help, contact the UITS Research Applications and Deep Learning team.

This is document bhow in the Knowledge Base.
Last modified on 2023-10-03 15:29:16.