--- title: 'Intel Compiler Classic' --- [toc] ## Environment Settings{#enviroment} ### Software Version and System Requirements{#version} Version | Module file Name | System B/C | System G | Cloud Systems | Notes --- | --- | --- | --- | --- | --- 2022.3 | intel/2022.3 | + | - | + | Introduced in November 2022 \+ : Available for all users \- : Not available In system B, C and Cloud, the Intel compiler is set by default when you log into the system. The Intel compiler is not available in system G. ```nohighlight $ module list Currently Loaded Modulefiles: x) slurm x) SysB/2022 x) intel/2022.3 x) PrgEnvIntel/2022 ``` <!-- コンパイラのバージョンは、上表に記載のデフォルトのバージョンが設定されています。 Intelコンパイラのバージョンを切り替えたい場合は、PrgEnvIntel がロードされている状態で、以下のようにmoduleコマンドを実行してください。 ```nohighlight $ module switch intel/2022 intel/2019 ``` ログイン時に自動で環境設定を行いたい場合は、ログインシェルの起動ファイルに必要なmoduleコマンドを記述してください。詳細は [環境設定](/config) をご覧ください。 moduleコマンドの詳細は [Modules](/config/modules) をご覧ください。 --> ## How to Compile{#usage} ### Compile Commands{#command} | Language | Command | Executable form | | - | - | - | | C | icc | icc [Option] File Name | | C++ | icpc | icpc [Option] File Name | | Fortran | ifort | ifort [Option] File Name | ### Compile Options{#option} |Option |Purpose| |-|-| |-o FILENAME |Specifies the name of the object file. | |-mcmodel=medium |Enable to use memory in excess of 2 GB.| |-shared-intel |Dynamically link all Intel-provided libraries. | |-fpic |Generates position-independent code.| |-qopenmp |Enable OpenMP directive and compile.| |-parallel | Performs automatic parallelization | |-O0/-O1/-O2/-O3 |Specifies the level of optimization (default is -O2).| |-fast |Optimizes the program for maximum execution speed. -fast option gives the following options.<br>`-ipo, -O3, -no-prec-div, -static, -fp-model fast=2 -xHost `| |-ip |Optimize processing between procedures within a single file. | |-ipo |Optimize processing between procedures among multiple files.| |-qopt-report |Displays information about the performed optimization.| |-xHost|Generates the code corresponded to the most significant instruction set which available in a processor.| |-xCORE-AVX512/-xCORE-AVX2/-xSSE4.2/-xSSE3|IntelGenerates the optimized code corresponded to the specified instruction set, for Intel processor. | #### Options for using more than 2 GB of memory To compile a program that uses more than 2 GB of memory, specify the following options. <br> `-mcmodel=medium -shared-intel` ## Examples of Compiling{#sample} ### Non-parallelized Program{#serial} ```nohighlight $ icc test.c # For C $ icpc test.cpp # For C++ $ ifort test.f90 # For Fortran $ tssrun ./a.out # Execution ``` ### Using Auto-Parallelization{#auto_parallel} ```nohighlight $ ifort -parallel test.f90 $ tssrun --rsc p=1:t=4:c=4 ./a.out # Execute with the number of parallels specified as 4. ``` ### Using OpenMP{#openmp} OpenMP is an open standard for parallelizing programs. You can have the compiler automatically perform parallelization only by writing instructions starting with #pragma omp in the source code and compiling with the given options. To compile the source code with instructions to OpenMP, use the -qopenmp option. ```nohighlight $ icc -qopenmp test.c ``` When executing a compiled program, if you specify the number of parallelisms for t and c with --rsc option, the program will be executed with that number of parallelisms. ```nohighlight $ tssrun --rsc p=1:t=8:c=8 ./a.out # Execute with the number of parallels specified as 8. ``` ## Messages When Compiling{#compile_message} The Intel compiler outputs messages with the following format when there is a program error or information to be notified. ### C/C++{#message_c} ```nohighlight File name (line number): XXX #YYY: Message text Contents of the corresponding line of source code ^ ``` - XXX : Message type(error/warning) - YYY : Serial number of the message - Pointer(^) : The exact location where the error was found in the corresponding line of source code **Output Example** ```nohighlight sample.c(27): warning #175: subscript out of range printf(" %d , %d\n",c[1][0],c[1][10]); ^ ``` ### Fortran{#message_fortran} ```nohighlight File name (line number): XXX #YYY: Message text Contents of the corresponding line of source code --------------^ ``` - XXX : Message type(error/warning) - YYY : Serial number of the message - Pointer(^) : The exact location where the error was found in the corresponding line of source code **Output Example** ```nohighlight sample.f90(26): error #5560: Subscript #2 of the array C has value 20 which is greater than the upper bound of 2 print *, c(1,1),",", c(1,20) -----------------------^ compilation aborted for sample.f90 (code 1) ``` ## Available Libraries{#library} ### MPI Library{#mpi_library} The Intel MPI library is available. Please refer to [Intel MPI Library](/compilers/intelmpi) on how to compile, link and execute MPI programs. ### Numerical calculation library{#numerical_library} When using the Intel compiler, the following numerical calculation libraries are available. Please refer to the individual pages for details on how to use each library. Library | System A | System B | System C | System G | Cloud - | - [MKL Library](/software/mkl) | + | + | + | - | + <!-- [NAGライブラリ](/compilers/nag) | AU [IMSLライブラリ](/compilers/imsl) | AU --> \+ : Available for all users AU : \+ : Available for all users \- : Not available ## Manuals{#manual} - [Intel C++ Compiler Classic Developer Guide and Reference](https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top.html) - [Intel Fortran Compiler Classic and Intel Fortran Compiler Developer Guide and Reference](https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top.html)