Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

parallel_for useage and TBB environment setup

Nav
New Contributor I
411 Views
I was going through the TBB tutorials. I've even tried a program using parallel_for.
The strange thing I found was that we have to create a class (where the parantheses are overloaded) to be able to use parallel_for.
So for every time that I want to use a parallel_for in my program, will I have to write a new class for it? It seems crazy, but is that how it happens?

I'm working in Linux (Fedora 8) and I noticed that everytime I start a terminal, I have to run a script which will initialize the environment variables like CPATH and LD_LIBRARY_PATH.
Can't this be automated (I know I can do this in .bashrc but if I move my tbb source folder, I'll have to make a corresponding change in .bashrc) or can't the paths be made permanent?
0 Kudos
1 Solution
Terry_W_Intel
Employee
411 Views
Quoting - sd9
I was going through the TBB tutorials. I've even tried a program using parallel_for.
The strange thing I found was that we have to create a class (where the parantheses are overloaded) to be able to use parallel_for.
So for every time that I want to use a parallel_for in my program, will I have to write a new class for it? It seems crazy, but is that how it happens?

I'm working in Linux (Fedora 8) and I noticed that everytime I start a terminal, I have to run a script which will initialize the environment variables like CPATH and LD_LIBRARY_PATH.
Can't this be automated (I know I can do this in .bashrc but if I move my tbb source folder, I'll have to make a corresponding change in .bashrc) or can't the paths be made permanent?

Hi sd9 -
What Raf said about lamdas. Lambda usage is documented in the most recent TBB manuals. It is much briefer and easier to read syntax. Many of the TBB parallel algorithms now have lambda support.

About paths, yes if your TBB source moves, then the paths change. You can set it in your .bashrc (or source the tbbvars script), but if you move the source, you will need to change the paths in your .bashrc again (or the path to the tbbvars script). The only way to "make the paths permanent" is to put TBB somewhere you want it and don't move it. This holds for any software you install.

Cheers!
Terry

View solution in original post

0 Kudos
3 Replies
RafSchietekat
Valued Contributor III
411 Views
"So for every time that I want to use a parallel_for in my program, will I have to write a new class for it? It seems crazy, but is that how it happens?"
With currently-standard C++, that's the general idea. The next version of the standard will provide lambda's, and this is already supported by TBB as an alternative for use with compilers that already support this new feature, e.g., Intel's own C++ compiler.
0 Kudos
Terry_W_Intel
Employee
412 Views
Quoting - sd9
I was going through the TBB tutorials. I've even tried a program using parallel_for.
The strange thing I found was that we have to create a class (where the parantheses are overloaded) to be able to use parallel_for.
So for every time that I want to use a parallel_for in my program, will I have to write a new class for it? It seems crazy, but is that how it happens?

I'm working in Linux (Fedora 8) and I noticed that everytime I start a terminal, I have to run a script which will initialize the environment variables like CPATH and LD_LIBRARY_PATH.
Can't this be automated (I know I can do this in .bashrc but if I move my tbb source folder, I'll have to make a corresponding change in .bashrc) or can't the paths be made permanent?

Hi sd9 -
What Raf said about lamdas. Lambda usage is documented in the most recent TBB manuals. It is much briefer and easier to read syntax. Many of the TBB parallel algorithms now have lambda support.

About paths, yes if your TBB source moves, then the paths change. You can set it in your .bashrc (or source the tbbvars script), but if you move the source, you will need to change the paths in your .bashrc again (or the path to the tbbvars script). The only way to "make the paths permanent" is to put TBB somewhere you want it and don't move it. This holds for any software you install.

Cheers!
Terry
0 Kudos
Nav
New Contributor I
411 Views

Hi sd9 -
What Raf said about lamdas. Lambda usage is documented in the most recent TBB manuals. It is much briefer and easier to read syntax. Many of the TBB parallel algorithms now have lambda support.

About paths, yes if your TBB source moves, then the paths change. You can set it in your .bashrc (or source the tbbvars script), but if you move the source, you will need to change the paths in your .bashrc again (or the path to the tbbvars script). The only way to "make the paths permanent" is to put TBB somewhere you want it and don't move it. This holds for any software you install.

Cheers!
Terry
Thanks, Raf and Terry!
I had a looks at Lambda functions in Wikipedia. It would be unfair, if only the Intel compilers supported Lambda functions, but I guess it'll be incorporated into gcc soon coz it's going to become a standard.
But *sigh*, I've got a program to make right now, and it'll have to go without Lambda functions.
.bashrc modified. Works like a charm! :)
0 Kudos
Reply