parallel-processing

Parallel ForEach on DataTable

I would like to use the new Parallel.ForEach function to loop through a datatable and perform actions on each row. I am trying to convert the code below: foreach(DataRow drow in dt.Rows) { ... Do Stuff ... } To this code: System.Threading.Tasks.Parallel.ForEach(dt.Rows...

How HBase partitions table across regionservers?

Hello, Please tell me how HBase partitions table across regionservers. For example, let's say my row keys are integers from 0 to 10M and I have 10 regionservers. Does this mean that first regionserver will store all rows with keys with values 0 - 10M, second 1M - 2M, third 2M-3M , ... tenth 9M - 10M ? I would like my row key to be ti...

How can I render MVC Actions in parallel to decrease overall rendering time of page?

I have a page that has a bunch of widgets on it. Each widget is a view. Right now the widget rendering is done in a foreach loop like so. public class WidgetCollection : List<Widget>, IPersonalizable { public void Render(HtmlHelper html) { foreach (Widget w in this) { html.RenderAction("D...

Java: Parallelizing quick sort via multi-threading

I am experimenting with parallelizing algorithms in Java. I began with merge sort, and posted my attempt in this question. My revised attempt is in the code below, where I now try to parallelize quick sort. Are there any rookie mistakes in my multi-threaded implementation or approach to this problem? If not, shouldn't I expect more tha...

Threaded execution speed of LOCK CMPXCHG

I wrote a multi-threaded app to benchmark the speed of running LOCK CMPXCHG (x86 ASM). On my machine (dual Core - Core 2), with 2 threads running and accessing the same variable, I can perform about 40M ops/second. Then I gave each thread a unique variable to operate on. Obviously this means there's no locking contention between the th...

any special reference needed for c# 4.0 Parallel.For ?

I am following this article: http://blogs.msdn.com/b/csharpfaq/archive/2010/06/01/parallel-programming-in-net-framework-4-getting-started.aspx and in my console app Parallel namespace is visible, but "Parallel.For" fails compilation with "type of namespace For does not exist in namespace 'Parallel'". I've scoured the net, but not seei...

simple parallel processing in perl

I have a few blocks of code, inside a function of some object, that can run in parallel and speed things up for me. I tried using subs::parallel in the following way (all of this is in a body of a function): my $is_a_done = parallelize { # block a, do some work return 1; ...

Running unit tests on more than five cores in parallel

I've followed the instructions on http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx to the letter and I can execute tests in parallel. So far so good. Now the problem: I can't set the parallelTestCount to zero (Auto configure) or to a value above 5. Running fiv...

Clojure Parallel Mapping and Infinite Sequences

Let's say I define the sequence of all natural numbers in the following way: (def naturals (iterate inc 0)) I also define a function mapping the naturals to nil that takes a while to compute like so: (defn hard-comp [_] (Thread/sleep 500)) Note the computation time to evaulate the following s-expressions as measured by clojure.core...

Converting graph traversal to multiprocessing in Python

I've been working on a graph traversal algorithm over a simple network and I'd like to run it using multiprocessing since it it going to require a lot of I/O bounded calls when I scale it over the full network. The simple version runs pretty fast: already_seen = {} already_seen_get = already_seen.get GH_add_node = GH.add_node GH_add_e...

How can I make this prime finder operate in parallel

I know prime finding is well studied, and there are a lot of different implementations. My question is, using the provided method (code sample), how can I go about breaking up the work? The machine it will be running on has 4 quad core hyperthreaded processors and 16GB of ram. I realize that there are some improvements that could be m...

Parallel Extension & locking - C#

I am reading the excellent article on Parallel extensions by Joe Albahari. He says, Leveraging multiple cores is easy for most server applications, where each thread can independently handle a separate client request, but is harder on the desktop — because it typically requires that you take your computationally intensive...

Parallelize the content retrieval from database, search and store as HTML

I have a database table having HTML content stored as binary serialized blob. I need to retrieve content one by one, look for certain keywords in the content (and report the matches found) and also save the content to the disk as HTML files. Can I parallize this using Parallel.ForEach? Is this a good Idea or there is a better one. Thank...

What is OpenMP?

What's a high-level description of OpenMP? The Wikipedia article states that "OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms. It consists of a se...

parallel.for question

I have a foreach loop that processes a few thousand xmlnodes from an xmlnodelist. I'm trying to integrate the Parallel.For options from .net 4 but I get an error that "No overload for method 'For' takes 3 arguments'. But every example I see so far has it written this way. Does someone know what I need to change to get this to compile?...

Postgres: How to fire multiple queries in same time?

I have one procedure which updates record values, and i want to fire it up against all records in table (over 30k records), procedure execution time is from 2 up to 10 seconds, because it depends on network load. Now i'm doing UPDATE table SET field = procedure_name(paramns); but with that amount of records it takes up to 40 min to proc...

Retrive multiple urls at once/in parallel

I have a python script that download web page, parse it and return some value from the page. I need to scrape a few such pages for getting the final result. Every page retrieve takes long time (5-10s) and I'd prefer to make requests in parallel to decrease wait time. The question is - which mechanism will do it quick, correctly and with ...

How do I share a transaction across a set of parallel tasks

I have a TransactionScope object and I want to use it for all the tasks created using Parallel.ForEach, how do I achieve this? I want to writing to a message queue in parallel, 20-50 messages, message queue is transactional: using (var queue = new MessageQueue(_exportEndpoint)) { var label = string.Format("{0} ComponentId - {1}...

C# Efficiently Dividing Tasks Between Cores

I'm working on a small simulation that is running on my 8-core workstation. The simulation involves modeling the interactions between a large number of independent nodes. During one phase I need to perform a series of simple atomic operations to each node in parallel. I have been using Parallel.ForEach from System.Threading.Tasks to a...

Parallel.For interruption

Suppose you have an array of 1000 random integer numbers and you need to loop over it to find the number 68 for example. Using the new Parallel.For on a quad core CPU would improve speed considerably, making each core to work only 250 array items. The question is: is it possible to interrupt the Parallel.For loop when the following con...