I try to useC++ STM Compiler in VS2008.
I launch Visual Studio, and perform the following steps:
- create a Visual Studio project.
- Select the project in the Solution Explorer pane.
- From the Project menu, select Use Intel C++.
- compiler the code below,but have some errors (like "__tm_atomic" is undefined):
#include "stdafx.h" int xx = 0; /* Base class for C++ Transactional Memory virtual function example */ class BaseXXX { public: __declspec(tm_callable) virtual void TxnAddOne() { xx = xx + 1; #ifdef DEBUG printf("Transactional Memory Base class: virtual function n"); #endif } }; /* Virtual class for C++ Transactional Memory virtual function example */ class VirtualYYY : public BaseXXX { public: __declspec(tm_callable) void TxnAddOne() { xx = xx + 1; #ifdef DEBUG printf("Transactional Memory Virtual class: function n"); #endif } }; int main() { BaseXXX *x, *y; #pragma omp parallel sections num_threads(2) { __tm_atomic { x = new BaseXXX(); x->TxnAddOne(); } #pragma omp section __tm_atomic { y = new VirtualYYY(); y->TxnAddOne(); } } if (xx==2) { printf("passedn"); } else { printf("failedn"); } }
I get the following errors:
command line warning #10161: unrecognized source type '.'; object file assumed icl command line warning #10161: unrecognized source type 'ia32'; object file assumed icl warning #688: "tm_callable" is an unrecognized __declspec attribute ..........DesktopJinintel_stmtest_virtual.cpp warning #161: unrecognized #pragma ..........DesktopJinintel_stmtest_virtual.cpp error: identifier "__tm_atomic" is undefined ..........DesktopJinintel_stmtest_virtual.cpp
Did I miss some step??What should I do?Thanks for anyone's solution.Jin