a question to start using TBB

a question to start using TBB

kelkch's picture

Hello, I am new to TBB and also newhere.


I have to post questions for a beginning stage. I cannot compile programs with TBB, describe it below:


- Download theStable Release of TBB, tbb20_014oss, then untar the two files. "tbb20_20070927oss_src" and "tbb20_20070927oss_win" two foldersare created at "c:".


- Copy "c: bb20_20070927oss_winia32vc8" to "c: bb20_20070927oss_src".


- Use Visual Studio 2005 to open the project "sub_string_findervc8sub_string_finder.sln", add settings with include directory and library directory in where the ".h" and ".lib" files are, add a link option with "tbb.lib", then Build Solution. It always gets the following error report.


Compiling...
sub_string_finder.cpp
Linking...
Embedding manifest...
Copying tbb.dll
The system cannot find the path specified.
Project : error PRJ0019: A tool returned an error code from "Copying tbb.dll"
Project : warning PRJ0018 : The following environment variables were not found:
$(TBB20_INSTALL_DIR)
Build log was saved at file://C:DOCUME~1kwai LOCALS~1 Temp bb_examples sub_string_finder Release BuildLog.htm"
sub_string_finder - 1 error(s), 0 warning(s)


- In order to bypass this error, I open a new empty Win32 console project, simply add the file "sub_string_finder.cpp" and have the above settings done. This time I can Build Solution with no error. When I run it, anerror window popped up with the message "This application has failed to start because tbb.dll was not found.". Then I copy *.dll in the "vc8in" into the folder with the executable file together. Now I can run it with no error. But it only open a Command Prompt window and the cursor staying there with nothing to output. I check it into Task Manager, I find the CPU Usage is staying 100% with no fluctuation. After I press Ctrl-C to break the running, everything seems to return to normal.



Please provide any helps to solve the above problems. Sorry for my un-concise English. Thanks very much.


14 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Alexey Kukanov (Intel)'s picture
kelkch:

- Download theStable Release of TBB, tbb20_014oss, then untar the two files. "tbb20_20070927oss_src" and "tbb20_20070927oss_win" two foldersare created at "c:".


- Copy "c: bb20_20070927oss_winia32vc8" to "c: bb20_20070927oss_src".


A question to you: did you really intend mixing two releases, or it was just a post misprint?


And, so far so good. At this time, you should just add TBB20_INSTALL_DIR to your Windows environment and set it to "c: bb20_20070927oss_src". After that, examples should work. Please tell us here if it helps.


A little piece of background info: in order to run the executables, VC project files for TBB examples contain a post-build step where the TBB binaries are copied to the working directory of the example (the exactly same thing you did manually in your project). For this to work, we rely on existence of theTBB20_INSTALL_DIR environment variable and also on a certain directory structure (which is preserved in our packages).

kelkch's picture
kelkch:

- Download theStable Release of TBB, tbb20_014oss, then untar the two files. "tbb20_20070927oss_src" and "tbb20_20070927oss_win" two foldersare created at "c:".


- Copy "c: bb20_20070927oss_winia32vc8" to "c: bb20_20070927oss_src".


I don't know these two steps are to mix two releases. I simply think tbb20_20070927oss_win is the binary version of tbb20_20070927oss_src. And the VC settings, Directories of Include files and Directories of Library files, need both of them.ThatI did the copying action is to obey the contents at the download page, ". . .download and untar them, and move any desired {ia32,em64t,itanium} directories into the untarred source package, adjacent to the {build,include,src} directories there."


I added TBB20_INSTALL_DIR to the Windows environment, the warning of "The following environment variables were not found: $(TBB20_INSTALL_DIR)" disappears. But the other errorsstill exist.


------ Rebuild All started: Project: sub_string_finder, Configuration: Release Win32 ------
Deleting intermediate and output files for project 'sub_string_finder', configuration 'Release|Win32'
Compiling...
sub_string_finder.cpp
Linking...
Embedding manifest...
Copying tbb.dll
The system cannot find the path specified.
Project : error PRJ0019: A tool returned an error code from "Copying tbb.dll"
Build log was saved at file://C:DOCUME~1kwaiLOCALS~1 Temp bb_examples sub_string_finder Release BuildLog.htm"
sub_string_finder - 1 error(s), 0 warning(s)


Thank you very much.

Alexey Kukanov (Intel)'s picture

Copying binary files next to the source files for the same release is just fine. But youmentioned tbb20_014oss com-aligned release and then 20070927 stable release, which is why I thought of possible mixing.


At the copying step, did you preserve the structure of directories inside the tarballs, or just copied the DLLs into another dir? You should keep the directory structure, otherwise the VS project files still will not work. In your case, if TBB20_INSTALL_DIR is set to c: bb20_20070927oss_src, there should be c: bb20_20070927oss_srcia32vc8in directory containing the TBB DLLs.

kelkch's picture

Sorry, those are typos. Only "tbb20_20070927oss", and copy "_winia32", not "_winia32vc8".


I can Build Solution with no error right now. For set sub_string_finder, sub_string_finder_extended, sub_string_finder_pretty as StartUp Project respectively, I run them from Start Without Debugging in VC, get three versions of output:


For sub_string_finder, nothing output. CPU Usage stays at 100%.


For sub_string_finder_extended, only one line, "Done build string". CPU Usage stays at 100%.


For sub_string_finder_pretty, a very long output looks like it below:


babbabbabbabbabbabbabbabbabbabbabbab


