Here are some simple examples to show how to use the available compilers to build an executable from source code. These examples apply either to a serial code, or to a code that is multithreaded with OpenMP so it can use multiple cores on a single compute node.

NVIDIA Compilers
GNU Compilers
Performance Options

Additional compiler flags can be selected to optimize the performance of the code. For the NVIDIA compilers on Vista, TACC recommends using the flag -fast, which creates a generally optimal set of flags during compilation. Additionally, it tells the compiler to optimize performance for the CPUs and GPUs that happen to be on the machine where the compiler is running. This approach is valid as long as the machine on which the code is compiled (e.g., a login node) has the same hardware as the target machine (e.g., a "Grace Grace" compute node). To make extra sure that your code is correctly optimized for Grace, you can add the flag -tp neoverse-v2. (For Hopper, -gpu=cc90 could also be added.) The full command lines for a CPU-only code therefore look like this:

With GCC, the -O3 flag tells the compiler to be aggressive in making code transformations for greater speed. However, by default, GCC compilers generate code that works on a wide range of processors of a given family. To produce code that is optimized for the CPUs on the specific machine where the compiler is running, the flag -mcpu=native is also needed. The more precise flag that pertains to NVIDIA Grace is -mcpu=neoverse-v2. Thus, with GCC, the command lines for a CPU-only code look like this:

As an alternative, you may use the environment variable $TACC_VEC_FLAGS to set the compiler flags appropriately for the compiler that you have selected through one of TACC's modules. To view the expanded set of options that $TACC_VEC_FLAGS brings in for the NVIDIA compiler, check the Building for Performance section of the Vista User Guide.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)