Category Archives: development

GPU computing with NVIDIA in Beijing

I’m in Beijing for NVIDIA’s GPU Technology Conference; I attended last year’s event in San Jose and found it fascinating, partly because it has an academic and research flavour with a huge variety of projects on display.

This year the event is in Beijing, reflecting the level of HPC (High Performance Computing) activity in this region.

image

image

NVIDIA’s business is graphics processors, though it has expanded into the SoC (System on a chip) business with its ARM-based Tegra chipset. This conference though is focused at the other end of the scale: Tesla GPUs that are primarily designed not for driving a display, but for rapid processing using massively parallel computing.

The Tesla business is relatively small for NVIDIA; less than 5% of its overall revenue, I was told; and I was told that the company treats it partly as research and development. That said, GPU computing is coming into the mainstream and the business is expected to grow. NVIDIA’s desktop GPU cards also support GPU computing.

I recently reviewed a video format converter from Cyberlink; the product was unexceptional except that it can take advantage of GPU computing when available to speed processing when converting from one video format to another. Since I do have a suitable graphics card (though sadly not a Tesla) this made a substantial difference, converting several times faster than another format converted I tried.

Of course NVIDIA is not the only player; there is an open standard (OpenCL) for GPU computing and other GPU vendors such as AMD implement OpenCL. NVIDIA implements OpenCL but also has its own CUDA architecture, which tends to be the focus of its conference as you would expect.

More reports soon.

Oxygene for Java released: develop for Android and Java runtime with Delphi language in Visual Studio

RemObjects has released Oxygene for Java, a new version of its Object Pascal compiler. Object Pascal is pretty much the Delphi language though with some additional features of its own. Previous versions target the .NET runtime, and a version of this is marketed by Embarcadero as Prism. The IDE for Oxygene is Microsoft’s Visual Studio. This new version targets both the Java Runtime and the Android Dalvik VM. The obvious target market is Delphi developers who now want to create apps for Android, or cross-platform Java applications.

I downloaded the trial and ran the supplied Hello World in the Android emulator … it works.

image

A few further notes from the RemObjects announcement. While only Visual Studio is supported initially, an Eclipse version is also in preparation. Oxygene directly consumes .JAR libraries so you can use both first and third-party libraries. There is also a tool called Oxidizer that lets you import Java language code, which will be converted to Oxygene Object Pascal.

A point to note is that Embarcadero has already announced that its cross-platform FireMonkey framework will support Android as well as Apple iOS. This means that developers who want to code for Android in the Delphi language will have two choices. It looks to me as if Oxygene will be more suitable if you want to stay close to the Android SDK, whereas FireMonkey has its own custom-drawn user interface widgets and effects and should come into its own if you want the same code to run on both iOS and Android.

Given that a skilled Delphi developer would probably learn Java fairly quickly, how much value is there in Oxygene for Java? I guess factors include how much more productive you can be in Oxygene and the value of sharing code across projects targeting different platforms, presuming that you do not want to run Java everywhere.

HTML5 scorecard: Amazon Kindle Fire weak, iOS 5 great, IE10 preview one of the best

The Sencha blog has a great series of posts on HTML5 support on various devices. This is of direct interest to Sencha because its products are JavaScript and CSS application frameworks, Sencha Touch for mobile and ExtJS for any browser. The latest post is on the Amazon Kindle Fire – and it is weak:

The Amazon Kindle Fire doesn’t seem designed to run HTML5 apps as a primary goal. It does a good job of displaying ordinary web pages and its resolution and rendering capabilities meet that need well. But there are too many sharp edges, performance issues, and missing HTML5 features for us to recommend that any developer create web apps primarily for the Kindle Fire. The iPad 2 running iOS 5 continues to be the tablet to beat, with the PlayBook a respectable runner-up in HTML5 capabilities.

Part of the problem is that the Fire runs Android 2.3.4 (Gingerbread) which has a weaker browser than later versions. That is not the only source of disappointment though. According to Sencha’s Michael Mullany, the GPU is not used for hardware acceleration of browser content, the JavaScript timer is laggy, there is no embedded HTML5 video (videos launch in a separate player), and CSS corners are not properly anti-aliased.