******************


---------------------


and a Windows message "Press any key to continue. . . .". CPU Usage is normal.



Are these results correct?


I did (and only can) run them on the processors of Pentium 3, Pentium 4(2.8G) and AMD Athlon 64 3500+, all are a bit out of date. The results are same.


Thank you very much again. :)


awh's picture

I've a similar problem. I detail below the steps I've taken so far. I copied the ia32vc8 directory to the src directory on a previous attempt with the same results. If you could assist I'd appreciate it, thanks.

Tony

In Visual Studio 2005, aka 8 try to link the following:

#include "tbb/task_scheduler_init.h"
using namespace tbb;

int main()
{
task_scheduler_init init;

return 0;
}


Downloaded the following TBB src & win directories:

tbb20_20070927oss_src & tbb20_20070927_win from the stable downloads page.

They reside in C:Documents and SettingsAnthonyMy DocumentsTBB

I updated the Visual Studio project settings from Project->itbb properties:

Under Configuration Properties->C/C++->General Additional Include Directories
Added C:Documents and SettingsAnthonyMy DocumentsTBB bb20_20070927oss_srcinclude

Under Configuration Properties->Linker->General Additional Library Directories
Added C:Documents and SettingsAnthonyMy DocumentsTBB bb20_20070927oss_winia32vc8lib

Get the following when attempting to link:

1>------ Build started: Project: itbb, Configuration: Debug Win32 ------
1>Linking...
1>tbb.obj : error LNK2019: unresolved external symbol "public: void __thiscall tbb::task_scheduler_init::initialize(int)" (?initialize@task_scheduler_init@tbb@@QAEXH@Z) referenced in function "public: __thiscall tbb::task_scheduler_init::task_scheduler_init(int)" (??0task_scheduler_init@tbb@@QAE@H@Z)
1>tbb.obj : error LNK2019: unresolved external symbol "public: void __thiscall tbb::task_scheduler_init::terminate(void)" (?terminate@task_scheduler_init@tbb@@QAEXXZ) referenced in function "public: __thiscall tbb::task_scheduler_init::~task_scheduler_init(void)" (??1task_scheduler_init@tbb@@QAE@XZ)
1>C:Documents and SettingsAnthonyMy DocumentsVisual Studio 2005ProjectsitbbDebugitbb.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:Documents and SettingsAnthonyMy DocumentsVisual Studio 2005ProjectsitbbitbbDebugBuildLog.htm"
1>itbb - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Alexey Kukanov (Intel)'s picture

awh,


you should also add tbb_debug.lib (for Release configuration, usetbb.lib) into your project settings as an additional library to link with. Frankly, this is the necessary step if you use any 3rd-party DLL.


And then you will run onto the issue with not being able running your test application because tbb_debug.dll or tbb.dll is not found. Please read the above thread and check the VS project settings of any TBB example to understand how you should solve this.


I hope this advice helps. The good news for you is that we are working on a tool that simplifies setting a VS project to use TBB. Stay tuned!

Alexey Kukanov (Intel)'s picture
kelkch:

For sub_string_finder, nothing output. CPU Usage stays at 100%.


For sub_string_finder_extended, only one line, "Done build string". CPU Usage stays at 100%.


...


Are these results correct?


I did (and only can) run them on the processors of Pentium 3, Pentium 4(2.8G) and AMD Athlon 64 3500+, all are a bit out of date. The results are same.



Is your AMD Athlon dual-core or not? And, does your Pentium 4 system have hyperthreading enabled?


I think that you simply did not wait till the example runs end. For older processors, and especially if there is no additional cores or hyperthreads available, it might take long time. You can reduce it by decreasing static const size_t N in the source files. The algorithm complexity is O(N3), I believe. The value in the "pretty" example is 9, thus it takes much less time comparing to the other two, where N is 22-23.

awh's picture

Thanks so much.

kelkch's picture

Hello, my AMD is single-core. That Pentium 4 is Hyper-Threading, I can see its effects when I run a programthat simply printing iteration numbers with parallel_for frame on it. The number orders are intercrossed. It is really an exciting sight that makes thinking of how strong control in programs. I guess I have openeda Pandora's box. Thank you very much. :)

atul-mathur's picture

Hi,


I am running into similar problems as reported in this thread.


>> The good news for you is that we are working on a tool that simplifies


>> setting a VS project to use TBB. Stay tuned!


Is this tool available?


- Atul

robert-reed (Intel)'s picture

Yes! Check it out at msvs_plugin.

bokee's picture

Hi,Alexey Kukanov
I'm here again

I found this post and learned much.But I still got in trouble.
I can compile and link my Visual C++ 2008 project using TBB.But It crashed for
runtime error R6034 ,said

An application made an attempt to load the C runtime library incorrectly

Do you know how to solve that?
Thanks again

robert-reed (Intel)'s picture

Well, I'm not Alexey, but perhaps I can offer another link. Have you checked out Nikola Dudar's weblog at MSDN? It seems that this R6034 error comes from trying to mix incompatible versions of the MS run time libraries. This entry describes some techniques for avoiding mismatches in the manifest, and offers such advice as ensuring your INCLUDE and LIB paths are clean (probably wouldn't hurt to check your PATH variable as well) and then just be sure to rebuild everything to clear out any old stuff that may be lying around. If you installed VS.NET 2008 on a machine that has older versions of Visual Studio,you may be inadvertently mismatching libraries.

Login to leave a comment.