<?xml version="1.0"?>
<!DOCTYPE flagsdescription SYSTEM
       "http://www.spec.org/dtd/cpuflags2.dtd">

<!-- This file defines flags for use with the AMD AOMP Linux Compilers -->
<flagsdescription>
<filename>amd2021_flags</filename>
<title>AMD Compilers.  Optimization, Compiler, and Other flags for use by SPEChpc</title>

<!-- Style -->

<style>
<![CDATA[
body {
  margin:  1em;
  border:  0;
  padding: 0;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: 100% 0;
  color:      black;
  font-family: "Times Roman", times, serif;
}

div.flagDesc {
  clear: both;
  color: black;
  background-color: #d6e7f7;
  border: 1px solid #blue;
  margin: 0 auto;
  width: 90%;
}

ul.flagTOC {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

ul.flagTOC > li {
  border: 1px solid #d6e7f7;
  background: #d6e7f7;
}

ul.flagTOC > li > a:link {
   color: blue;
}

ul.SubMenu li {
  border: 1px solid #d6e7f7; /* rgb(211, 211, 211); */
}

ul.SubMenu {
  border: 1px solid blue;
  background-color: #d6e7f7;
}
]]>
</style>

<!-- Header -->

<header>
<![CDATA[
<div id='banner'>
<h2><b>Compilers: AMD Fortran/C/C++</b></h2>
<h2><b>Operating systems: Linux</b></h2>
</div>
]]>
</header>

<!-- Compilers -->

<flag name='mpicxx' class='compiler' regexp="mpicxx">
<![CDATA[
<p>The OpenMPI C++ driver configured for use with the AOMP C++ compiler (clang++).</p>
 ]]>
<example>mpic++</example>
</flag>

<flag name='mpicplusplus' class='compiler' regexp="mpic\+\+">
<![CDATA[
<p>The OpenMPI C++ driver configured for use with the AOMP C++ compiler (clang++).</p>
 ]]>
<example>mpic++</example>
</flag>

<flag name='mpicc' class='compiler' regexp="mpicc" >
<![CDATA[
 <p>The OpenMPI C driver configured for use with the AOMP C compiler (clang).</p>
 ]]>
<example>mpicc</example>
</flag>

<flag name='mpif90' class='compiler' regexp="mpif90\b" >
<![CDATA[
 <p>The OpenMPI Fortran driver configured for use with the AOMP Fortran compiler (flang).</p>
 ]]>
<example>mpif90</example>
</flag>

<!-- Portability, Other Flags. -->

<flag name="w" class="other"
 compilers="mpicc, mpicxx, mpif90" regexp="-w\b">
<![CDATA[
 <p>Disable warning messages.</p>
]]>
<example>-w</example>
</flag>

<flag name="O0" class="optimization"
 compilers="mpicc, mpicxx,mpif90"
 regexp="-O0\b">
<![CDATA[
 <p>A basic block is generated for each C statement.  No scheduling is done
between statements.  No global optimizations are performed.</p>
]]>
<example>-O0</example>
</flag>

<flag name="O1" class="optimization"
 compilers="mpicc, mpicxx,mpif90"
 regexp="-O1\b">
<![CDATA[
 <p>Level-one optimization specifies local optimization (-O1). 
]]>
<example>-O1</example>
</flag>

<flag name="O2" class="optimization"
 compilers="mpicc, mpicxx,mpif90"
 regexp="-O2\b">
<![CDATA[
 <p>
Level-two optimization (-O2 or -O) specifies global optimization.
]]>
<include flag="O1" />
<example>-O2</example>
</flag>

<flag name="O3" class="optimization"
 compilers="mpicc, mpicxx,mpif90"
 regexp="-O3\b">
<![CDATA[
 <p>All level 1 and 2 optimizations are performed.
In addition, this level enables more aggressive code hoisting and scalar replacement optimizations that may or may not be profitable.</p>
]]>
<include flag="O2" />
<example>-O3</example>
</flag>

<flag name="aocc-march"
    class="optimization"
    regexp="-march=(i486|x86-64|native|znver1|znver2|znver3|znver4|auto)(?=\s|$)"
    >
    <example>-march=znver1</example>
    <![CDATA[
    <p>Specify that Clang should generate code for a specific processor family member and later. For example, if you specify
        <kbd>-march=znver1</kbd>, the compiler is allowed to generate instructions that are valid on AMD Zen processors, but
        which may not exist on earlier products.</p>
    ]]>
</flag>


<flag name="Ofast" class="optimization"
 regexp="-Ofast\b">
<![CDATA[
 <p>All level 1 and 2 optimizations are performed.
In addition, this level enables more aggressive code hoisting and scalar replacement optimizations that may or may not be profitable.</p>
]]>
<include flag="O3" />
<example>-Ofast</example>
</flag>


<flag name="fast-math" class="optimization"
 regexp="-ffast-math\b">
<![CDATA[
 <p>Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard-compliant programs.
In addition, this level enables more aggressive code hoisting and scalar replacement optimizations that may or may not be profitable.</p>
]]>
<include flag="O3" />
<example>-O3</example>
</flag>

<flag name="flto" class="optimization"
 regexp="-flto\b">
<![CDATA[
<p>Generate output files in LLVM formats suitable for link time optimization.</p>
]]>
<include flag="O3" />
<example>-O3</example>
</flag>

<flag name="fopenmp" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-fopenmp\b">
<![CDATA[
<p>Enable OpenMP compilation for hpc2021.</p>
]]>
</flag>

<flag name="DSPEC_OPENMP" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-DSPEC_OPENMP\b">
<![CDATA[
<p>Enable OPENMP programming model for hpc2021.</p>
]]>
</flag>

<flag name="DSPEC_OPENMP_TARGET" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-DSPEC_OPENMP_TARGET\b">
<![CDATA[
<p>Enable OPENMP Target Offload programming model for hpc2021.</p>
]]>
</flag>

<flag name="DMPICH_IGNORE_CXX_SEEK" class="portability"
 regexp="-DMPICH_IGNORE_CXX_SEEK\b">
<![CDATA[
<p>macro at compilation stage to catastrophic error: "SEEK_SET is #defined but must not be for the C++ binding of MPI" when compiling C++ MPI application</p>
]]>
</flag>

<flag name="DSPEC_USE_MPIFH" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-DSPEC_USE_MPIFH\b">
<![CDATA[
<p>Enable using textual F90 include instead of modules for MPI in hpc2021.</p>
]]>
</flag>

<flag name="targets" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-targets=(\S+)(?=\s|$)\b">
<![CDATA[
<p>Select target to compile for.</p>
]]>
<example>-targets=amdgcn-amd-amdhsa</example>
</flag>

<flag name="XopenmpTarget" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-Xopenmp-target=(\S+)(?=\s|$)\b">
<![CDATA[
<p>Select the openmp target to compile for.</p>
]]>
<example>-Xopenmp-target=amdgcn-amd-amdhsa</example>
</flag>

<flag name="March" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-march=(\S+)(?=\s|$)\b">
<![CDATA[
<p>Select the specific target architecture to compile for.</p>
]]>
<example>-march=gfx900</example>
</flag>

<flag name="Mcpu" class="optimization"
 compilers="mpicc, mpicxx, mpif90"
 regexp="-mcpu=(\S+)(?=\s|$)\b">
<![CDATA[
<p>Select the specific target architecture to compile for.</p>
]]>
<example>-mcpu=x86</example>
</flag>

<flag name="lamdlibm" class="optimization" regexp="-lamdlibm">
<![CDATA[ <p> AMD LibM is a software library containing a collection of basic math functions optimized for x86-64 processor-based machines. It provides many routines from the list of standard C99 math functions. Applications can link into AMD LibM library and invoke math functions instead of compiler's math functions for better accuracy and performance. </p> ]]>
</flag>

<flag name="F-lflang"
    class="optimization"
    >
    <example>-lflang</example>
    <![CDATA[
    <p>Instructs the compiler to link with flang Fortran runtime libraries.</p>
    ]]>
</flag>

<flag name="ljemalloc"
   regexp="-l\s*jemalloc"
   class="optimization">
   Link with libjemalloc, a fast, arena-based memory allocator.
</flag>

<flag name="F-unroll-loops" class="optimization" regexp="-funroll-loops">
<![CDATA[ <p> Instructs the compiler to unroll the loops wherever possible. </p> ]]>
</flag>

<flag name="F-Wno-return-type"
   class="other">
   <![CDATA[<p>
      Do not warn about functions defined with a return type that defaults to "int" or which return something other than what they were declared to.
   </p>]]>
</flag>


</flagsdescription>
