Changes between Initial Version and Version 1 of cypress/Programming/Cexamples


Ignore:
Timestamp:
05/14/15 14:14:19 (10 years ago)
Author:
cmaggio
Comment:

migrated content from ccs wiki and edited for cypress

Legend:

Unmodified
Added
Removed
Modified
  • cypress/Programming/Cexamples

    v1 v1  
     1= C Codes =
     2
     3== Hello World ==
     4{{{
     5/* hello.c: display a message on the screen */
     6 
     7#include <stdio.h>
     8 
     9int main(){
     10  printf("hello, C world\n");
     11  return 0;
     12}
     13
     14}}}
     15* Text between /* and */ are comments.
     16* '''#include <stdio.h>''' to load the header file.
     17* There are many header files in the standard C library. http://en.wikipedia.org/wiki/C_standard_library
     18* Program always begins with '''main()''' function.
     19* '''main()''' returns a integer.
     20
     21=== Compile with GNU C ===
     22{{{[tulaneID@cypress1 ~]$ gcc hello.c}}}
     23
     24=== Compile with Intel C ===
     25{{{[tulaneID@cypress1 ~]$ icc hello.c}}}
     26
     27== Links for Tutorial ==
     28* [[http://en.wikibooks.org/wiki/C_Programming | wikibooks ]]
     29
     30== Examples of Jobscript ==
     31
     32{{{#!sh
     33#!/bin/bash
     34#SBATCH --job-name=HelloC
     35#SBATCH --qos=normal         
     36#SBATCH --time=0-00:10:00     ### Wall clock time limit in Days-HH:MM:SS
     37#SBATCH --nodes=1             ### Node count required for the job
     38#SBATCH --ntasks-per-node=1   ### Nuber of tasks to be launched per Node
     39
     40echo Start Job
     41pwd
     42
     43cat $SLURM_JOB_NODELIST
     44
     45./a.out
     46
     47echo End job
     48}}}
     49
     50== Parallel C ==
     51* [[cypress/Programming/Cexamples/OpenMp|OpenMP examples in C]]
     52* [[cypress/Programming/Cexamples/Mpi|MPI examples in C]]
     53
     54== More Examples ==
     55* Approximate Pi
     56* !Heat/Mass Transfer
     57* Stokes Flow In a Cavity
     58* Particle Strength Exchange Method