Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

C++11 on the Intel MTL

Francesco_C_
Beginner
1,236 Views

Intel has generously given me access to the Manycore Testing Lab to benchmark some C++11 algorithms for non-blocking shared memory read/write I developed, but unfortunately I could not get my software to compile therein (everything works just fine on my home PC using gcc 4.7.2).

I use the following C++11 features: std::function, thread, mutex, sleep_for, atomics. Compiling with Parallel Studio XE 2016 (as suggested to me by the MTL Team) I obtained the following errors:

  1. cannot open source file "cstdint"
  2. cannot open source file "thread"
  3. namespace "std" has no member "function"

I was able to solve issue 1 replacing <cstdint> with <stdint.h> but I could not overcome problem 2 and 3. I compiled with the -std=c++11 option (also tried -std=c++0x).

I'm sorry if I just missed some options and this is a silly problem. Can you help me?

Thanks!

0 Kudos
1 Solution
TimP
Honored Contributor III
1,237 Views

If you haven't done so, take care that ld_library_path is consistent with your g++ path, so that it doesn't try to run with older libraries.

 

 

 

 

View solution in original post

0 Kudos
6 Replies
TimP
Honored Contributor III
1,237 Views

I'm guessing you may have hoped that 'icc file.cpp' would switch automatically to icpc without you adding -x c++ or equivalent.  A more specific example, of your compile command, preferably with a source file, should help.  You would also want to check which g++ version is on path, as icpc uses g++ to find the headers.

Follow-up should probably be on the C++ forum

https://software.intel.com/en-us/forums/intel-c-compiler

0 Kudos
Francesco_C_
Beginner
1,237 Views

Tim P. wrote:

I'm guessing you may have hoped that 'icc file.cpp' would switch automatically to icpc without you adding -x c++ or equivalent.  A more specific example, of your compile command, preferably with a source file, should help.  You would also want to check which g++ version is on path, as icpc uses g++ to find the headers.

Follow-up should probably be on the C++ forum

https://software.intel.com/en-us/forums/intel-c-compiler

 

Dear Tim, thanks for the reply. I was already using icpc but your comment has been nevertheless useful. I've just checked and the g++ version on the path was too old. I updated the path in order to have a newer one (4.4.3)  and now it compiles fine. The build command I use is (after doing "source /opt/intel/bin/compilervars.sh intel64"):

icpc -D_GLIBCXX_USE_NANOSLEEP -Iinclude -std=c++11 -pthread test/main.cpp -o ART

You can find the source code here: https://github.com/fcvr1010/ART/tree/ARSS/ART

In particular, in test/main.cpp, I uncommented the first line of code, so basically my main is that contained in test/internal/NB_ARSS_1_Check.cpp

Unfortunately, when I try to run the resulting executable I obtain the following error:

/usr/lib64/libstdc++.so.6 : version 'GLIBCXX_3.4.11' not found

How can I solve this issue? Am I doing something terribly wrong? :-)

Ps. As you suggested, I will also post the question on the C++ forum.

 

0 Kudos
TimP
Honored Contributor III
1,238 Views

If you haven't done so, take care that ld_library_path is consistent with your g++ path, so that it doesn't try to run with older libraries.

 

 

 

 

0 Kudos
Bernard
Valued Contributor I
1,237 Views

Regarding problem #3

Did you include header file "functional" ?

0 Kudos
Francesco_C_
Beginner
1,237 Views

Tim P. wrote:

If you haven't done so, take care that ld_library_path is consistent with your g++ path, so that it doesn't try to run with older libraries.

 

How could I not have thought about that?! I'm sorry this was actually a very stupid issue. Maybe I was just confused by the fact that I was not working on my machine. Many thanks for your kind help, it solved the problem.

0 Kudos
Francesco_C_
Beginner
1,237 Views

iliyapolak wrote:

Regarding problem #3

Did you include header file "functional" ?

Yes, I did. The issue is now solved thanks to Tim P. help. Nevertheless, thank you for the help!

0 Kudos
Reply