How to integrate C++ STM Compiler with vs2008 ?

How to integrate C++ STM Compiler with vs2008 ?

Bild des Benutzers fialin

I try to useC++ STM Compiler in VS2008.

I launch Visual Studio, and perform the following steps:

  1. create a Visual Studio project.
  2. Select the project in the Solution Explorer pane.
  3. From the Project menu, select Use Intel C++.
  4. 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

1 Beitrag / 0 neu
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.