--- title: 'NVIDIA HPC SDK Compiler' taxonomy: category: - docs external_links: process: true no_follow: true target: _blank mode: active published: true --- [toc] ## Environment Settings{#environment} ### Software Version and System Requirements{#version} Version | Module file Name | SystemA | System B/C | System G | Cloud System | Notes --- | --- | --- | --- | --- | --- | --- 23.9 (default) | nvhpc/23.9 | - | - | + | - | Introduced in April 2024 23.5 | nvhpc/23.5 | - | - | + | - | Introduced in August 2023 22.9 | nvhpc/22.9 | - | - | + | - | Introduced in January 2023 \+ : Available for all users \- : Not available In the system G, the NVIDIA HPC SDK compiler is set by default when you log into the system. The NVIDIA HPC SDK compiler is not available in the system B, C and Cloud. If you want to set the environment settings automatically at login, write the necessary module commands in the startup file of the login shell. Please refer to [Setup of the login node](/config) for details. Please refer to [Modules](/config/modules) for details on the module command. #### cuda{#cuda} Version | Module file Name | SystemA | System B/C | System G | Cloud System | Notes --- | --- | --- | --- | --- | --- 12.2.2 (default) | cuda/12.2.2 | - | -| + | - | Introduced in April 2024 12.1.1 | cuda/12.1.1 | - | -| + | - | Introduced in August 2023 11.7.1 | cuda/11.7.1 | - | -| + | - | Introduced in January 2023 9.2 | cuda/9.2 | - | - | + | - | Introduced in January 2023 \+ : Available for all users \- : Not available When you download the module file of the NVIDIA HPC SDK compiler, cuda is loaded at the same time. The default version of cuda is 11.7, however if you want to switch the versions, execute the module command as follows while PrgEnvNvidia is loaded. ```nohighlight $ module load cuda/9.2 ``` ## How to Compile{#usage} ### Compile Commands{#command} | Language | Command | Executable form | - | - | - | Fortran | nvfortran | nvfortran [Option] File Name | C | nvc | nvc [Option] File Name | C++ | nvc++ | nvc++ [Option] File Name ### Compile Options{#option} - Main options (parallelization, optimization, etc.) | Option | Purpose | --- | --- | -o FILENAME | Specifies the name of the object file. | -mcmodel=medium | Enable to use memory in excess of 2 GB. | -mp | Enable OpenMP directive and compile. | -Mconcur | Performs automatic parallelization. | -O0/-O1/-O2/-O3/-O4 | Specifies the level of optimization. | -fast | Enable general optimization features. | -Mipa=fast | Optimizes the analysis process between procedures. **(NOTE) ** No longer available in the current version. - Message output and debugging options |Option |Purpose| |-|-| |-Mlist |Create a listing file.| |-Minform=inform |Displays all error messages.| |-Minfo[=OPTION]|Displays information on standard error output.<br>Specify the information to be displayed with option.| |-Mneginfo[=OPTION]|Displays information about optimizations that were not performed.| - Fortran language-specific options |Option |Purpose| |-|-| |-Mfixed |Specifies that the program is written in a fixed format.| |-Mfree |Specifies that the program is written in free form.| |-Mstandard | Warns against non-ANSI compliant syntax.| |-Mdclchk |Warns against implicit type declarations.| |-C | Detects out-of-area references to arrays at program execution. | - GPU-related options |Option |Purpose| | --- | --- | | -gpu | Specify settings related to GPU. Use in conjunction with -acc, -cuda, -mp and -stdpar options.<br>(e.g.)-gpu=cc80 -acc<br>※cc means [compute capability](https://developer.nvidia.com/cuda-gpus). The GPU in system G is A100, so specify cc80 for cc.| | -acc | Enable OpenACC. | | -cuda | Enable CUDA. | | -Minfo=accel | Output GPU-related compilation information. | ## Examples of Compiling{#sample} ### Non-parallelized Program{#serial} ```nohighlight $ nvfortran test.f90 # For Fortran $ nvc test.c # For C $ nvc++ test.cpp # For C++ $ tssrun ./a.out # Execution ``` ### Using Auto-Parallelization{#auto_parallel} ```nohighlight $ nvfortran -Mconcur 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 (C/C++) or $omp and compile with the given options. To compile the source code with instructions to OpenMP, use the -mp option. ```nohighlight $ nvc -mp 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. ``` ### Using OpenACC{#openacc} OpenACC is an open standard for parallelizing programs. You can generate executable code that will run on a GPU only by writing instructions starting with #pragma acc(C/C++) or $acc and compile with the given options. To compile the source code with instructions to OpenACC, use the -acc option. ```nohighlight $ nvfortran -acc test.f90 ``` ## Available Libraries{#library} ### MPI Library{#mpi_library} The Open MPI library is available. Please refer to [Open MPI Library](/compilers/openmpi) on how to compile, link and execute MPI programs. ## Manuals{#manual} ### Version 22.9 - [NVIDIA HPC Compilers User's Guide](https://docs.nvidia.com/hpc-sdk/archive/22.9/compilers/hpc-compilers-user-guide/index.html) - [NVIDIA HPC Compilers Reference Guide](https://docs.nvidia.com/hpc-sdk/archive/22.9/compilers/hpc-compilers-ref-guide/index.html)