Parallel and Concurrent Programming in Haskell

As one of the developers of the Glasgow Haskell Compiler (GHC) for almost 15 years, I have seen Haskell grow from a niche research language into a rich and thriving ecosystem. I spent a lot of that time working on GHC’s support for parallelism and concurrency. One of the first things I did to GHC in 1997 was to rewrite its runtime system, and a key decision we made at that time was to build concurrency right into the core of the system rather than making it an optional extra or an add-on library. I like to think this decision was founded upon shrewd foresight, but in reality it had as much to do with the fact that we found a way to reduce the overhead of concurrency to near zero (previously it had been on the order of 2%; we’ve always been performance-obsessed). Nevertheless, having concurrency be non-optional meant that it was always a first-class part of the implementation, and I’m sure that this decision was instrumental in bringing about GHC’s solid and lightning-fast concurrency support.

Haskell has a long tradition of being associated with parallelism. To name just a few of the projects, there was the pH variant of Haskell derived from the Id language, which was designed for parallelism, the GUM system for running parallel Haskell programs on multiple machines in a cluster, and the GRiP system: a complete computer architecture designed for running parallel functional programs. All of these happened well before the current multicore revolution, and the problem was that this was the time when Moore’s law was still giving us ever-faster computers. Parallelism was difficult to achieve, and didn’t seem worth the effort when ordinary computers were getting exponentially faster.

Around 2004, we decided to build a parallel implementation of the GHC runtime system for running on shared memory multiprocessors, something that had not been done before. This was just before the multicore revolution. Multiprocessor machines were fairly common, but multicores were still around the corner. Again, I’d like to think the decision to tackle parallelism at this point was enlightened foresight, but it had more to do with the fact that building a shared-memory parallel implementation was an interesting research problem and sounded like fun. Haskell’s purity was essential—it meant that we could avoid some of the overheads of locking in the runtime system and garbage collector, which in turn meant that we could reduce the overhead of using parallelism to a low-single-digit percentage. Nevertheless, it took more research, a rewrite of the scheduler, and a new parallel garbage collector before the implementation was really usable and able to speed up a wide range of programs. The paper I presented at the International Conference on Functional Programming (ICFP) in 2009 marked the turning point from an interesting prototype into a usable tool.

All of this research and implementation was great fun, but good-quality resources for teaching programmers how to use parallelism and concurrency in Haskell were conspicuously absent. Over the last couple of years, I was fortunate to have had the opportunity to teach two summer school courses on parallel and concurrent programming in Haskell: one at the Central European Functional Programming (CEFP) 2011 summer school in Budapest, and the other the CEA/EDF/INRIA 2012 Summer School at Cadarache in the south of France. In preparing the materials for these courses, I had an excuse to write some in-depth tutorial matter for the first time, and to start collecting good illustrative examples. After the 2012 summer school I had about 100 pages of tutorial, and thanks to prodding from one or two people (see the Acknowledgments), I decided to turn it into a book. At the time, I thought I was about 50% done, but in fact it was probably closer to 25%. There’s a lot to say! I hope you enjoy the results.

Audience

You will need a working knowledge of Haskell, which is not covered in this book. For that, a good place to start is an introductory book such as Real World Haskell (O’Reilly), Programming in Haskell (Cambridge University Press), Learn You a Haskell for Great Good! (No Starch Press), or Haskell: The Craft of Functional Programming (Addison-Wesley).

How to Read This Book

The main goal of the book is to get you programming competently with Parallel and Concurrent Haskell. However, as you probably know by now, learning about programming is not something you can do by reading a book alone. This is why the book is deliberately practical: There are lots of examples that you can run, play with, and extend. Some of the chapters have suggestions for exercises you can try out to get familiar with the topics covered in that chapter, and I strongly recommend that you either try a few of these, or code up some of your own ideas.

