17-11-2012, 02:24 PM
Basics for High-Performance Computing
Basics for High-Performance.ppt (Size: 676 KB / Downloads: 26)
What we will cover
Introductory session, we cover the basics
data types, arrays, control statements and functions
paradigms, good practice, writing efficient code
IDE's, multicore/parallel programming tools
Why learn C
Been around for over 30 years (lots of code to learn from, plenty more to use)
programming language of the Unix OS
Higher level than assembly and fortran 77, lower level than C++
C compilers are on all architectures, from supercomputers to PIC MCU's
It is a common language when all the team knows C it is a good idea to develop the project in C
It is good to understand the C programming language design
Data Types
All variables must be defined in C.
data types define variables before they are used
The definition of a variable will assign storage for the variable and define the type of data that will be held in the location
Has the form:
typename variablename;
Examples:
int myInteger;
char myCharacter;
Constructing Logic
Use in conditional statements (and loops)
Relational operators ( <, >, <=, >= ) Equality operators ( ==, != )
if (value1 >= value2)
Logical operators "&&" (and), "|" (or), "!" (not)
if (value1 > value2 && value3)
Order of evaluation
depending on the operator precedence is not a good idea in any language, use parenthesis
if((value1 > value2) && value3)