wiki:cypress/CompilerUsage

C/C++/Fortran Compilers

GNU and Intel compilers are available on Cypress.

GNU Compiler

The default compiler is GNU compiler, version 4.4.7. To use a newer version, for example,

[tulaneID@cypress1 ~]$ module load gcc/4.7.4

Compilation Commands

C

For example. the command below will make an executable from the source code 'hello.c'.

[tulaneID@cypress1 ~]$ gcc hello.c

The default executable file name will be 'a.out'. If you want to specify the executable file name,

[tulaneID@cypress1 ~]$ gcc -o hello hello.c

Now 'hello' is the executable file name.

There are many option for the compiler command. You can see those by,

[tulaneID@cypress1 ~]$ man gcc

For example, to set optimization level 3 and optimize for Xeon CPU,

[tulaneID@cypress1 ~]$ gcc -O3 -mavx -o hello hello.c

C++

For example. the command below will make an executable from the source code 'hello.cpp'.

[tulaneID@cypress1 ~]$ g++ hello.cpp

The default executable file name will be 'a.out'. The basic options are same with 'gcc' command. You can see those by,

[tulaneID@cypress1 ~]$ man g++

Fortran

For example. the command below will make an executable from the source code 'hello.f90'.

[tulaneID@cypress1 ~]$ gfortran hello.f90

The basic options are same with 'gcc' command. You can see those by,

[tulaneID@cypress1 ~]$ man gfortran

Intel Compiler

To use Intel Compiler,

[tulaneID@cypress1 ~]$ module load intel-psxe

Compilation Commands

C

For example. the command below will make an executable from the source code 'hello.c'.

[tulaneID@cypress1 ~]$ icc hello.c

The default executable file name will be 'a.out'. If you want to specify the executable file name,

[tulaneID@cypress1 ~]$ icc -o hello hello.c

Now 'hello' is the executable file name.

There are many option for the compiler command. You can see those by,

[tulaneID@cypress1 ~]$ man icc

For example, to set optimization level 3 and optimize for Xeon CPU,

[tulaneID@cypress1 ~]$ icc -O3 -xavx -o hello hello.c

C++

For example. the command below will make an executable from the source code 'hello.cpp'.

[tulaneID@cypress1 ~]$ icpc hello.cpp

The default executable file name will be 'a.out'. The basic options are same with 'icc' command. You can see those by,

[tulaneID@cypress1 ~]$ man icpc

Fortran

For example. the command below will make an executable from the source code 'hello.f90'.

[tulaneID@cypress1 ~]$ ifort hello.f90

The basic options are same with 'icc' command. You can see those by,

[tulaneID@cypress1 ~]$ man ifort
Last modified 8 years ago Last modified on 08/22/16 14:35:47
Note: See TracWiki for help on using the wiki.