This quick start demonstrates how to implement a Fortran/C program on HCC supercomputers. The sample codes and submit scripts can be downloaded from serial_dir.zip.
Connect to a HCC cluster](/connecting/) and make a subdirectory
serial_dir under your
$ cd $WORK $ mkdir serial_dir
In the subdirectory
serial_dir, save all the relevant Fortran/C codes. Here we include two demo
demo_c_serial.c, that compute the sum from 1 to 20.
The compiling of a Fortran/C++ code to executable is usually done behind
the scene in a Graphical User Interface (GUI) environment, such as
Microsoft Visual Studio. In a HCC cluster, the compiling is done
explicitly by first loading a choice compiler and then executing the
corresponding compiling command. Here we will use the GNU Complier
gcc, for demonstration. Other available compilers such as
pgi can be looked up using the command
module avail. Before compiling the code, make sure there is no
dependency on any numerical library in the code. If invoking a numerical
library is necessary, contact a HCC specialist
discuss implementation options.
$ module load compiler/gcc/8.2 $ gfortran demo_f_serial.f90 -o demo_f_serial.x $ gcc demo_c_serial.c -o demo_c_serial.x
The above commends load the
gcc complier and use the compiling
gcc to compile the codes to
Create a submit script to request one core (default) and 1-min run time on the supercomputer. The name of the main program enters at the last line.
The job can be submitted through the command
sbatch. The job status
can be monitored by entering
squeue with the
$ sbatch submit_f.serial $ sbatch submit_c.serial $ squeue -u <username>
<username> with your HCC username.
The sum from 1 to 20 is computed and printed to the