Compiling Codes On Dozer

Home

Compiling C/C++/Fortran Program using GNU Compilers

gcc -O $PWD/source_code.c -o $PWD/exec_code                                       (C code)

gcc -O -fopenmp $PWD/source_code.c -o $PWD/exec_code                       (C and openMPcode)

g++ -O $PWD/source_code.cpp -o $PWD/exec_code                                  (C++ code)

g++ -O -fopenmp $PWD/source_code.cpp -o $PWD/exec_code                  (C++  and openMP code)

gfortran -O $PWD/source_code.f90 -o $PWD/exec_code                            (Fortran code)

gfortran -O -fopenmp $PWD/source_code.f90 -o $PWD/exec_code            (Fortran and openMP code)

Compiling CUDA Codes for Nvidia GPU

nvcc $PWD/source_code.cu -o $PWD/exe_code                                          (CUDA code)

 

Compiling options:

-o <file>: place the output into <file>. If this option is omitted, the compiler will create executable program named a.out in working directory.

$PWD: current path.

-O: compile program with optimization

-fopenmp: Used for compiling openmp code on GNU Compilers