Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gagan
Beginner
360 Views

issue using std::thread and std::ref via icpc

Hi guys,

there seems to be an issue using std::ref and std:: thread with icpc, even if you use the tbb/thread/compat.h header:

There are no compilation issues on clang++. I am not using the SP1 beta of composer yet, so I am not sure if these issues have been fixed.

I have found the main issue is that std::ref cannot be used with std::thread (when using icpc). I am getting a lot of the following errors:

aProgram.c(747): error: namespace "std" has no member "thread"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(iarg6),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

aProgram.c(747): error: namespace "std" has no member "ref"
threads = std::thread(func1,std::ref(arg1),std::ref(arg2),std::ref(arg3),std::ref(arg4),std::ref(local_eigs),eta,std::ref(arg6),std::ref(arg7),std::ref(arg8),arg9,arg10,start,end,,std::ref(aMutex));
^

Unfortunately, I cannot give you guys the program to debug this, but I am certain this is not an issue with the code as it runs without issue using clang++. 

Clang++ is too effin slow for what I'm doing, and so icpc/icc are the only way the program will be fast enough (to my standards), even though it is parallelized extensively.

note: please don't worry about some weird syntax, as I had to edit the filename/parameters to ensure privacy of my program. The key is that the errors are related to both std::ref and std:;thread...

can someone tell me if this has been fixed?

0 Kudos
32 Replies
TimP
Black Belt
303 Views

As icpc depends on g++ for definition of these things, you need an active g++ installation new enough to support these facilities under -std=c++11, and you must give icpc that option.  icpc would probably not support any facilities not present in g++ 4.7.  If you would give a test case, someone might be able to comment.

SergeyKostrov
Valued Contributor II
303 Views

As a very quick verification take a look if there is a thread header file in Include folder.

Gagan
Beginner
303 Views

in the /opt/intel/include or /opt/intel/mkl/include there is no such header, here is the compiler command:

icpc -g -std=c++11 -stdlib=libc++ -O4 -o aProgram aProgram.c -I/usr/local/include -I/opt/intel/composerxe/mkl/include -I/usr/local/include -I/opt/local/include -I/usr/include -L/usr/local/fsl/lib -lfslio -L/usr/local/lib -lniftiio -L/usr/lib -L/usr/local/lib -L/opt/intel/composerxe/mkl/lib -liomp5 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lznz -lm -lz
icpc: command line warning #10159: invalid argument for option '-std'
icpc: command line warning #10006: ignoring unknown option '-O4'
aProgram.c(161): error: namespace "std" has no member "ref"

 

Casey
Beginner
303 Views

What version of the intel compiler are you using?  Your version does not seem to recognize c++11 as a valid standard.  Try either upgrading your compiler version (13.1.3 20130607 recognizes c++11) or try using -std=c++0x instead.

Gagan
Beginner
303 Views

I'm using 13.0.3 (gcc version 4.2.1 compatibility), but this is weird because I just installed the composerxe for C++ less than a month ago. I know that by default OSX has gcc 4.2.1 and maybe this is why? How can I fix this issue?

I've tried using prebuilt binaries of newer gcc/g++ but I do not like them because they are compiled without many useful flags. 

Does the installer automatically install an older ICPC if it detects an older gcc/g++?? Any help in dealing with this issue would be great.

Casey
Beginner
303 Views

