Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Swapnil_J_
Beginner
410 Views

Task Parallelization

Hello firends,

    I have successfully done threading and data Parallelization. But, I am really intrested in task Parallelization. How will i do it? How will I start it?

Please guide me.

0 Kudos
48 Replies
mecej4
Black Belt
268 Views

Your question has to be addressed in the context of the operating system (OS). Task parallelization requires support from the OS and, to a lesser extent, from the compiler. The issues are largely independent of the programming language used and, therefore, of the compiler.
TimP
Black Belt
268 Views

You might look into some of the more frequently advocated parallel tasking models, such as OpenMP task, or tbb:task, which are meant to apply in more than one OS, with support from the compiler. This might help you to clarify your question.
Swapnil_J_
Beginner
268 Views

I want to specify specific core for executing task. how will i do it? and Is it possible in intel composer?
TimP
Black Belt
268 Views

OpenMP and tbb have affinity setting options to limit execution to a specified group of cores. You might accomplish what you requested indirectly by selecting a thread ID, or more directly at a lower level (e.g. pthreads), but usually this limits the portability of your program without any compensating benefit.
Swapnil_J_
Beginner
268 Views

Can any one give me any sample code for Task Parallelization? (Two Diffrent task e.g Suppose CPU Core 1 and CPU Core 2 is doing addition and CPU Core 3 and CPU Core4 doing Mutiplication Operation. Such type of Parallel tasking is required.) Thanks, In advance!!!
TimP
Black Belt
268 Views

Required by a homework assignment? Surely you have relevant course material. As you state it here, it makes little sense.
Sigehere_S_
Beginner
268 Views

Hello TimP(intel) Is it possible using Intel XE Composer as Swapnil told? that means two diffrent task parallelization using openmp.
TimP
Black Belt
268 Views

In case you haven't looked at them, a search command such as task example site:software.intel.com should show several papers on a similar subject, including both openmp and tbb.
Sigehere_S_
Beginner
268 Views

Hi guys, I have Copy and peast following TBB code: and I am trying to execute this code i got follwoing error: #include < cstdio > #include < cstdlib > #include < cstring > #include < ctype > #include "parallel_reduce.h" #include "blocked_range.h" #include "task_scheduler_init.h" #include "tick_count.h" using namespace tbb; // Uncomment the line below to enable the auto_partitioner #define AUTO_GRAIN struct Sum { float value; Sum() : value(0) {} Sum( Sum& s, split ) {value = 0;} void operator()( const blocked_range& range ) { float temp = value; for( float* a=range.begin(); a!=range.end(); ++a ) { temp += *a; } value = temp; } void join( Sum& rhs ) {value += rhs.value;} }; float ParallelSum( float array[], size_t n ) { Sum total; #ifndef AUTO_GRAIN parallel_reduce( blocked_range( array, array+n, 1000 ), total ); #else /* AUTO_GRAIN */ parallel_reduce( blocked_range( array, array+n ), total, auto_partitioner() ); #endif /* AUTO_GRAIN */ return total.value; } //! Problem size const int N = 1000000; //! Number of threads to use. static int MaxThreads = 4; //! If true, print out bits of the array static bool VerboseFlag = false; //! Parse the command line. static void ParseCommandLine( int argc, char* argv[] ) { int i = 1; if( i < N; ++i ) { input = (float)(rand() % 10); } if( VerboseFlag ) { printf(" Input: "); for ( size_t i = 0; i < 7; ++i ) { printf("%7.2f ", input); } printf("...\n"); } // Try different numbers of threads for( int p=1; p<=MaxThreads; ++p ) { task_scheduler_init init(p); tick_count t0 = tick_count::now(); float output = ParallelSum(input, N); tick_count t1 = tick_count::now(); if( VerboseFlag ) { printf("Output: %7.2f\n", output); } printf("%2d threads: %.3f msec\n", p, (t1-t0).seconds()*1000); } return 0; } # icc -O2 -g -DNDEBUG sample2.c -ltbb sample2.c(5): catastrophic error: cannot open source file "parallel_reduce.h" #include "parallel_reduce.h" ^ compilation aborted for sample2.c (code 4) How will i solve this error: I am new in Parallel Programming and Intel Composer.
Swapnil_J_
Beginner
268 Views

