Compiling Codes On Heracles Cluster

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 / 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++ / openMP)

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

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

    Compiling C/C++/Fortran Codes using Intel Compiler

icx  $PWD/source_code.c -o $PWD/exe_code                                             (C code)

icx -qopenmp $PWD/source_code.c -o $PWD/exe_code                             (C / openMP)

icpx  $PWD/source_code.cpp -o $PWD/exe_code                                       (C++ code)

icpx -qopenmp $PWD/source_code.cpp -o $PWD/exe_code                       (C++/openMP)

ifx  $PWD/source_code.f90 -o $PWD/exe_code                                          (Fortran code)

ifx -qopenmp $PWD/source_code.f90 -o $PWD/exe_code                          (Fortran/ openMP)

    Compiling CUDA Codes for Nvidia GPU

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

Compiling MPI Codes using Intel Compiler

    Source the setvars.sh script to set the proper environment variables for the Intel MPI Library

    source /opt/intel/oneapi/setvars.sh

Check the Intel MPI Compiler Commands

mpiicx $PWD/myprog.c -o $PWD/myprog                           (C code)

 

mpiicpx $PWD/myprog.cpp -o $PWD/myprog                     (C++ code)

 

mpiicpx -qopenmp $PWD/myprog.cpp -o $PWD/myprog    (C++ /openMP)

Compiling options: