Wednesday, December 29, 2010

Instrument an MPI program with the Pin tool

Usually an MPI program is started by "mpirun". If mpirun is passed to Pin as the target, Pin will not be able to catch the behavior of each MPI process, and even worse, it can break the code. The solution is to let Pin call mpirun, for example:

mpirun -np 32 pin -t /usr/pin-2.8/source/tools/Memory/obj-intel64/fp.so -o ./bin/foo.out -- ./bin/foo

Tuesday, December 28, 2010

Ruby file operations

FileUtils is a Ruby module that provides basic file operations, such as copy, remove, rename, etc. But I met the following error that I don't have a solution. Clearly the file was there, but the FileUtils.copy didn't work.

/usr/lib/ruby/1.8/FileUtils.rb:1200:in `stat': No such file or directory

Monday, December 20, 2010

64-bit compilation option

Error I met when compiling ft.C.1 in NPB-3.3:

mpif77 -O3 -m64 -o ../bin/ft.C.1 ft.o ../common/randi8.o ../common/print_results.o ../common/timers.o
ft.o: In function `transpose2_finish_':
ft.f:(.text+0x614): relocation truncated to fit: R_X86_64_PC32 against symbol `procgrid_' defined in COMMON section in ft.o
...

The reason is the data gets too large to fit in 2GB.


The related GNU compiler option is -mcmodel, and possible values are:
  • small. Tells the compiler to restrict code and data to the first 2GB of address space. All accesses of code and data can be done with Instruction Pointer (IP)-relative addressing.
  • medium. Tells the compiler to restrict code to the first 2GB; it places no memory restriction on data. Accesses of code can be done with IP-relative addressing, but accesses of data must be done with absolute addressing.
  • large. Places no memory restriction on code or data. All accesses of code and data must be done with absolute addressing.