Fortran, C and C++ compilers produced by the GNU Project.
GNU compilers are available on all our clusters. These are the versions currently available:
Version | Owens | Pitzer | Ascend | Notes |
---|---|---|---|---|
4.8.5 | X# | X# | **See note below. | |
4.9.1 | ||||
5.2.0 | ||||
6.1.0 | X | |||
6.3.0 | X | |||
7.3.0 | X | X | ||
8.1.0 | X | |||
8.4.0 | X | X | The variant supporting OpenMP and OpenACC offload is available. See the GPU offloading section below |
|
9.1.0 | X* | X* | X | |
10.3.0 | X | X | X | |
11.2.0 | X | X | X* |
You can use module spider gnu
to view available modules for a given machine. Feel free to contact OSC Help if you need other versions for your work.
To find out what version of gcc you are using, type gcc --version
.
The GNU compilers are available to all OSC users. If you have any questions, please contact OSC Help.
https://www.gnu.org/software/gcc/, Open source
module load gnu
. The default version will be loaded. To select a particular GNU version, use module load gnu/version
. For example, use module load gnu/4.8.5
to load GNU 4.8.5.Once the module is loaded, follow the guides below for compile commands:
Language | non-mpi | mpi |
---|---|---|
Fortran 90 or 95 | gfortran |
mpif90 |
Fortran 77 | gfortran |
mpif77 |
c | gcc |
mpicc |
c++ | g++ |
mpicxx |
The GNU compilers recognize the following command line options :
Compiler Option | Purpose |
---|---|
-fopenmp |
Enables compiler recognition of OpenMP directives (except mpif77) |
-o FILENAME |
Specifies the name of the object file |
-O0 or no -O option |
Disable optimization |
-O1 or -O |
Ligh optimization |
-O2 |
Heavy optimization |
-O3 |
Most expensive optimization (Recommended) |
There are numerous flags that can be used. For more information run man <compiler binary name>
.
When you log into owens.osc.edu you are actually logged into a linux box referred to as the login node. To gain access to the mutiple processors in the computing environment, you must submit your job to the batch system for execution. Batch jobs can request mutiple nodes/cores and compute time up to the limits of the OSC systems. Refer to Queues and Reservations and Batch Limit Rules for more info.
sinteractive -A <project-account> -N 1 -n 28 -l -t 1:00:00which gives you 1 node and 28 cores (
-N 1 -n 28
), with 1 hour (-t 1:00:00
). You may adjust the numbers per your need.
hello.c
and the output file named hello_results
. job.txt
) for a serial run:
#!/bin/bash #SBATCH --time=1:00:00 #SBATCH --nodes=1 --ntasks-per-node=28 #SBATCH --job-name jobname #SBATCH --account=<project-account> module load gnu cp hello.c $TMPDIR cd $TMPDIR gcc -O3 hello.c -o hello ./hello > hello_results cp hello_results $SLURM_SUBMIT_DIR
In order to run it via the batch system, submit the job.txt
file with the following command:
sbatch job.txt
job.txt
) for a parallel run:
#!/bin/bash #SBATCH --time=1:00:00 #SBATCH --nodes=2 --ntasks-per-node=28 #SBATCH --job-name jobname #SBATCH --account=<project-account> module load gnu mpicc -O3 hello.c -o hello cp hello $TMPDIR cd $TMPDIR mpiexec ./hello > hello_results cp hello_results $SLURM_SUBMIT_DIR
module load gnu
. The default version will be loaded. To select a particular GNU version, use module load gnu/version
. For example, use module load gnu/8.1.0
to load GNU 8.1.0.Once the module is loaded, follow the guides below for compile commands:
LANGUAGE | NON-MPI | MPI |
---|---|---|
Fortran 90 or 95 | gfortran |
mpif90 |
Fortran 77 | gfortran |
mpif77 |
c | gcc |
mpicc |
c++ | g++ |
mpicxx |
The GNU compilers recognize the following command line options :
COMPILER OPTION | PURPOSE |
---|---|
-fopenmp |
Enables compiler recognition of OpenMP directives (except mpif77) |
-o FILENAME |
Specifies the name of the object file |
-O0 or no -O option |
Disable optimization |
-O1 or -O |
Ligh optimization |
-O2 |
Heavy optimization |
-O3 |
Most expensive optimization (Recommended) |
There are numerous flags that can be used. For more information run man <compiler binary name>
.
GNU compiler versions 10+ may have Fortran compiler errors like
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/REAL(8))
that result in a error response during configuration
configure: error: The Fortran compiler gfortran will not compile files that call the same routine with arguments of different types.
This can be caused when codes are using types that don't match the subroutine arguement types. The mismatches are now reject with an error to warn about future errors that may occur. It is bypassable by appending the -fallow-argument-mismatch
arguement while calling gfortran
.
GNU compiler versions 10+ may have C compiler errors like
/.libs/libmca_mtl_psm.a(mtl_psm_component.o): multiple definition of `mca_mtl_psm_component'
This is a common mistake in C is omitting extern when declaring a global variable in a header file. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common
, which means a linker error will now be reported. It is bypassable by appending the -fcommon
to compilation flags.