Using source instrumentation with PDT

Compiling PDT library
1. cd pdtoolkit-3.20

2. ./configure;make;make install

3.export PATH=/home16/xczhang/pdtoolkit-3.20/x86_64//bin:$PATH

Compiling TAU

1. cd tau2

2. ./configure -mpi -iowrapper -pthread -pdt=/home/xuechen/apps/pdtoolkit-3.20

3. export PATH= /home16/xczhang/tau2-latest/x86_64/bin:$PATH

4. export TAU_MAKEFILE=`cat .active_stub`

Compiling ADIOS

1. cd adios

2. ./configure –prefix=/home16/xczhang/adios-install –with-mxml=/home16/xczhang/mxml-install –with-flexpath=/home16/xczhang/beacon

3. export TAU_OPTIONS=”-optTauSelectFile=/home/xuechen/apps/ADIOS/select.tau -optRevert”

4. Create a “select.tau” file with the following content


5. export TAU_OPTIONS=”-optTauSelectFile=/home16/xczhang/ADIOS/select.tau -optRevert” or ” -optKeepFiles ” to keep instrumented files

6. make

7. Had encountered any issues when compiling examples or tools, you can compile the targeted files in corresponding directories with “make”

Compiling LAMMPS

Posted in Uncategorized | Leave a comment

TAU profile name using process id

Use process id as node id: add configuration option


Posted in Uncategorized | Leave a comment

Compile and Install TAU

On server:

1. The TAU commands:


2. cat .active_stub in TAU directory

$TAU_MAKEFILE=`cat .active_stub`

3. Use pprof or paraprof to read the tau profiled data

Source instrumentation steps:

1. Compile adios

Modules: gcc/4.8 and mpi-tor/openmpi-1.7_gcc-4.8 and adios-1.4.1 and tau2-latest



./configure –prefix=/home/xuechen/apps/adios-install/ –with-mxml=/usr/local/packages/mxml-2.7/gcc-4.7.3/


./configure -mpi -iowrapper and make install

In TAU directory

1. export TAU_MAKEFILE=`cat .active_stub`

2. export PATH=$HOME/apps/tau2_latest/x86_64/bin:$PATH

3. In /home/xuechen/apps/adios-1.4.1/examples/C/arrays


4. export TAU_OPTIONS=”-optCompInst -optVerbose”

TAU sampling:

1. Configure adios and by default “-g” is used for debugger mode

./configure –prefix=/home/xuechen/apps/adios-install/ –with-mxml=/usr/local/packages/mxml-2.7/gcc-4.7.3/

2. Configure tau with the following options

./configure -mpi -iowrapper -pthread -useropt=-DTAU_PID_AS_NODE -unwind=download -bfd=download

3. In /home/xuechen/apps/adios-1.4.1/examples/C/arrays


4. export TAU_SAMPLING=1

5. Use “pprof -a” to show the profiled data with line number





Posted in Uncategorized | Leave a comment

Ubuntu Linux Switch between Terminal and GUI

GUI –> Terminal: Ctrl+Alt+F1

Termial–>GUI: Alt+F7 

Posted in Uncategorized | Leave a comment

X11 Forwarding on OS X 10.8.2

X11 Forwarding on OS X 10.8.2 – Mountain Lion

January 8, 2013 at 10:41 am | Posted in OS X (Mac) | 4 Comments

To get X11 forwarding to work on Mac OS X 10.8.2, you first need to install the XQuarz X window system, which seems to have been omitted in this release of OS X.

After downloading the XQuarz package, simply install it by double clicking the package icon. After the package is installed, you need to log out and back into your OS X machine.

Add your remove server to host:

On your Mac in iTerm:

$ sudo xhost +

Connect to your remote system with ssh:

On your Mac in iTerm:

$ ssh -X

Test X11 by running xclock or another GUI application like gcalctool.

On remote server:

$ xclock

Note when upgrading to Mavericks

After the upgrade to Mavericks, my xhosts settings were reset, and X11 forwarding no longer worked. This fix this you simply need to re-run the xhost command:

$ sudo xhost +


Posted in Uncategorized | Leave a comment

set mem=512mb

Posted in Uncategorized | Leave a comment

Debug Makefile

One of my favorite makefile debugging tricks is this rule for printing out the value of a variable:


        @echo '$*=$($*)'

Throw this into a GNU make makefile and then print any make variable you like by invoking targets like print-MAKE_VERSION:


ericm@chester:/tmp$ gmake print-MAKE_VERSION

You can imagine how handy this is when diagnosing issues with your makefiles. Here’s how it works:

  1. print-% defines a pattern rule that matches any target that starts with the charactersprint-.
  2. In the context of a pattern rule, the $* variable expands to the stem of the target, that part which matched the % in the pattern. In my example above, that corresponds toMAKE_VERSION.
  3. GNU make variable expansion rules allow for variable references inside variable names, so$($*) expands first to $(MAKE_VERSION), and finally to the value of the MAKE_VERSIONvariable.


Makefile injection with -f

The print-% rule is a slick hack, but it’s a nuisance to have to modify a makefile just to use it. Worse, you might not even be able to modify the makefile. Fortunately, there’s a solution: the -fcommand-line option. You’re probably familiar with it — that’s how you tell gmake to use a different makefile than the default Makefile when it starts. For example, if you have a makefile namedbuild.mak:


gmake -f build.mak

What you may not know is that you can use multiple -f options on the command line. GNU make will read each file in turn, incorporating the contents of each just as if they were included with theinclude directive. We can create a simple makefile called printvar.mak containing nothing but our print-% rule, then inject it into any makefile we want like this:


gmake -f printvar.mak -f Makefile print-MAKE_VERSION


A shell script to save typing

The combination of the print-% rule and the -f command-line option is powerful, but it’s unwieldy — too many characters to type. The solution is a shell script wrapper:



if [ -f GNUmakefile ] ; then
elif [ -f makefile ] ; then
elif [ -f Makefile ] ; then
if [ -n "$filename" ] ; then
  for n in $@ ; do
    vars="$vars print-$n"
  gmake -f $filename -f printvar.mak $vars
  echo "No makefile found" 1>&2
  exit 1

Save that in a file called printvars somewhere on your PATH and you can do things like this:


ericm@chester:/tmp$ printvars MAKE_VERSION
MAKE_VERSION=3.81    -c


Advanced make variable diagnostics

Beyond simply printing the value of a variable, GNU make 3.81 has three built-in functions that allow introspection on variables, which you can add to the print-% rule for additional diagnostics.

First is the $(origin) function, which tells you how a variable was defined. For example, if a variable FOO was inherited from the environment, $(origin FOO) will give the resultenvironment. Variables defined in a makefile will give the result file, and so forth.

Next is the $(flavor) function, which tells you the flavor of the variable, either simple orrecursive.

Finally is the $(value) function, which gives you the unexpanded value of the variable. For example, if you have variables like this:



$(value BAR) will give the result $(FOO), rather than the fully-expanded 123 that you might expect.

With these additions, the print-% rule now looks like this:


	@echo '$*=$($*)'
	@echo '  origin = $(origin $*)'
	@echo '  flavor = $(flavor $*)'
	@echo '   value = $(value  $*)'

And here’s how it looks in action:


ericm@chester:/tmp$ printvars MAKE_VERSION
  origin = default
  flavor = simple
   value = 3.81    -c
  origin = default
  flavor = recursive
   value = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c



Posted in Uncategorized | Leave a comment