Results 1 to 4 of 4

Thread: OpenMP Alternative.

  1. #1
    Kerstan Henry is offline Senior Member
    Join Date
    May 2011
    Posts
    200
    Rep Power
    3

    Default OpenMP Alternative.

    Hello, Again and again, it bothers me that if I write a simple program that I eg any large number i calculated, I always use only one thread. But I want to use ALL! If I then search the Internet for a solution I hit on constantly OpenMP! I've tried, but somehow I do not get this implemented properly. Often it comes down to "Critical sections"! Is there perhaps an alternative with which I, for example, can also speed up court? And why can one not set in Visual Studio, how many cores the program can claim up?

  2. #2
    Pepin Daire is offline Senior Member
    Join Date
    May 2011
    Posts
    172
    Rep Power
    3

    Default

    You can do it why not set in Visual Studio, because C + + has no mechanisms to automatically distribute your calculations on multiple threads. I know not whether you actually have is a programming language. So you have to manually create threads and fill them with useful code. The one with the "critical sections" is probably because you read a thread data while you write with the other thread data in the same memory space.To prevent the semaphores are often used to set a variable for other threads to block. Read out the wiki article about deadlocks through before you program further.

  3. #3
    Pepin Susanna is offline Senior Member
    Join Date
    May 2011
    Posts
    190
    Rep Power
    3

    Default

    I know with OpenMP only conditionally, but my general understanding of parallel programming, could be a "critical section", a code section to be in the potentially multiple threads simultaneously access the same memory area. When something like it is the duty of the programmer to ensure that only one thread always changed at the same time the storage area. (Keyword mutex, OpenMP has definitely something to create a mutex). Alternative to OpenMP would take over the parallelization itself. Possible, for example, by Linus with the pthreads library. Otherwise, the same OpenCL to really to program massively parallel also (including GPU.


    Overall, I think that you lack a bit of an understanding of parallel programming. Simply saying: use the program, 3 cores! does not matter if the program is not written so that it can also start with 3 cores, what! Is not a program written in parallel, it can not use multiple threads. For as little as possible to deal with concurrency, but afaik is OpenMP for C + + is the easiest way, because actually there at least does not have to create all the threads yourself.

  4. #4
    Oran Albert is offline Senior Member
    Join Date
    May 2011
    Posts
    233
    Rep Power
    3

    Default

    You can say as a tip, that is the calling of std :: cout very expensive and you can not accelerate it. It would be appropriate to write the output to a log file or on special occasions for display only cout. But if you wanna go hang yourself in the matter, so wear the first few sets of film on page 56 in the first film set for a parallel calculation of pi to get through OpenMP.

Similar Threads

  1. QuickTime Alternative 3.1.0
    By Peter dmello in forum Download Tools and Softwares
    Replies: 0
    Last Post: 11-21-2009, 10:06 AM
  2. QuickTime Alternative 3.0.1
    By andrea55 in forum Download Tools and Softwares
    Replies: 0
    Last Post: 11-03-2009, 12:36 PM
  3. Real Alternative 2.01
    By Gaven Doeschate in forum Download Tools and Softwares
    Replies: 0
    Last Post: 10-14-2009, 08:34 AM
  4. QuickTime Alternative 3.0.0
    By Anne Bancroft in forum Download Tools and Softwares
    Replies: 0
    Last Post: 10-11-2009, 08:10 AM
  5. Real Alternative 2.00
    By chreshel in forum Download Tools and Softwares
    Replies: 0
    Last Post: 09-09-2009, 11:35 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48