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 ~]$ module load intel-psxe [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 ### Number of tasks to be launched per Node echo Start Job pwd echo $SLURM_JOB_NODELIST ./a.out echo End job
Parallel C
More Examples
Last modified
8 years ago
Last modified on 09/23/16 12:05:47
Note:
See TracWiki
for help on using the wiki.