Thursday, August 19, 2010

Analog makes a comeback?

Sounds like a cool idea . . . Probabilistic processors possibly pack potent punch

Thursday, July 29, 2010

Intel, AMD, NVIDIA and High Performance Computing

In the past few weeks we've had a few conversations at work with engineers from ATI/AMD, Intel, and NVIDIA about their offerings for high performance computing.

Intel is really pushing their Ct software framework and its benefits around code maintainability. It is basically C++ and it abstracts away the need for hardware-specific low level code. For example, to add two 2-d arrays together, you can just write code like:

resultArray = array1 + array2;

No need for low level intrinsics to access the SIMD instruction sets. Ct also supports other higher level abstractions like list homomorphisms. So theoretically, your code can use nice high level data abstractions and it will run fast. As new CPU features are added in the future, your same codebase will take advantage of them through Ct.

As one might expect, Ct is really aimed at intel cpu-like architectures and not GPUs. Intel does a good job explaining the kinds of algorithms and applications in its sweet spot in its whitepaper (http://techresearch.intel.com/UserFiles/en-us/File/terascale/Whitepaper-Ct.pdf)

Now, it sounded to me like the Intel team was saying that Ct would also generate code for GPUs. But as the whitepaper describes, it seeems to me that your algorithm would still need to conform to the limitations and advantages of the GPU in order to run fast on the GPU.

So for now, I believe that data parallel algorithms that are suited to the GPU will probably need to be implemented using NVIDIA's CUDA or OpenCl. One interesting tidbit was that NVIDIA claimed to us that their OpenCL drivers should run just as fast as their CUDA drivers. You might expect that NVIDIA would neglect OpenCL. CUDA has a strong following already and it gives NVIDIA some vendor lock-in since CUDA is NVIDIA only. But NVIDIA says they want to differentiate and sell their products on hardware performance not through software API lock-in, which of course, is a good thing and something we developers are happy to hear. Assuming this is true, I think that OpenCl is very attractive since can run on ATI, NVIDIA, or even CPU architectures with the same codebase.

Friday, April 30, 2010

Interest in Google App Engine and Google Web Toolkit Around the World

My postings on the Google Web Toolkit and Google App Engine have generated traffic that would be considered very meager by many standards, but I thought it was enough to see some interesting trends in where these Google tools are being used around the world. This is from my Google Web Analytics account: The top countries are:
  1. USA
  2. United Kingdom
  3. India
  4. Germany
  5. Brazil
  6. Colombia
  7. Latvia
  8. France
  9. Australia
  10. Ukraine
Some interesting places on that list!

Hey, my blog is useful!

My post on getting Apache HttpClient working with Google App Engine is referenced from one of Google's official FAQ pages (the "Will It Play with Google App Engine" page)! I feel special.

Passing JVM arguments for junit with maven

Every time I need to do this, google leads me to this help page, which leads me to the following command, which does NOT work (at least not on my version of Maven):
mvn -Dmaven.junit.jvmargs=-verbose test
The proper help page is for the surefire plugin. So the proper way to do it is:
mvn -DargLine=-verbose test

Parallel Computing benchmarks

I've been doing some benchmarking and hope to post some results soon. I have some simple, easily-parallelized code that I've been trying different computing architectures on. These include:
  • Single threaded java
  • Single threaded C
  • Multithreaded java
  • Multithreaded C
  • Vectorized C using x64 SSE Instructions
  • Multi-core computing on an NVIDIA GPU with CUDA
It's been an interesting experiment and hopefully I can post results soon.

Friday, March 19, 2010

Installing Java Plugin for Firefox on ubuntu

After reading a bunch of confusing articles describing how to install the java plugin into Firebox on Ubuntu Linux 9.04, I found that there is already a package for it:

sudo apt-get install sun-java6-plugin

Thursday, March 18, 2010

GWT and Spring / Acegi Security

Using Spring Security with GWT is fairly easy . . . just protect your GWT page and its associated servlets.

But one tricky thing is handling expired logins. When your user's login expires, they may be in the middle of using your web application. They will probably click some widget that will generate a call to the server. Because the login has expired, Spring Security will return your login page instead the expected server response. So you need to set up your GWT client code to handle this.

I got some good tips on how to do this on this page, but to make the ideas contained there a little more concrete, let me give some example code.

In my case, I wrapped the DisplayCallback class from the GWT Presenter library, but you should be able to apply these ideas to any gwt AsyncCallback.


/**
 * This is a special version of DisplayCallback that will handle Spring/Acegi
 * security errors.  If a 403 Access Denied errors occurs, the user will be
 * shown an error message.  If the server returns a Login page, that means the
 * user's login has presumably expired, so we direct the browser to redirect
 * to our login page.
 * 
 * Credit for these ideas comes from here:  
 * http://www.dotnetguru2.org/bmarchesson/index.php/2007/04/23/technical_tip_using_acegi_with_gwt
 * 
 */
public abstract class MyDisplayCallback<T> extends DisplayCallback<T> {

 private static final String SERVER_ERROR = "An error occurred while "
  + "attempting to contact the server. Please check your network "
  + "connection and try again.";

 public StatProjDisplayCallback(Display display) {
  super(display);
 }
 
 @Override
 protected final void handleFailure(Throwable cause) {
  
  doCleanup();
  
  String errorMessage = cause.toString();
  if (errorMessage.indexOf("403") != -1)
  {
   // Access denied for this role
   Log.debug("login invalid for this resource");
   if (GWT.isClient()) {
    Window.alert("Access denied");
   }
  }
  else if (errorMessage.indexOf("Login") != -1)
  {
   Log.debug("login expired, showing login dialog");
   if (GWT.isClient()) {
    Window.Location.assign("login.jsp?relogin=true");
   }
  }
  else
  { 
   Log.error("Handle Failure:", cause);

   Window.alert(SERVER_ERROR);
  }
  
 }
 
 /**
  * This method can be overriden to include code that should run in case the server call fails.  
  * This method will be called by handleFailure()
  */
 protected void doCleanup() {};

 @Override
 protected abstract void handleSuccess(T value);

}

favicon.ico and spring/acegi security

Don't forget to whitelist favicon.ico in your security.xml file. Otherwise, when visiting your site, you may be asked to log in, and then you will just be shown a web page consisting only of your little favicon.ico image, which looks pretty weird.

BitBucket

I use bitbucket.org to store my mercurial projects. It works fine for simple pulls/pushes and it has a nice web interface. My one complaint is that sometimes it is very slow. This is not a big deal for pull/push since I don't do that a whole lot. But I've also been using bitbucket's issue tracking features and sometimes that is unusable (it can take over 2 minutes to bring up an issue report).