tungwaiyip.info

home

about me

links

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< July 2009 >
SuMoTuWeThFrSa
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
262728293031 

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Exploring parallel programming

When I first started blogging, I have a lot of geeky posting about software development. The idea of blogging is to write on short subjects frequently. It is different from writing a long article, which is so burdensome many people end up not doing it at all. But in practice, I have not lived up to expectation of a prolific blogger. Sometimes the gap between postings can be a few months.

Anyway this is the quick posting on geeky subject that I think I should do more. Recently I am working on high performance computing and number crunching task. I have dipped into writing C extension for Python for performance. I got spectacular result from the exercise. It is the best of both world. Programming in Python supplement by C is still very agile and iterative. On the other hand C is giving the performance unachievable with pure Python.

I am started to look into the multiprocessing module introduced in Python 2.6. It is a library to run multiple python processes. With an interface similar to the threading module, it is positioning itself as an alternative approach to threading to circumvent the limitation of Python's GIL. I haven't give much thought to it initially. But looking closer, I find it is really more than just an alternative to threading. It is really a parallel programming framework. For example, the method Pool.map() is really a prototype of a mapreduce framework. I am quite excited to explore this module in the coming days.

Another module I am looking at is the ctypes module. It allows Python code to call C functions directly. Again I haven't thought much about it when it was introduced in Python 2.5. That's because I haven't have a use case of it. Now that I am writing C module, I begin to realize how revolutionary it is. C module delivery great performance. But writing one is a pain. Just the need to keep track of reference count may double the number of lines of your code. For me I am not building a reusable module for other people. It is one off function for me to do number crunching. Using ctypes may allow me easier access to C without the burden of actually writing a Python module.

2009.07.12 [, ] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

North Korea faces tighter sanctions under Trump strategy (26 Apr 2017)

 

Turkey suspends more than 9,000 police officers over 'Gulen links' (26 Apr 2017)

 

'Exciting' blood test spots cancer a year early (26 Apr 2017)

 

Trump seeks tax windfall for business (26 Apr 2017)

 

Missing Taiwanese trekker found in Himalayas after 47 days (26 Apr 2017)

 

White Bengal tiger cub quadruplets at Austria zoo (26 Apr 2017)

 

France election: Macron heckled by pro-Le Pen workers (26 Apr 2017)

 

Trump 'considering draft order to scrap Nafta' (26 Apr 2017)

 

IS conflict: Iraqi force 'retakes ancient city of Hatra' (26 Apr 2017)

 

Ann Coulter's Berkeley speech cancelled a day beforehand (26 Apr 2017)

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

1st Twitter revenue drop since IPO, but stock rises (26 Apr 2017)

 

Thai woman has no anger toward Facebook after infant’s killing (26 Apr 2017)

 

U.S. Steel sinks; drinking to the Coup; United’s dead rabbit (26 Apr 2017)

 

Insurer Anthem hands feds deadline on crucial Obamacare subsidies (26 Apr 2017)

 

Novato oxygen tank supplier to pay .4 million settlement (26 Apr 2017)

 

Forget flying cars. Google’s Brin secretly builds an airship (26 Apr 2017)

more »

 


Site feed Updated: 2017-Apr-26 18:00