Difference between revisions of "Compiler"
m |
m |
||
Line 35: | Line 35: | ||
== Intel Compiler == | == Intel Compiler == | ||
− | The Intel Compiler (icc) is a compiler written by Intel and optimized to take utilize the features of their microprocessors to their fullest extend, sometimes resulting in a significant performance improvement. It is usually called with: | + | The Intel Compiler (icc) is a compiler written by Intel and optimized to take utilize the features of their microprocessors to their fullest extend, sometimes resulting in a significant performance improvement. It is usually called with (maybe you have to load the corresponding [[Modules|module]]): |
$ icc [files] [options] | $ icc [files] [options] | ||
== Gnu Compiler Collection == | == Gnu Compiler Collection == | ||
The Gnu Compiler Collection (gcc) is a free collection of compilers, originally written for the GNU operating system and now available on all major platforms. | The Gnu Compiler Collection (gcc) is a free collection of compilers, originally written for the GNU operating system and now available on all major platforms. | ||
− | It is usually called with: | + | It is usually called with (maybe you have to load the corresponding [[Modules|module]]): |
$ gcc [files] [options] | $ gcc [files] [options] | ||
Revision as of 08:54, 5 April 2018
A Compiler is a computer program translating code from one language to another.
General
When people write programs (code), the usually employ a text editor and a high level language like C/C++ or Fotran, to produce a code that looks somewhat like this:
#include<stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
This is easy to write, understand and maintain for humans. However, since a computer only understands 0s and 1s, this can not be executed directly. A Compiler tranlates this code into a binary file, which can be executed.
Fostering the advend of higher level programming languages, this significantly lowers the entry barrier into programming, and also facillitates the creation of more complex programs which can not (easily) be written just in terms of 0s and 1s by humans.
Basic Usage
You usually use a compiler by calling it from the shell:
$ cc hello_world.c -o hello_world.o
where you feed it the file hello_world.c and let it create the binary output file hello_world.o, which you can then execute by calling
$ hello_world.o
producing the desired output
Hello, World!
In most compilers there are optimization flags like -O2 (commonly ranging from 0 to 3), where the compiler tries to figure out, what your program is doing and whether there is more efficient way of doing that. This should be used, when you start finishing development and start using your programs productively, so that it runs as fast as possible.
When compiling an application (target) from multiple files, one might need to use another program called linker to bind the different parts together or even employ a build system like Make or CMake to simplify/automate the process of compiling and linking more complex projects.
Intel Compiler
The Intel Compiler (icc) is a compiler written by Intel and optimized to take utilize the features of their microprocessors to their fullest extend, sometimes resulting in a significant performance improvement. It is usually called with (maybe you have to load the corresponding module):
$ icc [files] [options]
Gnu Compiler Collection
The Gnu Compiler Collection (gcc) is a free collection of compilers, originally written for the GNU operating system and now available on all major platforms. It is usually called with (maybe you have to load the corresponding module):
$ gcc [files] [options]
LLVM
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.