tungwaiyip.info

home

about me

links

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

 

Chris Parry and Andrew Bagshaw's bodies recovered in prisoner swap - Ukraine (04 Feb 2023)

 

China urges calm over 'spy' balloon in US airspace (04 Feb 2023)

 

Tyre Nichols: Sixth police officer fired (04 Feb 2023)

 

Japan PM fires aide over derogatory LGBT remarks (04 Feb 2023)

 

Perth shark attack: Teenage girl dies in Swan River (04 Feb 2023)

 

Pakistan blocks Wikipedia for 'blasphemous content' (04 Feb 2023)

 

Pope in South Sudan tells clergy to raise voices against injustice (04 Feb 2023)

 

Coldest wind chill ever recorded in continental US, say forecasters (04 Feb 2023)

 

Canadian teen wins lotto jackpot on first try (04 Feb 2023)

 

Elon Musk found not guilty of fraud over Tesla tweet (04 Feb 2023)

more »

 

SF Gate

 

Salesforce, SF's largest employer, drops more people as part of January layoffs (2 Feb 2023)

 

Rivian lays off another 6% of workforce, hitting Bay Area and Irvine offices (1 Feb 2023)

 

Best Background Check Services: Top 13 People Finder Sites Reviewed and Ranked (1 Feb 2023)

 

Bay Area tech company Workday laying off hundreds of employees (1 Feb 2023)

 

Bay Area's PayPal sacks 2,000 workers, capping off brutal month for tech (31 Jan 2023)

 

Intel warns officials it plans 343 layoffs at its Folsom campus (31 Jan 2023)

more »


Site feed Updated: 2023-Feb-04 09:00