Boost logo

Boost Users :

From: Mike Marchywka (marchywka_at_[hidden])
Date: 2008-08-18 18:12:57


> From: storri_at_[hidden]
> To: boost-users_at_[hidden]
> Date: Mon, 18 Aug 2008 14:50:11 -0500
> Subject: [Boost-users] How to transform a single-threaded program into a multi-threaded program? (Source example)
>
> What I am trying to learn how to do is convert a single threaded program
> into a multi-threaded program. The task of the program is to analyze a

Do you want to learn boost or threading?

> text file a set number of times. Each analysis of the text file does not
> depend on another. The only thing that they need is the name of the
> file, how many iterations of the analysis to do and a unique id. I am
> not concerned about the information from each round being printed in
> sequential order. That is for example if thread A has a unique ID of 50
> and thread B has a unique ID of 51 that I want thread B's output ahead
> of thread A's output. The output is going to be captured into a file and
> post-processed in a spreadsheet application.
>

> Below is a running example of what I am trying to do.
>
> To restate my question:
>
> How do I use boost threads to make a multi-threaded version of
> this program?
>

I don't know anything about boost threads but I would like to point out that
on a single processor system it is likely to make performance worse. What may
be of more interest for this application is generalizing your operations and trying
to find a way to "compile" or transform query and text file to make each "pass"
faster and arrange passes to avoid memory access problems. For example, making multiple
passes thru a file could be slower than making one pass against multiple criteria if
the file is bigger than a cache size, or worse needs to be read from disk each time.

I had some specialized REGEX tasks for 1000's of simplified patterns to search
over 10-100 sequences up to megabytes long. Rather than make a naive pass
for each pair, I could do various things once, including building a "Table of contents"
or index for the sample sequences, that may this practical.

The only reason I mention this is because memory accesses are often ignored
and can be more important than instruction count in an inner loop. Cumbersome
specialized code like a sequence indexer may not fit well into existing performance
libraries but should be something to consider now or in the future.

While I am not particularly biased towards Intel,I would encourage you search their
site for their performance guides that explain many issues as regards their chips.

>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

_________________________________________________________________
Be the filmmaker you always wanted to be—learn how to burn a DVD with Windows®.
http://clk.atdmt.com/MRT/go/108588797/direct/01/


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net