- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am just getting introduced into haswell's TSX infrastructure using RTM. I have downloaded the rtm.h header files from online and i tried producing a simple counter. Unfortunately every time i compile and run the program, the _xbegin function does not execute the transaction inside. I would be greatly appreciated for your help. thanks
#include <stdio.h>
#include <stdlib.h>
#include "rtm.h"
void main(){
int N=5;
int i;
int status;
int counter = 0;
status = _xbegin();
if (status == _XBEGIN_STARTED)
{
for (i=0; i<N ; i++) {
counter++;
printf("counter value: %d\n", counter);
}
_xend();
}
else
printf("did not work\n");
}
- Tags:
- Parallel Computing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should not use print inside a transactional region. I/O is unfriendly instruction. When the transaction is aborted, the program goes to the else statement.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should not use print inside a transactional region. I/O is unfriendly instruction. When the transaction is aborted, the program goes to the else statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FWIW placing a break point inside a transactional region will abort the transaction. Debug your code as a critical section, then convert to TSX or RTM.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you le g. and jimdempseyatthecove when i put the printf function after the _xend the transaction works. thanks again for your quick help
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page