You can grab newer versions of the intel compiler from the registrationcenter.intel.com website to install.  For the full c++11 featureset I think you'll need a newer version of gcc.  I don't have the intel compilers on mac so I cannot test there, but I do know that I build gcc/g++ locally on my mac from the macports (http://www.macports.org/) repository.  Through ports you can get gcc/g++ versions 4.7.3, 4.8.1 and nightly versions of 4.9.x among others.

SergeyKostrov
Valued Contributor II
303 Views

>>...Try either upgrading your compiler version (13.1.3 20130607 recognizes c++11) or try using -std=c++0x instead. Simply to let you know that after some update both options do the same, that is -std=c++0x and -std=c++11. The best way to verify is to use -help option.
Melanie_B_Intel
Employee
303 Views

The Intel compiler isn't standalone, it uses host's definition of <stdio.h> etc. gcc 4.2 doesn't provide <thread>. You could try adding the option -use-clang-env to the compile and link steps, this will tell the Intel compiler to use the clang include files and runtime libraries.

Gagan
Beginner
303 Views

just tried that Melanie, same error.

It seems like icpc does not like the way I am using c++11's thread to call functions with multiple references.

The weird thing is that I think the 13.1.3 update might fix it because after taking Sergey's advice and doing the --help thing on ICPC, I saw:

Arguments:

val Specifies the specific language standard to conform to. Possible values are:

c89 Conforms to the ISO/IEC 9899:1990 International Standard. This value is only available on Linux* OS and OS X*.

c99 Conforms to The ISO/IEC 9899:1999 International Standard.

c9x This value is equivalent to specifying value c99. This value is only available on Linux* OS and OS X*.

gnu89 Conforms to ISO C90 plus GNU* extensions. This value is only available on Linux* OS and OS X*.

gnu99 Conforms to ISO C99 plus GNU* extensions. This value is only available on Linux* OS and OS X*.

gnu++98 Conforms to the 1998 ISO C++ standard plus GNU extensions. This value is only available on Linux* OS and OS X*.

c++0x Enables support for the following C++11 (formerly known as C++0x) features:

o Atomic types and operations

o Scoped enumeration types

o Defaulted and deleted functions

o Rvalue references

o Empty macro arguments

o Variadic macros

o Type long long

o Trailing comma in enum definition

o Concatenation of mixed-width string literals

o Extended friend declarations

o Use of ">>" to close two template argument lists

o Relaxed rules for use of "typename"

o Relaxed rules for disambiguation using the "template" keyword

o "extern template" to suppress instantiation of an entity

o "auto" type specifier

o decltype operator

o static_assert

o compliant __func__

o lambda expressions

o character types char16_t and char32_t to store UTF-16 and UTF-32 encoding values, respectively

o template aliases

o variadic templates

o nullptr

o late-specified return types as defined in gcc proposal N2541

o default template arguments for function templates

o standard attributes as defined in gcc proposal N2761

o new style SFINAE as defined in gcc proposal N2634

o noexcept

o explicit conversion functions (N2437)

o general initializer lists (partial)

o generalized constant expressions (partial)

o use of "this" in late-specified return types (N3282)

o range based for loops

gnu++0x This value is equivalent to specifying value c++0x. This value is only available on Linux* OS and OS X*.

So I think the icpc version I am using is not fully supporting C++11, is that part of the problem? Seems so, as the other C++11 features would be useless in my specific case. I am using C++11 standard for one reason only: the threading library.

all of my data structures and whatnot are C standard. same with memory allocation.

on that note, I have a quick question regarding memory allocation when using MKL. I use calloc for all allocations. I also make it a habit to declare/allocate via calloc once, and then if I use this structure in a loop, I just bzero it at the beginning. I felt this way would remove wasteful allocation/deallocations, and instead allow me to have one "chunk" that each thread can allocate at the beginning of the function, followed by clearing/using it in the loop, and then freeing at the end of the threaded function.

I saw this option in icpc: 

-inline-calloc
directs the compiler to inline calloc() calls as malloc()/memset()

Such a directive suggests that calloc might be slower than a malloc memset. Is this the case? I never imagined that malloc would be better for what I'm doing (large scale linear algebra, each thread is looping approximately 2000 times where each loop involves getting eigs/svd/pinv of matrices that are no smaller than 100x100).

any help or advice would be great on how to use ICPC with C++11 threads. The composer XE version I am using came with 13.0.3 by default. 

Gagan
Beginner
303 Views

just tried that Melanie, same error.

It seems like icpc does not like the way I am using c++11's thread to call functions with multiple references.

The weird thing is that I think the 13.1.3 update might fix it because after taking Sergey's advice and doing the --help thing on ICPC, I saw:

Arguments:

val Specifies the specific language standard to conform to. Possible values are:

c89 Conforms to the ISO/IEC 9899:1990 International Standard. This value is only available on Linux* OS and OS X*.

c99 Conforms to The ISO/IEC 9899:1999 International Standard.

c9x This value is equivalent to specifying value c99. This value is only available on Linux* OS and OS X*.

gnu89 Conforms to ISO C90 plus GNU* extensions. This value is only available on Linux* OS and OS X*.

gnu99 Conforms to ISO C99 plus GNU* extensions. This value is only available on Linux* OS and OS X*.

gnu++98 Conforms to the 1998 ISO C++ standard plus GNU extensions. This value is only available on Linux* OS and OS X*.

c++0x Enables support for the following C++11 (formerly known as C++0x) features:

o Atomic types and operations

o Scoped enumeration types

o Defaulted and deleted functions

o Rvalue references

o Empty macro arguments

o Variadic macros

o Type long long

o Trailing comma in enum definition

o Concatenation of mixed-width string literals

o Extended friend declarations

o Use of ">>" to close two template argument lists

o Relaxed rules for use of "typename"

o Relaxed rules for disambiguation using the "template" keyword

o "extern template" to suppress instantiation of an entity

o "auto" type specifier

o decltype operator

o static_assert

o compliant __func__

o lambda expressions

o character types char16_t and char32_t to store UTF-16 and UTF-32 encoding values, respectively

o template aliases

o variadic templates

o nullptr

o late-specified return types as defined in gcc proposal N2541

o default template arguments for function templates

o standard attributes as defined in gcc proposal N2761

o new style SFINAE as defined in gcc proposal N2634

o noexcept

o explicit conversion functions (N2437)

o general initializer lists (partial)

o generalized constant expressions (partial)

o use of "this" in late-specified return types (N3282)

o range based for loops

gnu++0x This value is equivalent to specifying value c++0x. This value is only available on Linux* OS and OS X*.

So I think the icpc version I am using is not fully supporting C++11, is that part of the problem? Seems so, as the other C++11 features would be useless in my specific case. I am using C++11 standard for one reason only: the threading library.

all of my data structures and whatnot are C standard. same with memory allocation.

on that note, I have a quick question regarding memory allocation when using MKL. I use calloc for all allocations. I also make it a habit to declare/allocate via calloc once, and then if I use this structure in a loop, I just bzero it at the beginning. I felt this way would remove wasteful allocation/deallocations, and instead allow me to have one "chunk" that each thread can allocate at the beginning of the function, followed by clearing/using it in the loop, and then freeing at the end of the threaded function.

I saw this option in icpc: 

-inline-calloc
directs the compiler to inline calloc() calls as malloc()/memset()

Such a directive suggests that calloc might be slower than a malloc memset. Is this the case? I never imagined that malloc would be better for what I'm doing (large scale linear algebra, each thread is looping approximately 2000 times where each loop involves getting eigs/svd/pinv of matrices that are no smaller than 100x100).

any help or advice would be great on how to use ICPC with C++11 threads. The composer XE version I am using came with 13.0.3 by default. 

SergeyKostrov
Valued Contributor II
303 Views

>>>>aProgram.c(747): error: namespace "std" has no member "thread" >>>>... >>>>aProgram.c(747): error: namespace "std" has no member "ref" >>... I'd like to refer to one of your previous statements: >>... >>in the /opt/intel/include or /opt/intel/mkl/include there is no such header... >>... The thread header needs to be in a regular Non-Intel Include directory of GCC compiler.
Melanie_B_Intel
Employee
303 Views

Can you provide preprocessed test case, or even better a small test case which shows the problem. You can open a support ticket at premier.intel.com, and it can be treated confidentially. (The -E switch produces preprocessed source file). I'm not familiar with the inlin-calloc option but reading the documentation page, it says that it may inline the bzero in certain circumstances. There's a separate support forum for MKL.

SergeyKostrov
Valued Contributor II
303 Views

>>...Such a directive suggests that calloc might be slower than a malloc memset. Is this the case? You could actually verify it in two tests, like: [ Test Case 1 ] ... // Timer start -> T1 ... for( int i = 0; i < 2048; i++ ) { piDataC = ( int * )calloc( 1, sizeof( int ) * 1024 ); } ... // Timer end -> T2 iDeltaC = T2 - T1 ... [ Test Case 2 ] ... // Timer start -> T1 ... for( int i = 0; i < 2048; i++ ) { piDataM = ( int * )malloc( sizeof( int ) * 1024 ); memset( piDataM, 0x0, sizeof( int ) * 1024 ); } ... // Timer end -> T2 iDeltaM = T2 - T1 ... and compare execution times iDeltaC and iDeltaM.
Gagan
Beginner
303 Views

Hi Sergey,

I see what you're saying. However my question would be: If I can change the compiler from icpc to clang++, and the #include <thread> directive issue goes away with the latter, how isn't the thread header in the appropriate /include directory?

I did a "locate" for thread and found that the one being used by clang++ likely resides in:

/usr/local/include/c++/4.8.0/thread

I tried including this path manually (-I /usr/local/include/c++/4.8.0) with #include <thread> on icpc, but I get a lot of errors suggesting I'm doing it wrong (heh):

/usr/local/include/c++/4.8.0/bits/stl_relops.h(72): error #77: this declaration has no storage class or type specifier
_GLIBCXX_BEGIN_NAMESPACE_VERSION
^

/usr/local/include/c++/4.8.0/bits/stl_relops.h(86): error: expected a ";"
template <class _Tp>
^

/usr/local/include/c++/4.8.0/bits/stl_relops.h(131): warning #12: parsing restarts here after previous syntax error
} // namespace rel_ops
^

