Exercise 1: | QDP Hello World |
Goals: | learning how to compile and run QDP programs |
Concepts: | QDP initialization |
Directory: | $HOME/examples/01-hello |
How to: | $
cd
$HOME/examples/01-hello $ make $ submit hello |
Each QDP program should include <qdp.h>.
There are two preprocessor symbols, QDP_Precision
and QDP_Nc,
which, if defined before including <qdp.h>,
instruct it to set the default values of floating point precision and the
number of colors to specified values.
If left out they will default to the same values used here.
In all our examples we keep these definitions and
necessary includes in a separate file $HOME/examples/qdp-config.h,
which starts as follows:
1 #include <stdio.h>
|
In this exercise we learn how to write a simple QDP program. After including <qdp-config.h> and defining the lattice size, we proceed to the main():
1 #include <qdp-config.h>
|
Each QDP program starts with initializing QDP, setting lattice size, and setting up the layout for the rest of the program. These three steps are performed once in a program.
8 /* start QDP */
|
True to the "Hello, World" tradition, the only substantial action is saluting the world. Notice that we do it only on node 0.
|
Before exiting the program one must close QDP by calling QDP_finalize():
|
The job can be started on the Blue Gene with the script $HOME/bin/submit. It does what its name implies, namely, it places a job request into the BG/L queue. One can check the current status of the queue by saying
$ cqstat |
Once the job is done, two files will be created in the current directory with names ending in .output and .error.