As we explore the topics in the book, I won’t shy away from pointing out pitfalls and parts of the system that aren’t perfect. Haskell has been evolving for over 20 years but is moving faster today than at any point in the past. So we’ll encounter inconsistencies and parts that are less polished than others. Some of the topics covered by the book are very recent developments: Chapters 4, 5, 6, and pass:[14 cover frameworks that were developed in the last few years.

The book consists of two mostly independent parts: Part I and Part II. You should feel free to start with either part, or to flip between them (i.e., read them concurrently!). There is only one dependency between the two parts: Chapter 13 will make more sense if you have read Part I first, and in particular before reading “The ParIO monad”, you should have read Chapter 4.

While the two parts are mostly independent from each other, the chapters should be read sequentially within each part. This isn’t a reference book; it contains running examples and themes that are developed across multiple chapters.

Attend Meeting C++ 2013

Boost Dependency Analyzer

I have something special to announce today. A tool I’ve build over the last 2 weeks, which allows to analyze the dependencies in boost. With boost 1.53 this spring, I had the idea to build this, but not the time, as I was busy writing a series over the Papers for Bristol. Back then I realized, how easy it could be to build such a tool, as the dependencies could be read & listed by boosts bcp tool. I already had a prototype for the graphpart from 2010. But lets have a look at the tool:

The tool is very easy to handle, it is based on the out of bcp, which is a tool coming with boost. Actually bcp can help you with ripping libraries out of boost, so that you don’t have to add all of boost to your repository when you would like to use smartpointers. But bcp also has a listing mode, where it only shows the dependencies thats whats my tool build up upon. Lets have a short look at the results, the dependencies of boost 1.54:

A few words on how to read this graph. The libraries in the middle of the “starshape” are the ones with the most dependencies, each line between the nodes is a dependency. A dependency can be one or multiple files. The graphlayout is not weighted.

How to

A short introduction on what you need to get this tool to run. First boost, as this tool is build to analyze boost. I’ve tested with some versions (1.49 – 1.54) of boost. You also need a version of bcp, which is quite easy to build (b2 tools/bcp). Then you simply need to start the tool, if BOOST_ROOT is set, the tool will try to read it, other wise you will be asked to choose the location of boost when clicking on Read dependencies. Next thing is selecting the location of bcp. That is the setup, and the tool will now run for some time. On my machine its 90 seconds to 2 minutes the analysis takes, it might be lot longer on yours, depending on how much cores you got. The tool will spawn for each boost library (~112) a bcp process, and analyze this output in a thread pool. After this is done, the data is loaded into the tool, and then saved to a SQLITE database, which will be used if you start the tool a second time and select this version of boost. Loading from the database is far faster.

A screenshot to illustrate this:

tl_files/blog/bda/bda.png

To the left are all the boost libraries, the number of dependencies is shown in the braces. To the right is a Tabwidget showing all the dependencies, the graph is layouted with boost graph. When you click on show all you’ll get the full view of all dependencies in boost. The layouting is done in the background, so this will take some time to calculate, and is animated when its done. The results of the layouting are good, but not perfect, so that you might have to move some nodes. Exporting supports images, which are transparent PNGs, not all services/tools are happy with that (f.e. facebook, twitter nor G+ could handle the perfectly fine images), this can be fixed by postprocessing the images and adding a white background.

Inner workings

I’ve already written a little about the tools inside, its build with Qt5.1 and boost. Where boost is mostly used for the graph layouting. As I choose to work with Qt5, it has a few more dependencies, for windows this sums up to a 18 mb download, which you’ll find at the end. The tool depends on 3 libraries from my company Code Node: ProcessingSink, a small wrapper around QProcess, that allows to just start a bunch of processes, and lets you connect to the finished and error slot. This was necessary, as I could only spawn 62 parallel processes under windows, so this library does take care of spawning the parallel processes now. Which are currently 50 at a time. GraphLayout is the code that wraps the innerworkings of boost::graph, its a bit dirty, but lets me easily process the graphlayouting. The 3rd library is NodeGraph, which is the Graph UI, based on Qts GraphicsView Framework.
I plan to release the tool and its libraries under GPL later on github, for now I don’t have the time to polish everything.

Problems

One of the earliest questions I had when thinking about building such a tool, was where to get a list of the boost libraries? This sounds easy. But I need to have this readable by machine, not human, so HTML is a great format, but I refused to write a parser for this list yet. I talked to some people about this at C++Now, and most agreed, that the second option would be best: maintainers.txt. Thats what the tool reads currently to find the boost libraries. Unfortunately at least lexical_cast is missing in this list. So, the tool isn’t perfect yet, while lexical_cast is already patched, I’m not sure if anything else is missing. A candidate could be signals, as its not maintained anymore. Currently the tool analyzes for 1.54 112 libraries.

boost dependencies

Working for 2 weeks on this tool has given me some inside knowledge about the dependencies in boost. First, the way it is shown in the tool, is the view of bcp. Some dependencies will not affect the user, as they are internal. f.e. a lot of libraries have a dependency to boost::test, simply because they provide their tests with it. The bcp tool really gets you ALL the dependencies. Also most (or was it all?) libraries depend on boost::config. I plan to add filtering later, so that the user has the ability to filter some of the libraries in the GraphView.

The tool

Here is how to get the tool for now: there is a download for the binaries for windows and linux. I’ll try to get you a deb package as soon as I have time, but for now its only the binaries for linux, you’ll have to make sure to have Qt5.1 etc. on linux too, as I do not provide them. For Windows, its 2 archives you’ll need to download: the programm itself, and needed dlls for Qt5.1 if you don’t have the SDK installed ( in this case you also could copy them from the bin directory)

Note on linux: this is a one day old beta version. Will update this later.

Green Hills Software Announces AdaMULTI Support for ARM-Based Processors

SANTA BARBARA, CA–(Marketwired – Jul 2, 2013) – Green Hills Software, the largest independent vendor of embedded software solutions, has announced the availability of a complete integrated development environment for Ada users, who are targeting systems based on ARM® processors. AdaMULTI™ development environment for ARM has been created in response to increasing demand for ARM devices in embedded applications due to their excellent power/performance ratios and relative cost effectiveness.

The Ada programming language is typically used on projects that have real-time constraints, are developed by sizeable teams and require longevity of support. It is widely adopted in the defense sector and in security applications, such as access control. With the increasing requirement to extend the operating life of battery-powered equipment used on missions or remotely deployed in the field, ARM-based processors are being selected because of their ability to deliver the necessary performance with a reduced power budget.

Green Hills Software’s customers can rehost their existing Ada95 based applications with the new compilation environment. Additionally, some new features that have recently been added to the language are also included in the new release.

AdaMULTI for ARM is a fully integrated development environment that contains all the tools needed to complete a major programming project. These include: launcher, project manager, editor, source-level debugger, EventAnalyzer™, run-time error checking, code coverage analysis,TimeMachine™ tools suite, performance profiler and graphical browser. AdaMULTI development environment components are aware of each other and communicate among themselves, making the whole much greater than the sum of its parts. It runs on Windows, Solaris and Linux hosts and supports remote debugging for a variety of target environments, including with the Green Hills Probe and SuperTrace™ Probe for hardware debug and trace.

The AdaMULTI environment can also be used with Green Hills Software’s optimizing C/C++ compilers and other compilers that adhere to ARM Procedure Call and EABI standards. It supports a wide variety of real-time operating systems (RTOS), including Green Hills Software’s INTEGRITY® RTOS, third party and internally developed RTOSes. Because the AdaMULTI environment is fully RTOS-aware, designers can debug and tune their applications at the task level. It is particularly well suited to debugging multi-tasking programs and systems that employ multiple processors and cores.

Availability
Green Hills Software’s AdaMULTI development environment for ARM is available now for ARM processors including Cortex™-A and Cortex-R series and ARM7TDMI®.

About Green Hills Software
Founded in 1982, Green Hills Software is the largest independent vendor of embedded development solutions. In 2008, the Green Hills INTEGRITY-178B RTOS was the first and only operating system to be certified by NIAP (National Information Assurance Partnership comprised of NSA and NIST) to EAL 6+, High Robustness, the highest level of security ever achieved for any software product. Our open architecture integrated development solutions address deeply embedded, absolute security and high-reliability applications for the military/avionics, medical, industrial, automotive, networking, consumer and other markets that demand industry-certified solutions. Green Hills Software is headquartered in Santa Barbara, CA, with European headquarters in the United Kingdom.

Stopping Google Latitude Service on August 9th

The world’s largest search engine company, Google will soon be officially shut down one of his services. The services that will be closed is Google Latitude which is a location sharing application.

Closure is made after a company based in Mountain View did a massive change on Google Maps. In addition, this application also has a very low popularity. Google Latitude consumption levels far below other applications such as Foursquare or Facebook. Not only that, Latitude also less popular than the location-sharing service owned by Google.

Google Latitude itself is a location sharing application that is integrated with Google Maps. This feature allows for automatic location tracking, check in at a place it can also be set automatically or manually.

In the latest update Google Maps on Android, this feature is not found anymore. Selian it, Google also removed the existence of Google Latitude app available on iOS and has officially retire the Latitude API. So third-party applications that use these APIs will not work, unless using a sharing site owned by Google.

Yahoo Open Start Request Username ‘Beautiful’ is Not Active Again

Since last month it was announced that Yahoo will delete the Yahoo! username or ID is no longer active, many people are waiting for the arrival of this. Because, mostly inactive username is precisely deter others who want to use the name. Now, according to the announcement last month, Yahoo began to open up opportunities for those who want to get the username ‘pretty’.
Users who want to get the username ‘beautiful’ can not directly get the name. They should write the desired username in advance through a form benama Yahoo! Wish List. Yahoo provides five options that could be asked. If the first choice is not available, then the choice of the required reserves would then look for. Yahoo will provide notice of the availability of username via email in mid-August 2013.
“To get Yahoo! username you’ve always wanted, we set up a page where you can ask five top choices. If your first choice is not available, we will try to find other options of backup you have the content. In mid-August, you will receive email containing the username where available, as well as links to mengklaimnnya for 48 hours. Quite so, and it is yours, “wrote Dylan Casey, Senior Director, Platform Yahoo via its official blog.

Microsoft Combining 3 Monitor 4K to Play Games, Rework 1.5 Billion Pixels Per Second

Monitor resolution of 3840×2160 pixels, aka 4K is still expensive, but it seems to have become one of the dream stuff PC users. This week Microsoft decided to show off a PC that is designed to run 3 monitors into a single 4K display using AMD Eyefinity technology.
The three monitors are the 32-inch 4K monitor Sharp PN-K321, each of which cost nearly U.S. $ 5,000 (U.S. $ 51.3 million). AMD HD7970 graphics card uses DirectCU II. After playing a racing game Dirt 3 on Windows 8 in the third screen with a refresh rate of 30Hz, Microsoft decided to run the game in 60Hz mode and three monitors combined into one display. AMD actually create a custom driver package, add two graphics cards and a custom power systems. They even expressed do not try it at home.
As a result, they were able to run the game Dirt 3 with framerate 62-67 frames per second in all three Sharp 4K monitor with a refresh rate of 60Hz setting and the overall setting in High mode except shadow detail and particles. That is, the total resolution is 11520×2160 pixels (24.9 megapixels). Multiplied by 60 fps, meaning that every second there are 1.492992 billion pixels processed fruit.

Adobe’s Kuler beta site resurrects photo-color picker

Adobe Systems has launched a beta version to try out changes to its color-picker Kuler service, including the restoration of an earlier feature to extract dominant colors from photos.

Kuler lets people assemble quintets of colors into a color scheme that’s saved into their own archive; people can browse others’ schemes as well. The colors can be imported into Adobe’s Illustrator software, too.

The photo tool is available by loading the new Kuler beta site. Adobe said Monday it’s seeking feedback on the changes, which it may or may not keep. Adobe also provided an option to use a less obtrusive color wheel and to shrink borders around colors so designers can better judge how they look together.

Kuler is useful, though hardly a heavyweight app like Photoshop or After Effects. But it’s interesting to watch since it’s got new-era online, collaborative, and social aspects that seem to be a priority for Adobe as it tries to convince skeptics that its $50-per-month Creative Cloud subscription is more than just a new way to pay for the old Creative Suitesoftware.

When Adobe cut over to its Creative Cloud subscription program, it introduced an iOS app that also can pick a color scheme from a photo.

Adobe once had a Kuler app for Android, but scrapped it and is channeling its resources toward the Kuler Web interface at present.

In response to a request for a Kuler Android app, an Adobe staff member had this to say:

While the iOS app and the discontinued Android app do have similar capabilities, they are actually quite a bit different. We have found that people use tablets and mobile phones very differently. So, we created the iPhone app with a different focus in mind — which translated to different features, UI, and interactions.

We have also found the tasks most people wanted to accomplish with Kuler, on a tablet device, are very similar to the tasks people undertake with the Kuler website. So, we’ve invested a lot of time and effort into updating the site to embrace the latest Web standards (also announced at MAX). And, it should work really well on Android and iOS tablets. We look forward to getting these updates in the hands of users to hear what they think.

We understand there are many Android phone users who may find an app like the Kuler iPhone app useful, and we’ll monitor demand for that over time.

In my tests on a Nexus 7 tablet, I was able to use the normal Kuler site, but the photo upload and color-wheel shrinking features had some problems. I could use photos I took on the spot and from the photo gallery, but imports from Google+ galleries, Dropbox, and Google Drive failed. Worse, the color wheel for picking colors by hand didn’t work with my touch screen.

WLCGram: Instagram Client Application for Windows Phone

Photo sharing application Instagram has been very popular among users of Android and iOS smart phones. But unfortunately Windows Phone smart phone users still have to wait to be able to use this application, because until recently the Instagram still mum about their plans for this one platform. Nokia itself as the largest WP vendors have expressed their support in order to Instagram coming soon to mobile-phone operating system Windows Phone.
While waiting for the official Instagram app is present, it does not hurt us a peek Instagram client application on Windows Phone, which WLCGram. WLCGram is one of Instagram client on Windows Phone that has capabilities similar to the original Instagram application. Some of the features include are:
filter image
could register
Can view photos on Instagram
Can menshare photos to Instagram
Can search by username or hashtag.
.
Unfortunately, the users of this application have not been able to:
Did comment and like
see video
Menshare to Facebook and Twitter.
and some other weaknesses.
With all its limitations and its advantages, the application is priced at $ 0.99 (approximately Rp. 9800) with the option for free trial for 9 hours in advance.

Google’s Chromecast could throw your mobile and browser games onto your TV

Google was announced The Chromecast, a small WiFi-enabled HDMI dongle that may well prove big news for bringing mobile and browser games to your living room.

The Chromecast plugs into your television’s HDMI slot, and allows you to send content from Android and iOS devices to the TV screen via Wi-Fi, while also supporting Chromebooks, and the Chrome web browser for Mac and Windows.

The device that is connected to the Chromecast then controls everything you see on the TV. The one caveat is that mobile apps need to integrate the Googlecast SDK to be able to send content across (apps in a Chrome web browser will work via “Chrome tab projection.”)

The device costs $35, and is already available to purchase directly from the Google Play Store. Notably, the possibility of projecting mobile and browser games via the device is not mentioned on the official website, which focuses on the video and music capabilities of the device.

As such, there’s no word as-of-yet regarding whether games will be fully supported, or whether input lag will cause issues for this particular line of fire.

Infinite Skills’ “Adobe Acrobat XI Security Tutorial” Targets Advanced Capabilities for Encryption and Authentication In Adobe’s PDF Creation Tool

Software training firm Infinite Skills Inc. last week introduced its “Adobe Acrobat XI Security Tutorial,” a condensed course targeted specifically toward using Acrobat XI to create and exchange information-sensitive digital documents.

Advanced security features have long been a feature that sets Acrobat apart from other digital document applications. Acrobat XI has capabilities for password protection and certificate encryption, digital signatures, and many other advanced security features that make it a one-stop solution for document management.

Infinite Skills’ “Adobe Acrobat XI Security,” covers all these features in a quick, easy-to-understand guide that will allow users to begin creating and transferring secure documents in just a few short hours.

Adobe Acrobat XI Security Video Training – DVD

Course author Michael Hoffman is a career photographer, artist, and trainer, with Adobe certifications in Acrobat and Photoshop. After beginning his career creating technical illustrations and photographs for electronic equipment manufacturers, he has continued to combine technology, photography and education in a productive career.

This brief, highly focused course, covers password and certificate encryption, creating a digital ID, how to sign a .pdf file, how to certify a .pdf file, and using Adobe’s EchoSign feature.

Other chapters include working with actions and creating custom actions, using security features in print situations, problem correction, and compatibility issues, along with several other specialized security features including options for automating repetitive tasks.

“Acrobat XI Professional is far more than just a tool for viewing .pdf files,” Hoffman explains. “It is an incredibly complex program, and its security features are part of a complete package that provides a seamless automated collaborative solution for almost any document management need.”

Free demo videos and a full list of course contents can be found on the Adobe Acrobat XI Security Tutorial training page of the InfiniteSkills website:

http://www.infiniteskills.com/training/advanced-adobe-acrobat-xi-training.html

InfiniteSkills offers its Adobe Acrobat XI Security Tutorial either as a DVD or a direct download from the company website at a retail price of $24.95. All InfiniteSkills titles and formats are compatible with both Mac and Windows operating systems, and shipping is available around the globe. InfiniteSkills tutorials are supported by project files which correspond to examples in the videos.

About InfiniteSkills Inc.
A leader in the field of software training, InfiniteSkills strives to offer the highest quality training available at an affordable cost. InfiniteSkills tutorials are task-oriented instructional videos, teaching complex skills by providing hands-on examples, guiding users as they carry out critical objectives. InfiniteSkills offers a comprehensive range of software titles available as DVDs, digital downloads, and iPad editions, keeping with company aim of delivering professional training to customers anywhere they want to learn.