Microsoft Screwup = Our Gain
by sahilramani on Jan.15, 2009, under Software
![]()
So Microsoft screwed up the release of Windows 7 Public Beta. But is it really that bad? So you think owning up to the fact really saved their face? It was this post on their blog that saved their butts :
We have clearly heard that many of you want to check out the Windows 7 Beta and, as a result, we have decided remove the initial 2.5 million limit on the public beta for the next two weeks (thru January 24th). During that time you will have access to the beta even if the download number exceeds the 2.5 million unit limit.
Who’s gaining from all this? Us! Go get your copy of Windows 7 Beta here now. And with the cap now lifted, people are scrambling to get their beta copy. Get yours before the 24th and it’ll be sure to work till August.
PS: Lets hope the screw up the final release and give us all free copies
When and Why CUDA?
by sahilramani on Jan.14, 2009, under Software, cuda, mac
Started programming with CUDA recently, and quite frankly, I’m hooked. So I decided to run a small test to ascertain the point where CUDA really become useful. For the test, I wrote a small piece of code to add corresponding elements of 2 arrays and store the result in a third array, a simple array addition problem.
Here’s my results :
We immediately notice from the graph that below 10,000 elements, the CPU version of the array addition code works faster. This is due to the small overhead of launching GPU kernels (~10-20 µsec) which can overshadow the kernel execution time for smaller kernels. The CUDA kernels are more efficient in launching thousands of threads parallelly, and hence we see a significant performance improvement once the number of elements rise.
The rule of thumb is to stick to CPU based algorithms if number of elements is small, and use GPUs when the number of elements rise beyond, say, 10,000.
PS: For those who’re keen, here’s the code:
#include <iostream>
#include <cuda.h>
using namespace std;
__global__ void vecAdd(int *A,int *B,int *C,int N)
{
int i = blockIdx.x * blockDim.x + threadIdx.x ;
if(i<N)
C[i] = A[i] + B[i];
}
void vecAdd_h(int *A1,int *B1, int *C1, int N)
{
for(int i=0;i<N;i++)
C1[i] = A1[i] * B1[i];
}
int main(int argc,char **argv)
{
int n=(argc==2?atoi(argv[1]):25);
int a[n],b[n];
int block_size, block_no;
int c[n];
int c2[n];
int *a_d,*b_d,*c_d;
block_size=64;
block_no = (int)((n-1)/block_size)+1;
dim3 dimBlock(block_size,1,1);
dim3 dimGrid(block_no,1,1);
for(int i=0;i<n;i++)
a[i]=rand()%35,b[i]=rand()%25;
cudaMalloc((void **)&a_d,n*sizeof(int));
cudaMalloc((void **)&b_d,n*sizeof(int));
cudaMalloc((void **)&c_d,n*sizeof(int));
cudaMemcpy(a_d,a,n*sizeof(int),cudaMemcpyHostToDevice);
cudaMemcpy(b_d,b,n*sizeof(int),cudaMemcpyHostToDevice);
clock_t start_d=clock();
vecAdd<<<block_no,block_size>>>(a_d,b_d,c_d,n);
cudaThreadSynchronize();
clock_t end_d = clock();
clock_t start_h=clock();
vecAdd_h(a,b,c2,n);
clock_t end_h = clock();
double time_d = (double)(end_d-start_d)/CLOCKS_PER_SEC;
double time_h = (double)(end_h-start_h)/CLOCKS_PER_SEC;
cudaMemcpy(c,c_d,n*sizeof(int),cudaMemcpyDeviceToHost);
printf(”%d %f %f\n”,n,time_d,time_h);
cudaFree(a_d);
cudaFree(b_d);
cudaFree(c_d);
return 0;
}
nVidia CUDA 2.0 on Mac Book Pro with 8600M GT
by sahilramani on Dec.30, 2008, under Software, cuda
This tutorial should provide you the information to set up CUDA 2.0 on your shiny new Mac Book Pro, and get the demos running before you can start kicking up the cuda dust :
- Download nVidia CUDA Toolkit 2.0 : http://developer.download.nvidia.com/compute/cuda/2_0/mac/toolkit/NVIDIA_CUDA_Toolkit_MacOSX.pkg
(NOTE : Mac OSX 10.5.2 required to install the package) - Download nVidia CUDA SDK 2.0 : http://developer.download.nvidia.com/compute/cuda/2_0/mac/sdk/NVIDIA_CUDA_SDK_2.02.0807.1535_MACOSX.pkg
(NOTE : Mac OSX 10.5.2 required to install the package) - Install the CUDA Toolkit, and during the installation, when it reaches the Standard Install page, click on the Customize button, and ensure CUDAKext is checked. Ensure the location of installation is appropriate for your setup, or proceed with installation to the default directory.
- Set up the bash variables as suggested by the installer: Paste the following lines into .bash_profile in your home directory, replacing <path_to_cuda> with the installation directory of CUDA:
export PATH=<path_to_cuda>/bin:$PATH
export LD_LIBRARY_PATH=<path_to_cuda>/lib/
For instance, my installation had the following values:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib/ - Restart your computer. This is essential for critical files to be updated.
- Install the CUDA SDK, and again, ensure the Installation Location is appropriate, and proceed with the installation. The default location is /Developer/CUDA/
- Change the directory to the SDK installation directory (/Developer/CUDA by default) and compile the samples by running make :
cd /Developer/CUDA/ && make - Now, open a terminal and run ranlib for the libraries, this adds the cuda libraries to the table of contents of archive libraries:
ranlib /Developer/CUDA/lib/*.a
(Replace /Developer/CUDA/ with the SDK installation location, if installed in a non-standard location)
Your CUDA installation should be complete now, and the samples should be built. You can now test the installation by running a few samples located at : <cuda_sdk_intallation_dir>/bin/darwin/release/
or, by default /Developer/CUDA/bin/darwin/release/
Ubuntu 8.10 Persistent USB Install from Windows
by sahilramani on Dec.29, 2008, under Uncategorized
Persistent Live CD using Windows
The following steps show you two ways to install Ubuntu on a usb pen drive, as a persistent install from within Windows, without even booting into a live Ubuntu cd!. A persistent install allows you to save preferences and all the changes you make to Ubuntu’s state.
Things you’ll need :
- 1 Pen Drive ( >= 2GB recommended )
- USB port, to attach the usb drive to.
- A motherboard that allows booting from USB drives.
- Ubuntu installation cd (or iso file on your hard disk ) . You can download the latest Ubuntu from : Ubuntu Web Site
Before you start : Please ensure you’ve backed up all the data of the pen drive. During the course of Ubuntu installation, you will lose all the data on it.
After downloading the iso image from the Ubuntu website, follow the steps :
- Format the pen drive to clear all the data and prepare it for installation.
- Download Ubuntu810P.exe, execute it, and after extraction completes a Ubuntu810P folder will be created.
- Now copy the Ubuntu iso file, and place it in the directory Ubuntu810P.
- In the Ubuntu810P folder, execute Ubuntu810P.exe from the command-line (NOTE: If running in Windows Vista, start command-line as administrator)
- Carefully read each instruction presented to you by the script and wait for the files to be copied.
- Restart the machine and boot from the USB disk.
Now all your settings/downloads and preferences should be saved.
EDIT: To clarify, this tutorial is everything I’ve learned from pendrivelinux.com. This post, in particular, is from the page : http://www.pendrivelinux.com/2008/11/04/live-ubuntu-810-usb-persistent-install-windows/
Ah, Wordpress 2.7
by sahilramani on Dec.27, 2008, under Internet, Software, wordpress
It feels like yesterday that I was untar-ing, backing up and uploading the new release of Wordpress, while making sure some obscure files and some wild directories were not directly uploaded, causing absolute mayhem and possibly even worldwide power grid failures. Well, that’s probably because it really was yesterday when I installed Wordpress 2.7
But now that it’s done, I’m awestruck. The dashboard looks unbelievable. The ability to restructure it even more so
! This is awesome. And the best part, no more downloading the new releases, you can ask Wordpress to update itself!
Pure Genius!
Kudos to the entire Wordpress team on 2.7 !
Ubuntu 8.10 persistent install using USB Creator
by sahilramani on Dec.26, 2008, under Software, Ubuntu
Persistent Live CD from Ubuntu
The following steps show you two ways to install Ubuntu on a usb pen drive, as a persistent install from the Ubuntu Live CD. A persistent install allows you to save preferences and all the changes you make to Ubuntu’s state.
Things you’ll need :
- 1 Pen Drive ( >= 1GB )
- USB port, to attach the usb drive to.
- A motherboard that allows booting from USB drives.
- Ubuntu installation cd (or iso file on your hard disk for persistent install from windows) . You can download the latest Ubuntu from : Ubuntu Web Site
Before you start : Please ensure you’ve backed up all the data of the pen drive. During the course of Ubuntu installation, you will lose all the data on it.
After downloading the iso image from the Ubuntu website, follow the steps :
- Burn the iso image file to disk.
- Reboot your computer, and boot from the cd.
- Select your language, and then ‘Try Ubuntu without any change to your computer’, and wait for Ubuntu Live CD to boot up.
- Once Ubuntu boots up, connect the usb drive, and wait for it to be recognized.
- Delete all files or format the usb disk.
- Navigate to System > Administration > Create a USB startup disk
- On the window that opens, (1) select the USB disk to use, and (2) Select ‘Stored in reserved extra space’ and move the slider to reserve the space necessary for storing your preferences/files.
- Click on Make Startup Disk. The progress bar should update on the progress of the installation.
- Reboot your system and set the usb disk as the startup disk.
Now all your settings/downloads and preferences should be saved.
EDIT: To clarify, this tutorial is everything I’ve learned from pendrivelinux.com. This post, in particular, is from the page : http://www.pendrivelinux.com/2008/10/15/ubuntu-810-persistent-flash-drive-install-from-live-cd/
Portal: Prelude’s out!
by sahilramani on Oct.25, 2008, under Games, Software
http://portalprelude.aquafire.org/
Well, for those Portal fans who didn’t notice this brand new page, and the link to it on the top right corner, leads to my mirror of Portal: Prelude, here’s the post to enlighten you! Head out to http://portalprelude.aquafire.org/ and download your copy! It’s completely free and the levels are wayyyy tougher than you can imagine. Give it a shot!
Create your own Nokia headset
by sahilramani on Oct.19, 2008, under Internet, Software
Not kicked about the looks of your funky new headset? Think you can do better? Nokia’s giving you the chance to design your very own headset, with their new Music Almighty campaign. The 5 best designs will actually be created by Nokia, and shipped to almost all suppliers across the globe. In their own words -
—-
The 5 winning designers will be invited to travel to the UK where they will see their concepts produced into bespoke fully functioning Nokia headsets. The collection will then be showcased at flagship stores all over the world and returned back to the winners for them to keep.
—-
So, head out to http://www.nokiamaheadsetdesign.com/ and put your creative hats on. Oh, get your visa’s ready too.
Yahoo! Pingbox
by sahilramani on Oct.02, 2008, under Internet, Software
Ok, so here’s a little messenger for your blogs, and if anyone did notice the first thing on the sidebar, well, that is pingbox! Go ahead, ping me….
Follow this link: http://messenger.yahoo.com/pingbox/ to add Pingbox! to your profile and chat privately with each of your visitors.
spore handicapped?
by sahilramani on Sep.23, 2008, under Internet
Have you heard the news yet? Better yet, have you seen the Amazon reviews on Spore? Apparently there’s been a mass uprising against the inclusion of DRM on the Spore CDs. DRM (Digital Rights Management aka Digital Restrictions Management) has been under the scanner recently for all the wrong reasons. It’s ultimate goal is commendable, but the route it takes to get there seems shady.
Yeah, about Spore, apparently they have an implementation of DRM built into the discs of Spore. These discs were on the stands recently and met with a large opposition, hampering their ratings and reviews. A campaign by defectivebydesign asks people to take action against the DRM by rating the game poorly on Amazon, and I must say, it seems to have worked. More than 2200 people have rated the game 1 star, drastically hampering the rating of the game.