But what about the Kindle’s cloud-accelerated browsing that we heard so much about when it was announced? This is the biggest disappointment:

One of the main selling points of the Kindle browser is supposed to be its cloud-caching and pipelined HTTP connection that uses the SPDY protocol. This does seem to speed up normal page browsing a little, but it’s not very noticeable and we didn’t test this rigorously. But for HTML5 web apps, where code is downloaded and executed, there doesn’t seem to be any performance difference when we tested with acceleration on and off. It doesn’t appear as if client JavaScript is executed on the server-side at all, so the Kindle does not seem to have Opera Mini-style server-side execution. And SunSpider scores were essentially the same when accelerated browsing was turned on or off.

Moving on from Kindle, it is interesting but not surprising to see a great report for HTML5 in Apple’s iOS 5. Less expected though is a big thumbs-up for HTML5 in Microsoft’s IE10 preview on Windows 8:

Simply put, (and with the caveat that we were running on the notably overpowered developer preview hardware) the IE10 HTML5 experience is one of the best we’ve seen on any platform to date. After a decade of web neglect, Microsoft is back with a vengeance.

image

The main caveat is the absence of WebGL. Microsoft is supporting its own 3D graphics library.

Another worry for Microsoft is simply the level of hostility towards the company and IE in particular, among the developer and designer community it so much wants to reach. You can get a flavour of this from some of the comments to Mullany’s post, for example:

I never really like Windows and I absolutely despise Internet Explorer. There are so many exceptions in code to be made for Internet Explorer that i stopped trying so hard to make it look the same as other browsers. Hopefully, IE 10 will stop all of these exceptions and weird additions that are made to websites that make everything instantly awful so I can actually go back to trying to make things look nice in IE. It’s really sad though that so many people use Windows and IE that we cannot ditch it for a better system and better browser.

What about Android? The most recent offering covered in the Sencha series is Motorola Xoom which is a disaster:

We were excited about the first true Android operating system for tablets and had high hopes for a mobile browser that was as powerful as the platform. Sadly, the Xoom and Honeycomb are a real disappointment. We found consistent and reproducible issues in CSS3 Animations and CSS3 Transitions among other things. We had issues where the browser either hung or crashed. Regular scrolling was slow or below full framerate. We had issues where media playback failed or performed incorrectly. At times it felt like we were using a preproduction device, but we bought our test device from a Verizon Wireless store.

I have a hunch that the latest Galaxy Tab might fare better. Sencha did like the HTML5 support in the BlackBerry PlayBook though.

With Adobe Flash now in decline on mobile devices (Adobe is no longer working on the mobile Flash player) HTML5 support is all-important for rich browser-hosted apps; I will be watching with interest for future Sencha reports.

What is the best programming language for a child progressing from Scratch?

Someone asked me what is the best programming language for a child to learn after starting (and having success) with Scratch.

Scratch is a visual programming language which actually runs on Smalltalk, though its users do not need to know this. Scratch 2.0 seems to be written in Adobe Flash so you can create and program projects in a web browser. As far as I can tell though, there is no obvious and natural progression from Scratch to a code-centric programming language.

I guess the first answer is not to move away from Scratch until you need to. You can do a lot with Scratch, as the many shared projects demonstrate.

Still, I agree that it makes sense to learn text-based programming before too long. What is the best one for a child to learn, not necessarily with computer science or a professional career in mind, but just to take the next step and create some cool games and applications?

I find myself leaning towards Microsoft’s C#. The reason is that there is a capable free version and  you can add XNA Game Studio for game development. C# is an excellent language and has some family resemblance to other languages including C, C++, Java and JavaScript, and Visual Studio is a strong IDE that is perhaps more approachable than say Eclipse or Netbeans.

Snags with C# are that Visual Studio only runs on Windows, the language is proprietary to Microsoft (though Mono is free and open source) and it is not ideal if you want to run on the Mac, or Google Android or Apple iPad.

That said, I could also make a case for Java, or JavaScript, or Python.

I would value suggestions though: what would you recommend to a teenager?

Adobe’s Falcon JS: Compile Flex code to HTML and Javascript

