{"id":78157,"date":"2014-05-08T14:53:58","date_gmt":"2014-05-08T18:53:58","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=78157"},"modified":"2025-05-02T15:33:46","modified_gmt":"2025-05-02T19:33:46","slug":"compilers","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/programming\/compilers\/","title":{"rendered":"Compilers"},"content":{"rendered":"<p>On the SCC, there are currently four families of compilers: GNU, LLVM, Nvidia (PGI), and Intel. They are used for compiling C, C++, and Fortran codes. Nvidia purchased The Portland Group company, the original authors of the PGI compilers, in 2013.<\/p>\n<p>The GNU compilers are automatically available after logging onto the SCC. On the AlmaLinux 8 operating system the default GNU compiler version is 8.5.0. To switch to a different compiler, use the module command:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load<\/span> intel\/2024.0    <span class=\"comment\"># example - load the Intel compilers<\/span>\r\n<\/code><\/pre>\n<p>If you are compiling software that uses MPI, the best practice is to load the compiler you want to use followed by the matching OpenMPI module:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load<\/span> nvidia-hpc\/2023-23.5    <span class=\"comment\"># example - use the Nvidia compilers with OpenMPI<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load<\/span> openmpi\/4.1.5_nvidia-2023-23.5\r\n<\/code><\/pre>\n<p>The compiler commands and module names for the four compilers are listed in the following table. There is a module for older versions of the PGI compilers called <code>pgi<\/code>, but it is recommended that the <code>nvidia-hpc<\/code> module be used instead for more up-to-date compilers:<\/p>\n<table class=\"research\">\n<tbody>\n<tr>\n<th>Language<\/th>\n<th>Developer<\/th>\n<th>Module Name<\/th>\n<th>Command<\/th>\n<\/tr>\n<tr>\n<td>Fortran 77<\/td>\n<td>GNU<\/td>\n<td>gcc<\/td>\n<td>gfortran<\/td>\n<\/tr>\n<tr>\n<td>Fortran 90\/95\/03<\/td>\n<td>GNU<\/td>\n<td>gcc<\/td>\n<td>gfortran<\/td>\n<\/tr>\n<tr>\n<td>C<\/td>\n<td>GNU<\/td>\n<td>gcc<\/td>\n<td>gcc (cc)<\/td>\n<\/tr>\n<tr>\n<td>C++<\/td>\n<td>GNU<\/td>\n<td>gcc<\/td>\n<td>g++ (c++)<\/td>\n<\/tr>\n<tr>\n<td>Fortran 77<\/td>\n<td>Nvidia\/PGI<\/td>\n<td>nvidia-hpc <em>or<\/em> pgi<\/td>\n<td>pgfortran (pgf77)<\/td>\n<\/tr>\n<tr>\n<td>Fortran 90\/95\/03<\/td>\n<td>Nvidia\/PGI<\/td>\n<td>nvidia-hpc <em>or<\/em> pgi<\/td>\n<td>pgfortran (pgf90, pgf95)<sup><br \/>\n<\/sup><\/td>\n<\/tr>\n<tr>\n<td>C<\/td>\n<td>Nvidia\/PGI<\/td>\n<td>nvidia-hpc <em>or<\/em> pgi<\/td>\n<td>pgcc<\/td>\n<\/tr>\n<tr>\n<td>C++<\/td>\n<td>Nvidia\/PGI<\/td>\n<td>nvidia-hpc <em>or<\/em> pgi<\/td>\n<td>pgc++<\/td>\n<\/tr>\n<tr>\n<td>Fortran 77\/90\/95\/03<\/td>\n<td>Intel<\/td>\n<td>intel<\/td>\n<td>ifort <em>or<\/em> ifx <sup>1<\/sup><\/td>\n<\/tr>\n<tr>\n<td>C<\/td>\n<td>Intel<\/td>\n<td>intel<\/td>\n<td>icc <em>or<\/em> icx <sup>1<\/sup><\/td>\n<\/tr>\n<tr>\n<td>C++<\/td>\n<td>Intel<\/td>\n<td>intel<\/td>\n<td>icpc <em>or<\/em> icpx <sup>1<\/sup><\/td>\n<\/tr>\n<tr>\n<td>C<\/td>\n<td>LLVM<\/td>\n<td>llvm<\/td>\n<td>clang<\/td>\n<\/tr>\n<tr>\n<td>C++<\/td>\n<td>LLVM<\/td>\n<td>llvm<\/td>\n<td>clang++<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><sup><strong>1<\/strong><\/sup> The Intel compiler modules older than <code>intel\/2023.1<\/code> provide the icc, icpc, and ifort compilers. The <code>intel\/2023.1<\/code> module also provides a new family of compilers: icx, icpx, and ifx.\u00a0 Intel compiler modules installed <strong>after<\/strong> <code>intel\/2023.1<\/code> will only provide these new compilers as the &#8220;classic&#8221; ones (icc, icpc, ifort) have been retired by Intel.<\/p>\n<p>For all of the compilers see <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/programming\/multiprocessor\/\">Multiprocessor Programming<\/a> documentation for compiling OpenMP and MPI codes.<\/p>\n<h2>GNU and LLVM compilers<\/h2>\n<p>Here are some examples of commonly used flags applicable to <code>gcc, g++, and gfortran<\/code> compilers. The LLVM clang and clang++ compilers use nearly identical flags to the GNU compilers:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load gcc\/12.2.0 <\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">man<\/span> gcc                 <span class=\"comment\"># gcc manual (help) page<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">gcc<\/span> --help              <span class=\"comment\"># concise options help file<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">gcc<\/span> -o <span class=\"placeholder\">file-name<\/span> ...    <span class=\"comment\"># executable name<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">gcc<\/span> -On ...             <span class=\"comment\"># code optimization; n=0,1,2,3<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">gcc<\/span> -g ...              <span class=\"comment\"># debug mode<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">gcc<\/span> -Warray-bounds ...  <span class=\"comment\"># arrays bound checking<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">gcc<\/span> -pg ...             <span class=\"comment\"># profiling<\/span>\r\n<\/code><\/pre>\n<h2>Intel compilers<\/h2>\n<p>Here are some examples of commonly used flags applicable to <code>icc, icpc, ifort<\/code> compilers:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load intel\/2024.0 <\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">man<\/span> icx <span class=\"comment\"># icxmanual page<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">icx<\/span> -help            <span class=\"comment\"># concise options help file<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">icx<\/span> -o <span class=\"placeholder\">file-name<\/span> ... <span class=\"comment\"># executable name<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">icx<\/span> -On ...          <span class=\"comment\"># code optimization; n=0,1,2,3,4,fast; recommends 3<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">icx<\/span> -fast ...        <span class=\"comment\"># accelerate the program<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">icx<\/span> -g ...           <span class=\"comment\"># debug mode<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">icx<\/span> -p ...           <span class=\"comment\"># profiling (-pg is also valid)<\/span><\/code><\/pre>\n<h2>Nvidia\/PGI compilers<\/h2>\n<p>Here are some examples of commonly used flags applicable to <code>pgcc, pgc++, pgfortran<\/code> compilers:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1$<\/span> <span class=\"command\">module load nvidia-hpc\/2023-23.5 <\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">man<\/span> pgcc              <span class=\"comment\"># pgfortran manual (help) page<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pgcc<\/span> -help            <span class=\"comment\"># concise options help file<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pgcc<\/span> -o <span class=\"placeholder\">file-name<\/span> ... <span class=\"comment\"># executable name<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pgcc<\/span> -On ...          <span class=\"comment\"># code optimization; n=0,1,2,3,4,fast; recommends 3<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pgcc<\/span> -g ...           <span class=\"comment\"># debug mode<\/span>\r\n<span class=\"prompt\">scc1$<\/span> <span class=\"command\">pgcc<\/span> -pg ...          <span class=\"comment\"># profiling<\/span>\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On the SCC, there are currently four families of compilers: GNU, LLVM, Nvidia (PGI), and Intel. They are used for compiling C, C++, and Fortran codes. Nvidia purchased The Portland Group company, the original authors of the PGI compilers, in 2013. The GNU compilers are automatically available after logging onto the SCC. On the AlmaLinux&#8230;<\/p>\n","protected":false},"author":1692,"featured_media":0,"parent":64953,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/78157"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=78157"}],"version-history":[{"count":50,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/78157\/revisions"}],"predecessor-version":[{"id":157142,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/78157\/revisions\/157142"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/64953"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=78157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}