Version 9 (modified by cbaribault, 6 years ago) ( diff )

20160923 - CEB - avoid error message "No such file or directory" by changing "cat" to "echo" in example job script.

C Codes

Hello World

/* hello.c: display a message on the screen */
#include <stdio.h>
int main(){
  printf("hello, C world\n");
  return 0;

  • Text between /* and */ are comments.
  • #include <stdio.h> to load the header file.
  • There are many header files in the standard C library.
  • Program always begins with main() function.
  • main() returns a integer.

Compile with GNU C

[tulaneID@cypress1 ~]$ gcc hello.c

Compile with Intel C

[tulaneID@cypress1 ~]$ module load intel-psxe
[tulaneID@cypress1 ~]$ icc hello.c

Links for Tutorial

Examples of Jobscript

#SBATCH --job-name=HelloC 
#SBATCH --qos=normal         
#SBATCH --time=0-00:10:00     ### Wall clock time limit in Days-HH:MM:SS
#SBATCH --nodes=1             ### Node count required for the job
#SBATCH --ntasks-per-node=1   ### Number of tasks to be launched per Node

echo Start Job



echo End job

Parallel C

More Examples

Note: See TracWiki for help on using the wiki.