Adobe has issued further information about its intention to donate the Flex SDK, which builds Flash applications from XML and ActionScript, to the Apache Software Foundation. Specifically, the donation will include:

  • BlazeDS, the free version of LiveCycle Data Services
  • Falcon, the new Flex compiler due to be completed in 2012
  • Falcon JS, a previously unannounced project

Of these, Falcon JS is the most eye-catching. This is an “experimental cross-compiler from MXML and ActionScript to HTML and JavaScript.” In other words, Falcon JS has the potential to give developers a migration path from Flash to HTML clients. Note that it is described as a cross-compiler rather than a porting tool, so it may well be that the output is not easily edited. The Google Web Toolkit works like this, converting Java to JavaScript but not in a form that anyone is expected to edit. Adobe also adds:

We have undertaken some experimental work in this area, but remain unsure as to the viability of fully translating Flex-based content to HTML. The Falcon JS cross-compiler, referenced above, represents this early work.

What about the most sensitive of Adobe’s statements, that HTML is the long-term solution for enterprise applications? Adobe says:

In time (and depending upon your application, it could be 3-5 years from now), we believe HTML5 could support the majority of use cases where Flex is used today.

and adds:

We intend to make investments in HTML-related technologies, so that we can help advance HTML5 to make it suitable for enterprise applications.

I am not sure to what extent the new statement will ease the worries of Flex developers; but at least Adobe is clear about its intentions. While there are benefits in the Flex SDK moving to Apache, overall the message is that Adobe is hastening towards HTML 5. I am surprised, considering the progress the company has made in creating a strong cross-platform toolkit for mobile and desktop applications. Although no-one should doubt that Adobe will continue to support and evolve Flex as a development platform, it has in effect declared it to be a legacy technology, and I would guess that the effect will be to depress the level of activity there.

Adobe favours HTML over Flex, retreats from its enterprise app platform

Adobe has stated that Flex, the xml-based language for developing applications that run on the Flash runtime (also known as AIR) will gradually give way to HTML 5:

In the long-term, we believe HTML5 will be the best technology for enterprise application development. We also know that, currently, Flex has clear benefits for large-scale client projects typically associated with desktop application profiles.

The company is also giving the Flex SDK to an open source foundation:

we are planning to contribute the Flex SDK to an open source foundation in the same way we contributed PhoneGap to the Apache Foundation when we acquired Nitobi.

though Adobe will continue to contribute to its development. Adobe also states that it will continue to develop the Flash Builder IDE for Flex.

I am surprised by this announcement. I understand Adobe’s reasons for abandoning Flash for mobile devices, but since you can use Flex with the packager for iOS or the captive runtime for other mobile devices, it is not necessary to abandon Flex as well.

But is Adobe abandoning Flex? Not as such; in fact the statement linked above says that Adobe is still “committed to Flex” and “committed to Flash Builder”. The problem though is that there are several clues showing that Flex is in decline and no longer strategic.

First there is the statement about HTML5 versus Flex in the long-term.

Second, Adobe says it is not sure what is happening to the Flex roadmap as discussed recently at the MAX conference in Los Angeles:

The Flex roadmap will be determined by the governing board once it’s been established. We plan to contribute framework features previously highlighted as part of Adobe’s Flex roadmap, into this new project.

Third, the delivery of a project to an open source foundation can be interpreted as a signal that a company wants  to distance itself and lacks commitment to its long-term success. I would not make that argument with respect to PhoneGap, but for Flex I am not so sure.

It may already be too late. Imagine you are an Adobe partner trying to sell a Flex project to your customer. What answer do you have when your customer says, “but isn’t Adobe moving to HTML 5?”

When Adobe made its first announcement about the change in its business model I came up with the phrase more publishing, less programming. That view was further strengthened by CEO Shantanu Narayen’s recent post:

The future of the Internet comes down to content – creating it and monetizing it. This is where our customers rely on Adobe, and it’s what is shaping our strategy moving forward.

I take this then as not only a retreat from Flex, but a retreat from enterprise application development in favour of content creation tools.

Charles Humble at InfoQ has an informative post on this issue here.

GPU programming coming to low-power and mobile devices – from EU Mont Blanc supercomputer to smartphones