/usr/local/include/c++/4.8.0/bits/move.h(38): error #77: this declaration has no storage class or type specifier
_GLIBCXX_BEGIN_NAMESPACE_VERSION
^

/usr/local/include/c++/4.8.0/bits/move.h(45): error: expected a ";"
template<typename _Tp>
^

/usr/local/include/c++/4.8.0/bits/move.h(54): warning #12: parsing restarts here after previous syntax error
} // namespace
^

/usr/local/include/c++/4.8.0/type_traits(43): error: variable "std::_GLIBCXX_BEGIN_NAMESPACE_VERSION" has already been defined
_GLIBCXX_BEGIN_NAMESPACE_VERSION
^

/usr/local/include/c++/4.8.0/type_traits(57): error: expected a ";"
template<typename _Tp, _Tp __v>
^

/usr/local/include/c++/4.8.0/type_traits(67): error: integral_constant is not a template
typedef integral_constant<bool, true> true_type;
^

/usr/local/include/c++/4.8.0/type_traits(70): error: integral_constant is not a template
typedef integral_constant<bool, false> false_type;
^

/usr/local/include/c++/4.8.0/type_traits(73): error: integral_constant is not a template
constexpr _Tp integral_constant<_Tp, __v>::value;
^

/usr/local/include/c++/4.8.0/type_traits(85): error: not a class or struct name
: public false_type
^

