| | 1 | [[PageOutline]] |
| | 2 | = C/C++/Fortran Compilers = |
| | 3 | GNU and Intel compilers are available on Cypress. |
| | 4 | |
| | 5 | == GNU Compiler == |
| | 6 | The default compiler is GNU compiler, version 4.4.7. To use a newer version, for example, |
| | 7 | {{{ |
| | 8 | [tulaneID@cypress1 ~]$ module load gcc/4.7.4 |
| | 9 | }}} |
| | 10 | === Compilation Commands === |
| | 11 | ==== C ==== |
| | 12 | For example. the command below will make an executable from the source code 'hello.c'. |
| | 13 | {{{ |
| | 14 | [tulaneID@cypress1 ~]$ gcc hello.c |
| | 15 | }}} |
| | 16 | The default executable file name will be 'a.out'. If you want to specify the executable file name, |
| | 17 | {{{ |
| | 18 | [tulaneID@cypress1 ~]$ gcc -o hello hello.c |
| | 19 | }}} |
| | 20 | Now 'hello' is the executable file name. |
| | 21 | |
| | 22 | There are many option for the compiler command. You can see those by, |
| | 23 | {{{ |
| | 24 | [tulaneID@cypress1 ~]$ man gcc |
| | 25 | }}} |
| | 26 | For example, to set optimization level 3 and optimize for Xeon CPU, |
| | 27 | {{{ |
| | 28 | [tulaneID@cypress1 ~]$ gcc -O3 -mavx -o hello hello.c |
| | 29 | }}} |
| | 30 | |
| | 31 | ==== C++ ==== |
| | 32 | For example. the command below will make an executable from the source code 'hello.cpp'. |
| | 33 | {{{ |
| | 34 | [tulaneID@cypress1 ~]$ g++ hello.cpp |
| | 35 | }}} |
| | 36 | The default executable file name will be 'a.out'. |
| | 37 | The basic options are same with 'gcc' command. You can see those by, |
| | 38 | {{{ |
| | 39 | [tulaneID@cypress1 ~]$ man g++ |
| | 40 | }}} |
| | 41 | |
| | 42 | ==== Fortran ==== |
| | 43 | For example. the command below will make an executable from the source code 'hello.f90'. |
| | 44 | {{{ |
| | 45 | [tulaneID@cypress1 ~]$ gfortran hello.f90 |
| | 46 | }}} |
| | 47 | The basic options are same with 'gcc' command. You can see those by, |
| | 48 | {{{ |
| | 49 | [tulaneID@cypress1 ~]$ man gfortran |
| | 50 | }}} |
| | 51 | |
| | 52 | == Intel Compiler == |
| | 53 | To use Intel Compiler, |
| | 54 | {{{ |
| | 55 | [tulaneID@cypress1 ~]$ module load intel-psxe |
| | 56 | }}} |
| | 57 | === Compilation Commands === |
| | 58 | ==== C ==== |
| | 59 | For example. the command below will make an executable from the source code 'hello.c'. |
| | 60 | {{{ |
| | 61 | [tulaneID@cypress1 ~]$ icc hello.c |
| | 62 | }}} |
| | 63 | The default executable file name will be 'a.out'. If you want to specify the executable file name, |
| | 64 | {{{ |
| | 65 | [tulaneID@cypress1 ~]$ icc -o hello hello.c |
| | 66 | }}} |
| | 67 | Now 'hello' is the executable file name. |
| | 68 | |
| | 69 | There are many option for the compiler command. You can see those by, |
| | 70 | {{{ |
| | 71 | [tulaneID@cypress1 ~]$ man icc |
| | 72 | }}} |
| | 73 | For example, to set optimization level 3 and optimize for Xeon CPU, |
| | 74 | {{{ |
| | 75 | [tulaneID@cypress1 ~]$ icc -O3 -xavx -o hello hello.c |
| | 76 | }}} |
| | 77 | |
| | 78 | ==== C++ ==== |
| | 79 | For example. the command below will make an executable from the source code 'hello.cpp'. |
| | 80 | {{{ |
| | 81 | [tulaneID@cypress1 ~]$ icpc hello.cpp |
| | 82 | }}} |
| | 83 | The default executable file name will be 'a.out'. |
| | 84 | The basic options are same with 'icc' command. You can see those by, |
| | 85 | {{{ |
| | 86 | [tulaneID@cypress1 ~]$ man icpc |
| | 87 | }}} |
| | 88 | |
| | 89 | ==== Fortran ==== |
| | 90 | For example. the command below will make an executable from the source code 'hello.f90'. |
| | 91 | {{{ |
| | 92 | [tulaneID@cypress1 ~]$ ifort hello.f90 |
| | 93 | }}} |
| | 94 | The basic options are same with 'icc' command. You can see those by, |
| | 95 | {{{ |
| | 96 | [tulaneID@cypress1 ~]$ man ifort |
| | 97 | }}} |