Jan 26

Florida Keys

As the saying goes, “journey is more important than the destination”, this trip of ours exemplefies it in the most literal sense. The memories would be cherished forever – Four friends, Nine days, 3760 miles, One helluva trip. Some of the show-stopper pictures are below. For the rest of the pictures please visit my gallery.

Jan 26

New Orleans and the Gulf Coast in Louisiana

Louisiana is a unique state in the US – with historical New Orleans, the Gulf coast and the Swamps. We had fun photographing the architecture in New Orleans and playing with the wild gulls along the coast, among everything else :-) . Some of the show-stopper pictures are below. For the rest of the pictures please visit my gallery.

Jan 26

Grand Teton National Park

Uploaded some pictures from a recent trip to the Grand Teton National Park. I think Grand Teton National Park is a photographers’ mecca with its numerous lakes and mountains, which allow for some amazing images with reflections, as popularized by the legendary Ansel Adams. I personally feel it is the most beautiful in the US that I have been to yet. Some of the show-stopper pictures are below. For the rest of the pictures please visit my gallery.

Oct 16

Saving Space in a Latex Manuscript

Adhering to page-limits for conference submissions can sometimes be extremely painful. Cutting down on text is not always the best option. Illustrated below are some commands which can help save space via formatting in latex especially w.r.t. figures and tables.

  • \floatsep: space left between floats in a single column.
  • \textfloatsep: space between last top float or first bottom float and the text.
  • \intextsep : space left on top and bottom of an in-text float.
  • \dbltextfloatsep is \textfloatsep for double column output.
  • \dblfloatsep is \floatsep for double column output.
  • \abovecaptionskip: space above caption.
  • \belowcaptionskip: space below caption.

These should be passed as a parameter to \setlength{….}{n[ex, mm, in]}. Floats refer to figures and tables in the manuscript. \setlength{….}{1ex} is known to work well.

Space within Bibliography can be saved by -

\def\sharedaffiliation{%
\end{tabular}
\begin{tabular}{c}}
\let\oldthebibliography=\thebibliography
\let\endoldthebibliography=\endthebibliography
\renewenvironment{thebibliography}[1]{%
\begin{oldthebibliography}{#1}%
\setlength{\parskip}{0.15ex}%
\setlength{\itemsep}{0.15ex}%
}
{  \end{oldthebibliography} }

Oct 04

Embedding OpenCL Kernel Files in the Application on Windows

OpenCL kernel files are often a hindrance in writing generic code because they lead to the use of absolute paths in the application. One can overcome this issue on Linux by using relative paths. However on Windows, visual studio is not very friendly to the use of relative paths. One way to solve this problem on Windows is to use Resources and the steps for doing are enumerated below.

  • Right-click on “Resource Files” in Visual Studio solution explorer and add a resource. A resource file (.rc) will now be added to the project. Open the .rc file and delete all its contents and just write the following in it:
RESFILE KERNELSOURCE "Kernels.cl"

RESFILE and KERNELSOURCE are just two keywords, and you can use whatever you want. Kernels.cl is your kernel file and it should be present in the $(SOLUTIONDIR).

  • In the .cpp file, include Windows.h. To convert the resource file to a string so that it can passed to clCreateProgramWithSource(), do the following:
HRSRC res = FindResource(nullptr, "RESFILE", "KERNELSOURCE"); // find the resource
HGLOBAL glob = LoadResource(nullptr, res);  // load the resource.
const char *textPtr = (char *)LockResource(glob); // lock the resource to get a char*
DWORD textSize = SizeofResource(nullptr, res); // get the size of the resource
std::string text(textPtr, textSize); // form a string for the resource file.
  • The above five lines can be compressed into two by:
HRSRC res = FindResource(nullptr, "RESFILE", "KERNELSOURCE");
std::string text = std::string((char *)LockResource(LoadResource(nullptr, res)), SizeofResource(nullptr, res));
  • To create the OpenCL program (clCreateProgramWithSource), one needs a char* pointer. Therefore, we need to convert std::string to char*, which can be done by:
const char *buf = text.c_str();
  • clCreateProgramWithSource can be called as follows:
cl_program program = clCreateProgramWithSource(myGPUContext, 1, buf, NULL, NULL);

The application is now free from all the absolute paths and can be run on any machine without any problems.

Sep 30

Yellowstone National Park

I just got back from a trip of a lifetime to Yellowstone National Park, the first national park in the US. Yellowstone is a unique place with more than half of world’s geothermal activity (geysers, hot-springs, fumaroles, mud-pots) and is also a habitat to extensive wildlife. The aura of Yellowstone is truly unmatched. Some of the show-stopper pictures are below. For the rest of the pictures please visit my gallery.

Aug 25

Texas State Capitol, ATX

I have been living in Austin for little more than an year now but never took out the time to visit the Texas State Capitol, until recently.

To sum my experience shooting the Capitol, it was amazing. It looks exactly the same like the Capitol in Washington DC but only a little bigger because as people say, “Everything is Bigger in Texas” :-)

Here are some of my pictures from this shoot.

dsc_0077 dsc_0087 dsc_0194

You can view a gallery of my pictures here.

Jul 17

How to install Windows on a system having a Linux installation

Below are the steps enumerated on how to install Windows on a system with Linux installation (the steps apply to Ubuntu for sure and may/may not work for other flavors of Linux) -

  • Create a live Linux installation on a USB from http://www.linuxliveusb.com/
  • Boot from the USB Linux-live installation and create a new partition for Windows using gparted.
  • Boot from the Windows DVD and install Windows.

Installing Windows over Linux corrupts the GRUB boot-loader and hence, the GRUB needs to be fixed.

  • Boot from the USB Linux-live installation and open a terminal.
  • Mount the existing Linux partition -
mkdir linux
sudo mount /dev/sda1 linux
  • Mount the /dev, /sys and /proc directories -
sudo mount --bind /dev linux/dev
sudo mount --bind /sys linux/sys
sudo mount --bind /proc linux/proc
  • Change the root to the mounted Linux partition -
sudo chroot linux
  • Update the GRUB -
sudo update-grub

You should now have both Windows and Linux listed in the boot menu upon reboot.

Jul 03

Grep for Multiple Words

You can grep for two (or more) words at once.

  • For example, create a file containing:
One
Two
Three
Four
Five
  • Then use the following grep command (the -E option enables extended regular expressions, which lets you use the | as an “or” operator):
grep -E 'One|Two|Three' file.txt
  • Output is:
One
Two
Three

May 23

Changing CPU frequencies on Linux

CPU frequencies in Linux (Ubuntu specifically) can be temporarily modified by writing to the “scaling_governor”  in -

/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

One needs to be root to be able to write to this file.

The available governors can be found by -

cat s/ys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors

The available governors are – conservative ondemand userspace powersave performance.

By default, the governor is set to “ondemand”, which means the CPU frequency is scaled as required by the system. For maximum performance, the governor should be set as “performance”.

One can do -

sudo update-rc.d ondemand disable

… to keep the governor you set persistent across reboots.

Older posts «