CS380P: Parallel Systems
Info on Programming Assignment 1 (pthreads):
Champion Info
- Compiling pthreads programs
- To compile a c program, use the following command:
xlc_r -o prog_name -qsmp=explicit pthreads.c -lpthread
- To compile a C++ program, use the following command:
xlC_r -o prog_name -qsmp=explicit pthreads.cpp -lpthread
- Launching programs using Champion's job scheduler
NOTE: I'm still experimenting with this section and I expect some minor changes in this section. Use this with CAUTION
The job scheduler on the Champion machine is called "LoadLeveler". You need to prepare a "LoadLeveler" job submission script to run jobs on the champion nodes. You can read more about it here . I provide a short summary here to get you started.
A sample job submission script is given below (for 2 pthreads):
--------------------------
#@ shell = /bin/bash
#@ initialdir = FIX_YOUR_DIRECTORY_PATH
#@ account_no = A-cs41
#@ job_name = FIX_pthread_2
#@ input = /dev/null
#@ output = $(job_name).o$(jobid)
#@ error = $(job_name).o$(jobid)
#@ job_type = parallel
#@ environment = COPY_ALL; LL_JOB=TRUE;AIXTHREAD_MINKTHREADS=2; AIXTHREAD_MNRATIO=1:1; MP_SINGLE_THREAD=NO; OMP_NUM_THREADS=2
#@ resources = ConsumableCpus(2) ConsumableMemory(900mb)
#@ network.MPI_LAPI = sn_all, not_shared, US
#@ wall_clock_limit = 01:00:00
#@ node = 1
#@ tasks_per_node = 1
#@ node_usage = not_shared
#@ notify_user = FIX_YOUR_EMAIL_ID
#@ notification = complete
#@ class = normal
#@ queue
export OMP_NUM_THREADS=2
./FIX_PROGRAM_NAME ARGUMENTS
------------------------------
All places where you need to modify this script for your use start
with the prefix "FIX". The "initialdir" variable denotes your working
directory where the executable and the input files are stored.
The "account_no" variable denotes our parallel systems project. PLEASE
REMEMBER TO INCLUDE THIS LINE in your script. You can optionally
modify the "job_name" variable.
Please set ConsumableCpus to be the maximum number of pthreads your
program will use (maximum value of 8 as each node has 8 different
cores). Set it to 2 for 2 pthreads and 4 for 4 pthreads and so on. The
ConsumableMemory option needs to be per-thread, i.e., if you set
ConsumableMemory to be 500 MB and ConsumableCpus to 2, the total
memory is 1 GB. Please adjust this parameter if your job quits because
of insufficient memory.
Please include your email id so that the system will notify you when your job completes. (You can change this to notify only there is an error too. Other scenarios are listed in the documentation.) Also, the wall_clock_limit variable sets an upper bound on the running time for your program. Tweak this if necessary.
The last line is your program name and its arguments. Please use the
other options AS IS unless you know what you are doing.
A simple PERL script to generate these submission scripts is here
After you prepare a job submission script, use the command "llsubmit job_file_name" to launch your job. (Replace job_file_name with your filename).
- Measuring performance
- You can system calls like gettimeofday inside your program to time the relevant portions of the program.
- You can also use performance counters in the Power5 processor through the PAPI library. Info on PAPI is found on the Champion Site under the "Tools" section (on the left navigation menu)