Supercomputing and low-power computing are not normally associated; but at the SC11 Supercomputing conference the Barcelona Supercomputing Center (BSC) has announced a new supercomputer, called the called the Mont-Blanc Project, which will combine the ARM-based NVIDIA Tegra SoC with separate CUDA GPUs. CUDA is NVIDIA’s parallel computing architecture, enabling general purpose computing on the GPU.

The project’s publicity says this enables power saving of 15 to 30 times, versus today’s supercomputers:

The analysis of the performance of HPC systems since 1993 shows exponential improvements at the rate of one order of magnitude every 3 years: One petaflops was achieved in 2008, one exaflops is expected in 2020. Based on a 20 MW power budget, this requires an efficiency of 50 GFLOPS/Watt. However, the current leader in energy efficiency achieves only 1.7n GFLOPS/Watt. Thus, a 30x improvement is required.

NVIDIA is also creating a new hardware and software development kit for Tegra + CUDA, to be made available in the first half of 2012.

image

The combination of fast concurrent processing, low power draw and mobile devices is enticing. Features like speech recognition and smart cameras depend on rapid processing, and the technology has the potential to make smart devices very much smarter.

NVIDIA has competition though. ARM, which designs most of the CPUs in use on smartphones and tablets today, has recently started designing mobile GPUs as well, and its Mali series supports OpenCL, an open alternative to CUDA for general-purpose computing on the GPU. The Mali-T604 has 1 to 4 cores while the recently announced Mali-T658 has 1 to 8 cores. ARM specifically optimises its GPUs to work alongside its CPUs, which must be a concern for GPU specialists such as NVIDIA. However, we have yet to see devices with either T604 or T658: the first T604 devices are likely to appear in 2012, and T658 in 2013.

Adobe “shifting its business model”: more publishing, less programming

Adobe has announced a shift in its business strategy, together with the loss of around 750 employees.

So what is changing? Adobe says it will be focusing on digital media and digital marketing, while investing less in “certain enterprise solution product lines.” In line with this strategy, Adobe acquired video advertising company auditude last week.

Here are the things which Adobe says are “important elements” in its new approach:

  • Creative Suite extended with tablet apps and delivered through the cloud
  • Greater investment in HTML 5: Dreamweaver, Edge and PhoneGap
  • Flash positioned for “advanced” web, video, and mobile apps
  • Digital publishing solutions
  • Video advertising
  • Document services such as electronic contracts and signatures

So what will Adobe be doing less? This is harder to discern as the releases, naturally enough, say less about it. The key remark is that:

the company will reduce its investment, and expected license revenue, in certain enterprise solution product lines

We can conclude, I guess, that the Digital Enterprise Platform once known as LiveCycle is going to get less attention as the company focuses more on digital content and less on providing a platform for enterprise applications. I would guess that this will impact the middleware services more than things like the Flex framework and Flash Platform tools, but I am speculating. More information is coming in a financial analyst meeting tomorrow in New York.

Eclipse and Xtend: some confusion in getting started

Last weekend there was some publicity around Xtend, an Eclipse project which extends Java with new language features. Xtend now has a new landing page, as announced by the lead architect Sven Efftinge.

I did intend to post about this yesterday, but I wanted to see it in action first, so I tried to download it and have a look. I believe this is a case where those who wrote the new landing page are too close to the project and made some assumptions, because I did not find it obvious how to proceed.

If you follow the Download link you are invited to paste one of the three URLs into the Eclipse update manager.

image

As a newcomer to the project, I did not want three URLs to choose from, I wanted just one. I picked Release as in general this one is likely to work.

Now, the instructions say:

To install the Xtend plugins open the update manager and paste one of the URLs on the right into the field ‘Work with’ and select the Xtend SDK.

The update manager actually presents you with a long list of updates, none of which say Xtend. I took a stab at what I thought was the right thing.

image

The All-In-One includes the Xtend SDK, which is what I want, right?

Wrong. After installation I could not find the tutorial which the docs said would be available.

I did some messing around with Eclipse and got the occasional error like this one:

image

Then I realised that I should have looked under the TMF Xtext-2.1.0 tree, which is where the correct Xtend SDK resides:

