Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Petros_Mamales
Beginner
69 Views

tbb_config file

Hi,

I am using the new tbb release within vs2010 and using icl 12.1. All builds are 64bit  (win7).

I am trying to use the scalable_allocator construct method. I assume that because variadic templates are supported in icl 12.1,

I will be able to use the overloaded version of the function that forwrds arguments (variadic argument list).

However, the compiler does not "pick up". I was hoping that this would be activated:

#if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT && __TBB_CPP11_RVALUE_REF_PRESENT
    template<typename... Args>
    void construct(pointer p, Args&&... args)
 #if __TBB_CPP11_STD_FORWARD_BROKEN
        { ::new((void *)p) T((args)...); }
 #else
        { ::new((void *)p) T(std::forward<Args>(args)...); }
 #endif

Am I looking at the right thing ? My understanding is that this is functionally equivalent to new _T( args...) . Am I wrong ?

(In this case, however, I do have a question on how it is possible to change the pointer when no indirection to it is provided in the argument list ).

Looking a bit more within the definition of __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT and __TBB_CPP11_RVALUE_REF_PRESENT

In the section I belive to be relevant for my setup, I read :

#if __INTEL_COMPILER
    /** On Windows environment when using Intel C++ compiler with Visual Studio 2010*,
        the C++0x features supported by Visual C++ 2010 are enabled by default
        TODO: find a way to get know if c++0x mode is specified in command line on windows **/
    #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT    __GXX_EXPERIMENTAL_CXX0X__ && __VARIADIC_TEMPLATES

Variadic templates however, are not supported on the ms compiler that ships with vs2010 (version 1600).

Please, note that the macro __INTEL_COMPILER is well defined (the rest of the options come in the form of elif's and therefore are not touched ).

I assume that the macro __GXX_EXPERIMENTAL_CXX0X__ is not applicable to me ( gcc?) and the && just shortcuts any attempt to define

__VARIADIC_TEMPLATES by hand (btw, was not able to locate where this thing is defined, if not by the user ).

Can you please provide with a hint of how to bypass this issue and more generally issues of the same nature i.e. the config file not picking up the icl Cxx0x features ? (present in the previous tbb release as well, which prompted me to download the latest one).

Thank you in advance for your help,

Petros

0 Kudos
8 Replies
Petros_Mamales
Beginner
69 Views

Update:

It looks like it is compiling w/out errors ( flag C++0x was not active, apologies ).

Still dont understand any of my questions though and would greatly appreciate some insight.

Thank you,

P-

Petros_Mamales
Beginner
69 Views

Update:

It seems that the questions I asked do require some answer in the end, since I mistakenly thought that things were OK ( usual template

compilation issue). Apologies (again ;) )

Hence,

Unless I manually overwrite all the tbb include files ( actually not include them, but include  a proxy to them where I define things by hand)

the icl 12.1 variadic templates and rvalue references are not picked up ! Also I see that you explicitely determine that the std::forward is broken. Is it really so for the icl 12.1 ? (could not get to an answer on the web),

Petros_Mamales
Beginner
69 Views

Can someone please respond on what is the proper way to employ c++0x features with tbb in windows using icl ?

Is this broken ?

TIA,

Petros

Anton_P_Intel
Employee
69 Views

Petros,
thanks for reporting it. Definitely deserve investigation. Will let you know the results.

Anton_P_Intel
Employee
69 Views

Petros,

as a temporary workaround you can try modify tbb_config.h to look like this : (all the changes in the last line)

#if __INTEL_COMPILER
    /** On Windows environment when using Intel C++ compiler with Visual Studio 2010*,
        the C++0x features supported by Visual C++ 2010 are enabled by default
        TODO: find a way to get know if c++0x mode is specified in command line on windows **/
    #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT    ( __VARIADIC_TEMPLATES && (__GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER) )

As well, please note that you have to enable  C++11 mode explicitly (specify /Qstd=c++0x compiler switch) as the variadic templates are not supported by the MSVC2010 and will not be silently turned on by Intel compiler.

Petros_Mamales
Beginner
69 Views

Very doubtful workaround.

The reason being that, this is in the config workaround, which is included to a number of header files (actually most indirectly through the inclusion of some other file). If this is a trully header-only "library" then things would be  OK. Is it though ?O/wise you will get messages amounting to that the lib file is prior to the included one.

Petros_Mamales
Beginner
69 Views

Actually since they would belong to separate libs it would probably be OK. Thank you.

Petros_Mamales
Beginner
69 Views

Anton,

your recommendation from a few months back, found its way to the recent (Jun ) update release of tbb.

However there are some problems with it:

The macro __VARIADIC_TEMPLATES is not defined anywhere in the msvc environment. It does not seem to be defined as an intel compiler macro, as far as I can see ( maybe it is triggered internally by the C++0x flag ? I don't know. However it does not work !!!

It should better be :

#define__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT  (  ( __VARIADIC_TEMPLATES && (__GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER) ) ) || (_MSC_VER && __INTEL_COMPILER >=1210 ).

Also, the macro

__TBB_CPP11_STD_FORWARD_BROKEN

is incorrectly set for msvc2010 as in the <utility> (Ln 77 after the clause for C++0x on line 22) it is clearly defined !

Do I miss something?

Thank you for your help,

Petros

 

 

Reply