Hi Sigehere, Just Change that follwoing lines #include "parallel_reduce.h" #include "blocked_range.h" #include "task_scheduler_init.h" #include "tick_count.h" With this lines: #include "tbb/parallel_reduce.h" #include "tbb/blocked_range.h" #include "tbb/task_scheduler_init.h" #include "tbb/tick_count.h" I hope it will work.
SergeyKostrov
Valued Contributor II
268 Views

>>...I want to specify specific core for executing task. how will i do it? It is OS dependent. For example, on Windows platforms you need to execute a SetThreadAffinityMask Win32 API function. It also could be done with OpenMP and in that case it will be OS independent. Of course if there is an OpenMP library for a C/C++ compiler that builds codes for that OS. >>...and Is it possible in intel composer? No. You need to use some OS dependent API.
Swapnil_J_
Beginner
268 Views

Hi Sergey, I am using Intel i7 (4 cores and 8 thread processor) with 8GB RAM and Ubuntu 12.04 Opearating System. Can you explain me? How will I achive parallel Tasking on such system (i.e. I want to do two different operation on different cores of prcessor). Please Explain me how will i do it. I am new in parallel programming.
Bernard
Black Belt
268 Views

>>>I am using Intel i7 (4 cores and 8 thread processor) with 8GB RAM and Ubuntu 12.04 Opearating System.>>> You need to consult Linux API which deals solely with thread scheduling and dispatching and it is accessible to the client programmer. I would recommend you to read this chapter and later to read whole book :http://oreilly.com/catalog/linuxkernel/chapter/ch10.html I do not know how in the Linux you are supposed to call System functions I mean those routines related to process scheduling.
TimP
Black Belt
268 Views

I'd like to repeat a recommendation to start with OpenMP or TBB to learn enough to know whether you have a reason to dig into pthreads programming. Note the number of tutorials on the general area, such as https://computing.llnl.gov/tutorials/parallel_comp/ https://computing.llnl.gov/tutorials/pthreads/
Swapnil_J_
Beginner
268 Views

hello friend, Anybody have any idea about how to use CPU cache L1, L2..... in our multithreading application with Intel XE composer.
SergeyKostrov
Valued Contributor II
268 Views

>>...Anybody have any idea about how to use CPU cache L1, L2... Please take a look at Intel Manuals for more information located at: www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
Sigehere_S_
Beginner
268 Views

Hi Sergey Kostrov & Swapnil Can you elaborate how will i use CPU cache in my program? On OS level I know that cache is maintain automatically, On the bases of which memory address is frequently access. but if we forcefully apply specific part of my program on CPU cache then it helpful to optimize my code. Please give me proper solution for using cache. >> Sergey Kostrov I have seen this link which contain many reference manual. can you tell me which is very useful for managing CPU cache in my program manually? Thanks all of gays for giving response in advance!!! :)
Bernard
Black Belt
268 Views

Sigehere S. wrote:

Hi Sergey Kostrov & Swapnil
Can you elaborate how will i use CPU cache in my program?
On OS level I know that cache is maintain automatically, On the bases of which memory address is frequently access.
but if we forcefully apply specific part of my program on CPU cache then it helpful to optimize my code.
Please give me proper solution for using cache.

>> Sergey Kostrov
I have seen this link which contain many reference manual. can you tell me which is very useful for managing CPU cache in my program manually?

Thanks all of gays for giving response in advance!!!
:)

As Sergey advised please consult Intel processor manuals.It is definitive source of knowledge for the programmers. Please follow this link:http://blogs.msdn.com/b/oldnewthing/archive/2009/12/08/9933836.aspx
SergeyKostrov
Valued Contributor II
268 Views

Hi everybody, >>...I have seen this link which contain many reference manual. can you tell me which is very useful for managing CPU >>cache in my program manually? I will provide more details soon ( that is, chapters, pages, etc ).
Sigehere_S_
Beginner
128 Views

Hi iliyapolak, you have given following link, >>Please follow this link:http://blogs.msdn.com/b/oldnewthing/archive/2009/12/08/9933836.aspx It is useful for finding CPU cache size/limit. Thanks for that But, I am interesting in using CPU cache in my own program manually or forcefully Do you have any idea about it?
Reply