image

Except that if you find this helpful post by  Max Rohde you will know:

The other packages need to be selected since otherwise the Xtend editors will not work.

So you should select all of TMF Xtext-2.1.0 (or the latest release). Easy when you know, but not obvious since the word Xtend does not appear in the top node of the tree.

I was then able to create the tutorial project. I opened HelloWorld.xtend and got this:

image

Ah, but you have read Rohde’s post so you know this is expected and that you should run this as a JUnit Test. However it does not have any output. To see some output, you have to run one of the other examples, like Xtend08_RichStrings, or perhaps add:

sayHelloToSystemOut2(‘Tim’)

to the testHelloWorld() method in HelloWorld.xtend.

image

OK, it works.

So what is Xtend? It is essentially a code generator which lets you write in Xtend and generate Java. You can see the generated code in the tutorial project under xtend-gen.

image

Xtend adds some nice features: type inference, property syntax, closures, switch expressions with no fall-through, template expressions, extension methods, and multiple dispatch.

I can imagine C# creator Anders Hejlsberg smiling here, as most of this is already in C# in some form or other.

But is Xtend the right way to bring these features to Java? I am not convinced so far. It is an interesting Eclipse project, but it may be more significant in speeding the implementation of features like these into Java itself, than as a mainstream approach to writing applications. Xtend is a kind of hybrid approach, where you will be switching between Java and Xtend while you code and debug your application, and I suspect it would get frustrating.

There is also the question of widespread community support – beyond Eclipse.

Finally, it would be good if the new landing page could be made more helpful for those getting started.

Quick thoughts on Xcode and Objective C versus Microsoft’s tools

I have been trying out JetBrains’ AppCode which meant working in an Apple development environment for a time. I took the opportunity to implement my simple calculator app in iOS native code.

image

Objective C is a distinctive language with a mixed reputation, but I enjoy coding with it. I used Automatic Reference Counting (ARC), a feature introduced in Xcode 4.2 and OSX 10.7, iOS 5; ARC now also works with 10.6 and iOS 4. This means objects are automatically disposed, and I did not have to worry about memory management at all in my simple app. This is not a complete memory management solution (if there is such a thing) – if you use malloc you must use free – but it meant that the code in my app is not particularly verbose or complex compared to other languages. Apple’s libraries seem to favour plain English method names like StringByAppendingString which makes for readable code.

I was impressed by how easy it is to make an app that looks good, because the controls are beautifully designed. I understand the attraction of developing solely for Apple’s platform.

I also love the integrated source control in Xcode. You find yourself using a local Git repository almost without thinking about it. Microsoft could learn from that; no need for Team Foundation Server for a solo developer.

I did miss namespaces. In Objective C, if you want to remove the risk of name collision with a library, you have to use your own class prefix (and hope that nobody else picked the same one).

image

Interface Builder, the visual UI designer, is great but many developers do not use it, because coding the UI without it is more flexible. It is a shame that you have to make this choice, unlike IDE’s with “two way tools” that let you edit in code or visually and seamlessly keep the two in synch. I found myself constantly having to re-display windows like the Attributes Inspector though it is not too bad once you learn the keyboard shortcuts. The latest Interface Builder has a storyboard feature which lets you define several screens and link them. It looks useful, though when I played with this I found it difficult to follow all the linking lines the designer drew for me.

It is interesting to compare the Mac and iOS development platform with that for Windows. Microsoft promotes the idea of language choice, though most professional development is either C# or C++, whereas on Apple’s platform it is Objective C and Cocoa or you are on your own. Although Mac and Windows are of a similar age, Microsoft’s platform gives a GUI developer more choices: Win32, MFC, WTL, Windows Forms, Windows Presentation Foundation and Silverlight, and in Windows 8 the new WinRT.

I get the impression that Microsoft is envious of this single-minded approach and trying to bring it to Metro-style Windows 8, where you still have a choice of languages but really only one GUI framework.

That said, Visual Studio is an impressive tool and both C# and C++ have important features which are lacking in Objective C. I would judge that Visual Studio is the more productive tool overall, but Apple’s developer platform has its own attractions.