Date Posted: May 29, 2008
What is IBM XL C/C++ for Transactional Memory for AIX?
IBM® XL C/C++ for Transactional Memory for AIX® provides a complete programming environment for developing scalable parallel applications using transactional memory. This programming environment includes the following:
- language extensions that allow the programmer to specify transactional code regions and properties
- a software transactional memory (STM) run-time library that implements transactional memory semantics
- an enhancement to the C/C++ compiler that implements the transactional memory language extensions.
In this environment, programmers use language directives to define units of concurrent computation, called transactions, which are executed atomically and in isolation. The compiler and the run-time system ensure the correct execution of concurrent transactions.
The environment also provides additional facilities to help users tune and debug transactional programs:
- The language extension provides a set of intrinsic functions that allow direct instrumentation of the code for improved performance.
- The STM run-time system provides the profiling of a rich set of transactional statistics to help performance tuning.
- The compiler provides extensive reporting information on instrumentation to help functional debugging and performance tuning.
This alphaWorks® release is a functional release of the transactional memory compiler for AIX® POWER™/PowerPC® platforms. Because it is a functional release, the performance of the generated code will vary. Work continues on both functional and performance improvements for the compiler and the run-time environment.
How does it work?
In order to write a program using transactional memory language extension, users first write a multi-threaded program using, for example, OpenMP directives or thread Libraries, then mark critical sections using #pragma tm atomic. If transactions are invoked in critical sections, they can be annotated by the attributes of transactional memory function at function declaration. Following is an example:
int incre(int sum) __attribute__((tm_func)) ;
#pragma omp parallel for
for(int i=0; i <100; i++) {
#pragma tm atomic
{
sum = incre(sum);
}
}
The source code for the complete program foo.c can be found in the FAQ.
Steps for compiling and executing the source program foo.c are as follows:
% stmxlc –qsmp=omp foo.c -lstm % setenv OMP_NUM_THREADS 4 % ./a.out
For further details on compiling and executing the program, please refer to the FAQ.
The following white paper contains key information for writing a transactional memory program using this compiler: Language extensions and user's guide.
About the technology author(s)
The development of the IBM XL C/C++ for Transactional Memory for AIX is a collaborative effort among researchers from the following IBM labs:
- IBM Toronto Software Development Lab (Software Group)
- IBM T. J. Watson Research Center, Yorktown, N. Y. (Research Group)
