How can I tell if my program is running in parallel?

You can check to see if your program is running in parallel, i.e. it is using more than 1 thread by typing the following command:

ps -Lu username -o pid,gid,lwp,psr,s,comm

where username is your login.

This will give a table of your currently active processes and their lightweight threads. If your program is running in parallel then multiple instances of it should exist that have 0 as their status, i.e. they are running on a processor. For example, below the serial version of swim has only 1 thread. The parallel version always has multiple threads, however when running on p processors only p threads have a 0 status. The PSR column should generally be -, however if the lwps are bound to a processor it will appear here.

peta.ecn.purdue.edu 140: ps -Lu mjvoss -o pid,gid,lwp,psr,s,comm
  PID   GID    LWP PSR S COMMAND
 1135     1      1   - S -tcsh
29884     1      1   - S -tcsh
 2242     1      1   - O swim_serial
29611     1      1   - S emacs

(a) A Serial Version of Swim

peta.ecn.purdue.edu 141: ps -Lu mjvoss -o pid,gid,lwp,psr,s,comm
  PID   GID    LWP PSR S COMMAND
 1135     1      1   - S -tcsh
29884     1      1   - S -tcsh
 2250     1      1   - O swim_parallel_on_1
 2250     1      2   - S swim_parallel_on_1
 2250     1      3   - S swim_parallel_on_1
 2250     1      4   - S swim_parallel_on_1
 2250     1      5   - S swim_parallel_on_1
29611     1      1   - S emacs

(b) A Parallel Version of swim running on 1 processor

peta.ecn.purdue.edu 146: ps -Lu mjvoss -o pid,gid,lwp,psr,s,comm
  PID   GID    LWP PSR S COMMAND
 1135     1      1   - S -tcsh
29884     1      1   - S -tcsh
 2257     1      1   - O swim_parallel_on_2
 2257     1      2   - S swim_parallel_on_2
 2257     1      3   - S swim_parallel_on_2
 2257     1      4   - S swim_parallel_on_2
 2257     1      5   - S swim_parallel_on_2
 2257     1      6   - O swim_parallel_on_2
 2257     1      7   - S swim_parallel_on_2
29611     1      1   - S emacs

(c) A Parallel Version of Swim running on 2 processors