Cilk++ preview compatible with STLport?

Cilk++ preview compatible with STLport?

Hi all,

I'm trying to introduce Cilk into our (largeish) application, which uses STLport instead of the system STL.

When I'm building (Microsoft Visual Studio 2005 SP1) though I get errors that seem to be related to the STL implementation:

1. I was getting an error about a function implementation using _STL::vector when the declaration used std::vector, but changing the former to std::vector fixed this.

2. I'm getting an error that std::hash_map<> doesn't exist, even when #include is in the beginning of the file. (actual error text: error: namespace "std" has no member "hash_map").
(note: the MS version apparently doesn't implement the hash_map - part of why we use STLport)

These seem consistent with the compiler seeing the MS version of the STL header files instead of the STLport ones, although I'm using the same compiler options as with the rest of our C++ code, which has -I early on in the parameter list.
Does the Cilk++ compiler somehow need the MS STL implementation?

Can anyone suggest how to work around this? I can't just switch STL implementations.

thanks,
Daniel

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Here is an example of a failing program:

#include

#include

int cilk_main(int argc, char* argv[])
{
std::hash_map mymap;

mymap[3] = 4;

return 0;
}

when compiled with 'cilkpp -I stlport_test.cilk', this gives:

Processing stlport_test.cilk...
stlport_test.cilk
stlport_test.cilk(7) : error: namespace "std" has no member "hash_map"
std::hash_map mymap;
^

stlport_test.cilk(7) : error: type name is not allowed
std::hash_map mymap;
^

stlport_test.cilk(7) : error: type name is not allowed
std::hash_map mymap;
^

stlport_test.cilk(7) : error: identifier "mymap" is undefined
std::hash_map mymap;
^

4 errors detected in the compilation of "stlport_test.cilk".

Some more info on this...
If I use /cilkp verbose, it seems that Cilkpp is intentionally including the windows system directories, but it is unclear whether they are before the STLport directories or not.

However, looking at the generated 'stlport_test.i' file, with /cilkp keep, it is definitely including the windows system version of 'hash_map', not the stlport version.

I tried adding /isystem , and even adding /cilkf \[--sys_include
here is the cilkpp output: (with some bolding added)

%...trunk/src/modeler/core/> cilkpp /cilkp verbose /cilkp keep -IC:/memudev/trunk/semu_third_party/STLport/STLport-5.1.3/DotNet2005/stlport stlport_test.cilk
Processing include dir "C:\memudev\trunk\semu_third_party\STLport\STLport-5.1.3\DotNet2005\stlport"
Processing include dir "C:\memudev\trunk\semu_third_party\STLport\STLport-5.1.3\DotNet2005\stlport"
Processing include dir "C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE"
Found .sys_include file in include dir "C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE"
Processing include dir "C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE"
Found .sys_include file in include dir "C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE"
Processing include dir "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include"
Found .sys_include file in include dir "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include"
Processing include dir "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include"
Processing include dir "C:\Program Files\Intel\VTune\Analyzer\include"
Current directory: c:\memudev\trunk\src\modeler\core
CPFE Options: -I "C:\memudev\trunk\semu_third_party\STLport\STLport-5.1.3\DotNet2005\stlport" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include" -I "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include" -I "C:\Program Files\Intel\VTune\Analyzer\include"
CL Options: -I "C:\memudev\trunk\semu_third_party\STLport\STLport-5.1.3\DotNet2005\stlport" -I "C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE" -I "C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE" -I "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include" -I "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include" -I "C:\Program Files\Intel\VTune\Analyzer\include" /EHsc
Predefined macros:
#define _MT 1
#define _INTEGRAL_MAX_BITS 64
#define _M_IX86 600
#define _M_IX86_FP 0
#define __CLRCALL_OR_CDECL
Invalid CL Options:
YASM Options:
Link Options: /INCREMENTAL:NO
Keep Temp Files: True
Link Image: True
Debug Image: False
Compile as C++: False
Processing stlport_test.cilk...

CL Preprocessor
"C:\Program Files\Microsoft Visual Studio 8\VC\bin\cl.exe" /nologo /P /TP -IC:/memudev/trunk/semu_third_party/STLport/STLport-5.1.3/DotNet2005/stlport /I "c:\Program Files\Intel\Cilk\include" "stlport_test.cilk"
stlport_test.cilk

CL Preprocessor returned 00000000

CPFE
"c:\Program Files\Intel\Cilk\bin\cpfe.exe" --no_wrap_diagnostics --diag_suppress 0001,0174,0177,0381,0550 --microsoft_version 1400 --preinclude_macros "C:\DOCUME~1\dfaken\LOCALS~1\Temp\CLK31.tmp" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\include" --include "c:\Program Files\Intel\Cilk\include" --import_dir "c:\memudev\trunk\src\modeler\core" -I "C:\memudev\trunk\semu_third_party\STLport\STLport-5.1.3\DotNet2005\stlport" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE" --sys_include "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include" -I "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include" -I "C:\Program Files\Intel\VTune\Analyzer\include" --gen_c_file_name "c:\memudev\trunk\src\modeler\core\stlport_test.cilka" "stlport_test.cilk"
stlport_test.cilk(7) : error: identifier "hash_map" is undefined
hash_map mymap;
^

stlport_test.cilk(7) : error: type name is not allowed
hash_map mymap;
^

stlport_test.cilk(7) : error: type name is not allowed
hash_map mymap;
^

stlport_test.cilk(7) : error: identifier "mymap" is undefined
hash_map mymap;
^

4 errors detected in the compilation of "stlport_test.cilk".

CPFE returned 00000002

CilkPP returning 00000002

thanks for any help
- Daniel

Yes, your analysis is correct. Cilkpp is forcing the Visual Studio include directories in front of yours. I'll try reorganizing the CPFE options and send you a new copy of cilkpp to try out.

- Barry

Unfortunately, I don't seem to be able toextract your email address to mailyou a new copy. So I think I've managed to add cilkpp-2010-04-01.zip as an attachment to this reply.

cilkpp-2010-04-01.zipcontainsan updated copy of cilkpp.exe whichshould go into the bin directory of the Cilk installation. The new version moves the inclusion of the Visual Studio C++ directory to the end of the command.

To be safe, please save the kit's copy of cilkpp.exe, and then copy the copy from this zipfile into the bin directory.

- Barry

Attachments: 

AttachmentSize
Download cilkpp-2010-04-01.zip29.79 KB

Barry,

Thanks very much!
If I actually get it to fully compile I'll try to post another message here - I'm getting compiler errors involving boost (1.41) and STLport 5.2.1, and it may take a little while to figure them out (but suggestions are welcome).
In case it helps anyone, using STLport 5.1.3 with boost 1.41 had even more errors, so it appears the later version is better.

If you want to send me a message, I enabled 'accept messages' in my profile (hopefully it will tell me when I have a message!).

BTW, I did have one other problem with cilkpp - it was crashing saying "Command-line error: too many arguments on command line".
I had about 118 parameters (or so), and removing a few of them (some include paths not used by the Cilk code) resolved this - but maybe there is some hard-coded parameter that needs increasing. Or maybe its in MS code.

Anyway, thanks again.

Daniel

Pablo Halpern (Intel)'s picture

I'm afraid that Cilk++ is not fully compatible with some of the more template-heavy boost libraries.
If you are using any boost library that makes heavy use of template metaprogramming, I'm afraid you have some work to do. Theproblem stems from the distinction that Cilk++ makes between C++types and Cilk++types. The most succesfully approach we've seen is to compile all of the boost-using code as Cilk. This often means compiling most or all of your entire application as Cilk, which may or may not be OK with you. Another approach is to clone Boost, change the namespace, and compile the Cilk++ code with one copy and the C++ code with the other.

I wish I had better news for you, but things will get better in the next six months or so.

Good luck,
-Pablo

Login to leave a comment.