Version 5 (modified by 10 years ago) ( diff ) | ,
---|
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. http://en.wikipedia.org/wiki/C_standard_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 ~]$ icc hello.c
Links for Tutorial
Examples of Jobscript
#!/bin/bash #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 ### Nuber of tasks to be launched per Node echo Start Job pwd cat $SLURM_JOB_NODELIST ./a.out echo End job
Parallel C
More Examples
Note:
See TracWiki
for help on using the wiki.