/usr/local/include/c++/4.8.0/type_traits(108): error: not a class or struct name
: public true_type
^

/usr/local/include/c++/4.8.0/type_traits(128): error: integral_constant is not a template
: public integral_constant<bool, !_Pp::value>
^

/usr/local/include/c++/4.8.0/type_traits(128): error: not a class or struct name
: public integral_constant<bool, !_Pp::value>
^

/usr/local/include/c++/4.8.0/type_traits(144): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(148): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(153): error: integral_constant is not a template
: public integral_constant<bool, (__is_void_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(153): error: not a class or struct name
: public integral_constant<bool, (__is_void_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(159): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(163): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(167): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(171): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(175): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(180): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(185): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(189): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(193): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(197): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(201): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(205): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(209): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(213): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(217): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(221): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(236): error: integral_constant is not a template
: public integral_constant<bool, (__is_integral_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(236): error: not a class or struct name
: public integral_constant<bool, (__is_integral_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(242): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(246): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(250): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(254): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(265): error: integral_constant is not a template
: public integral_constant<bool, (__is_floating_point_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(265): error: not a class or struct name
: public integral_constant<bool, (__is_floating_point_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(272): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(274): error: namespace "std" has no member "size_t"
template<typename _Tp, std::size_t _Size>
^

/usr/local/include/c++/4.8.0/type_traits(280): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(284): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(288): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(293): error: integral_constant is not a template
: public integral_constant<bool, (__is_pointer_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(293): error: not a class or struct name
: public integral_constant<bool, (__is_pointer_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(300): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(304): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(309): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(313): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(320): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(324): error: integral_constant is not a template
: public integral_constant<bool, !is_function<_Tp>::value> { };
^

/usr/local/include/c++/4.8.0/type_traits(324): error: not a class or struct name
: public integral_constant<bool, !is_function<_Tp>::value> { };
^

/usr/local/include/c++/4.8.0/type_traits(329): error: integral_constant is not a template
: public integral_constant<bool, (__is_member_object_pointer_helper<
^

/usr/local/include/c++/4.8.0/type_traits(329): error: not a class or struct name
: public integral_constant<bool, (__is_member_object_pointer_helper<
^

/usr/local/include/c++/4.8.0/type_traits(335): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(339): error: integral_constant is not a template
: public integral_constant<bool, is_function<_Tp>::value> { };
^

/usr/local/include/c++/4.8.0/type_traits(339): error: not a class or struct name
: public integral_constant<bool, is_function<_Tp>::value> { };
^

/usr/local/include/c++/4.8.0/type_traits(344): error: integral_constant is not a template
: public integral_constant<bool, (__is_member_function_pointer_helper<
^

/usr/local/include/c++/4.8.0/type_traits(344): error: not a class or struct name
: public integral_constant<bool, (__is_member_function_pointer_helper<
^

/usr/local/include/c++/4.8.0/type_traits(351): error: integral_constant is not a template
: public integral_constant<bool, __is_enum(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(351): error: identifier "__is_enum" is undefined
: public integral_constant<bool, __is_enum(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(351): error: type name is not allowed
: public integral_constant<bool, __is_enum(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(351): error: not a class or struct name
: public integral_constant<bool, __is_enum(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(357): error: integral_constant is not a template
: public integral_constant<bool, __is_union(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(357): error: identifier "__is_union" is undefined
: public integral_constant<bool, __is_union(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(357): error: type name is not allowed
: public integral_constant<bool, __is_union(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(357): error: not a class or struct name
: public integral_constant<bool, __is_union(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(363): error: integral_constant is not a template
: public integral_constant<bool, __is_class(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(363): error: identifier "__is_class" is undefined
: public integral_constant<bool, __is_class(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(363): error: type name is not allowed
: public integral_constant<bool, __is_class(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(363): error: not a class or struct name
: public integral_constant<bool, __is_class(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(369): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(373): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(377): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(381): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(385): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(389): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(393): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(397): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(401): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(405): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(408): error: namespace "std" has no member "nullptr_t"
struct __is_nullptr_t_helper<std::nullptr_t>
^

/usr/local/include/c++/4.8.0/type_traits(409): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(414): error: integral_constant is not a template
: public integral_constant<bool, (__is_nullptr_t_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(414): error: not a class or struct name
: public integral_constant<bool, (__is_nullptr_t_helper<typename
^

/usr/local/include/c++/4.8.0/type_traits(459): error: integral_constant is not a template
: public integral_constant<bool, !is_fundamental<_Tp>::value> { };
^

/usr/local/include/c++/4.8.0/type_traits(459): error: not a class or struct name
: public integral_constant<bool, !is_fundamental<_Tp>::value> { };
^

/usr/local/include/c++/4.8.0/type_traits(463): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(467): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(472): error: integral_constant is not a template
: public integral_constant<bool, (__is_member_pointer_helper<
^

/usr/local/include/c++/4.8.0/type_traits(472): error: not a class or struct name
: public integral_constant<bool, (__is_member_pointer_helper<
^

/usr/local/include/c++/4.8.0/type_traits(481): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(485): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(490): error: not a class or struct name
: public false_type { };
^

/usr/local/include/c++/4.8.0/type_traits(494): error: not a class or struct name
: public true_type { };
^

/usr/local/include/c++/4.8.0/type_traits(499): error: integral_constant is not a template
: public integral_constant<bool, __is_trivial(_Tp)>
^

/usr/local/include/c++/4.8.0/type_traits(499): error: identifier "__is_trivial" is undefined
: public integral_constant<bool, __is_trivial(_Tp)>
^

Gagan
Beginner
303 Views

found a similar post related to my issue here:

http://software.intel.com/en-us/forums/topic/392900

It seems that the way I use clang++ with -stdlib=libc++ -std=c++11 gives me all of the features i need.

it seems the inability to tell icpc that i want to use -stdlib=libc++ is the issue, as clang++ has compilation issues without the stdlib flag.

SergeyKostrov
Valued Contributor II
303 Views

>>...how isn't the thread header in the appropriate /include directory? It is a new addition in STL library. Let me give you some comparison on what is going on with different Visual Studios: - VS 2005 - thread is Not supported - VS 2008 - thread is Not supported - VS 2010 - thread is Not supported - VS 2012 - thread is supported You need to download the most latest version of standalone STL library ( for Linux platforms ) in order to have that header and, of course, a C++ compiler should support latest C++ standard.
Gagan
Beginner
303 Views

so just to be clear:

you're saying icpc is looking for the *LINUX* standard of libc++, which by default is not included with any OS X installation of gcc/g++ by either brew/macports/etc?

Gagan
Beginner
303 Views

I did more digging.

I don't think a standalone version of the C++11 thread library is available yet, as there is a profiteer trying to sell a standalone version of this library: http://www.stdthread.co.uk/forum/index.php/topic,107.0.html

Even this developer says there is trouble with icpc. I am almost certain that the way you guys are asking the tbb_thread to wrap std:;thread is causing an issue, as it can correctly figure out the *type* of each parameter:

aProgram.c(736): error: no instance of constructor "tbb::internal::tbb_thread_v3::tbb_thread_v3" matches the argument list
argument types are: (void (double **&, typedefdStruct *&, double **&, double **&, double **&, double *&, int, int, int, int), <error-type>, <error-type>, <error-type>, <error-type>, <error-type>, <error-type>, int, int, int, int)
threads = tbb::tbb_thread(calcWeights,std::ref(data),std::ref(nbhd),std::ref(W),std::ref(V),std::ref(local_eigs),std::ref(rho),K,d,start, end);

Gagan
Beginner
303 Views

I did more digging.

I don't think a standalone version of the C++11 thread library is available yet, as there is a profiteer trying to sell a standalone version of this library: http://www.stdthread.co.uk/forum/index.php/topic,107.0.html

Even this developer says there is trouble with icpc. I am almost certain that the way you guys are asking the tbb_thread to wrap std:;thread is causing an issue, as it can correctly figure out the *type* of each parameter:

aProgram.c(736): error: no instance of constructor "tbb::internal::tbb_thread_v3::tbb_thread_v3" matches the argument list
argument types are: (void (double **&, typedefdStruct *&, double **&, double **&, double **&, double *&, int, int, int, int), <error-type>, <error-type>, <error-type>, <error-type>, <error-type>, <error-type>, int, int, int, int)
threads = tbb::tbb_thread(aFunction,std::ref(data),std::ref(nbhd),std::ref(W),std::ref(V),std::ref(local_eigs),std::ref(rho),K,d,start, end);

Gagan
Beginner
178 Views

note that what I just showed above is independent of whether the thread is declared as std::thread or tbb:thread:

aProgram.c(734): error: no instance of constructor "tbb::internal::tbb_thread_v3::tbb_thread_v3" matches the argument list
argument types are: (void (double **&, typedefdStruct *&, double **&, double **&, double **&, double *&, int, int, int, int), <error-type>, <error-type>, <error-type>, <error-type>, <error-type>, <error-type>, int, int, int, int)
threads = std::thread(aFunction,std::ref(data),std::ref(nbhd),std::ref(W),std::ref(V),std::ref(local_eigs),std::ref(rho),K,d,start,end);

Reply