Tag Archive for 'linux'

Adding git-svn support from source

Having workstations where you don’t have root access either means contacting support for installation or building your own software from source to get the latest version.

I started using git for code produced in my work. The build was successful with a simple “./configure; make ; make install” series of steps except for supporting access to subversion repositories. It was looking for the perl module SVN::Core to be able to function successfully. Googling about it will land you to the Alien::SVN CPAN module page. Its dependencies can be installed with the standard “install Module::Name” invocation in the CPAN shell. But the main package does not properly install in this environment. It is probably because of the tarball not containing the standard Makefile.PL. It has Build.PL instead. This script generates the Build that compiles the subversion library and its bindings. Then it generates a Makefile from Makefile.PL in the src/subversion/subversion/bindings/swig/perl/native directory. Below is the output of the script:

[Alien-SVN-1.4.6.0]$ ./Build
Running make
Running make swig-pl-lib
make: Nothing to be done for `swig-pl-lib'.
Running /usr/bin/perl Makefile.PL INSTALLDIRS=site
Writing Makefile for SVN::_Core
Writing Makefile.client for SVN::_Client
Writing Makefile.delta for SVN::_Delta
Writing Makefile.fs for SVN::_Fs
Writing Makefile.ra for SVN::_Ra
Writing Makefile.repos for SVN::_Repos
Writing Makefile.wc for SVN::_Wc
Running make
gcc -c  -I/home/aespinosa/local/include/apr-0
...

The command /usr/bin/perl Makefile.PL INSTALLDIRS=site generates a build environment to install in /usr. This is not favorable for installation in userspace since you do not have permission to write on that directory. So this command will be rerun /usr/bin/perl Makefile.PL PREFIX=$USERDIR, where $USERDIR is the destination directory you want to.

Now you can successfully clone subversion repositories!

Related Posts Related Websites

Unix timer utility

Timer microbenchmark

Timer utilities performance on C and Perl of "echo -n"

The Unix time(1) command can only give a precision of 10 milliseconds by default. But being the engineer who goes insane after precision, I made my own script to be able to get differences in terms of microseconds. My first timer utility was made in C but I got stuck with the insane exec(3) family of functions since you need to fork the process to a child for the parent process to create successful timing. Hence I used Perl with the Time::HiRes library which is a wrapper to <time.h> and <sys/time.h>. Later on, I found out that C itself has the system(3) functioin in <stdlib.h>

Performance-wise you can see that C has a much faster runtime when the program was being invoked. But you can see in the graph above that Perl has much more consistent values so its standard deviation is lower than C. When I tested both programs for my data-intensive computing experiments, I get better results with the Perl utility! Perhaps I forgot to do all the magic the system function in Perl does in my C implementation?

Here is my Perl code:

#!/usr/bin/perl

use Time::HiRes qw ( tv_interval gettimeofday );

$start = [gettimeofday];
system @ARGV;

$elapsed = tv_interval ( $start );
print $elapsed, "\n";

Here is my C implementation:

#include <stdlib.h>
#include <stdio.h>

#include <time.h>
#include <sys/time.h>

int main(int argc, char* argv[])
{
	struct timeval start, end, diff;
	gettimeofday(&start, NULL);
	char* command = malloc( sizeof(argv) );
	int i;
	sprintf(command, "%s", argv[1]);
	for( i = 2; i < argc; i++ )
	{
		sprintf(command, "%s %s", command, argv[i]);
	}
	system(command);
	gettimeofday(&end, NULL);
	timersub(&end, &start, &diff);
	printf("%d.%06d\n", diff.tv_sec, diff.tv_usec);
	return 0;
}
Related Posts Related Websites

Compiz’s Scale plugin in Hardy Heron

I recently upgraded my workstation and Asus EEE to Ubuntu 8.04. To save on screen space on my UMPC, the top button was set to autohide. The bottom panel was removed and replaced by the avant-window-navigator also in auto-hide mode so I can have larger window icons. The final step was modifying the behavior of the scale plugin to activate whenever I place my mouse cursor at the TopRight of the screen.

Compiz session activating the Scale plugin window picker

The Scale plugin of Compiz shows all the thumbnails of opened windows in the current workspace. It looks like something in Mac OS X. The screenshot below shows a sample activation of the Scale plugin window picker using the default Shift-Alt-Up:

To enabled the mouse gesture behavior of the plugin, simple open the gconf-editor program and go to /apps/compiz/plugins/scale/allscreens/options. The initiate_edge name-key pair is by default set as an array so that you can combine multiple-key definitions like Ctrl-Alt-BottomRight. But indicating only a mouse gesture does not work. The workaround I did was to unset the key. Aftewards, it will change from an array list into a text field. Then write TopRight or whatever mouse gesture you want to activate the window picker.

To unset the initiate_edge key-value pair, simple right click on the entry and choose the “Unset Key” option.

Related Posts Related Websites

Rocks-4.3 kernel to support RTL8111b

To Beshr:

The vanilla install of Rockscluster 4.3 uses version 2.6.9-55EL of the linux kernel. Native support for the Realtek 8111B (r8168) did not come until 2.6.19.xx. I downloaded 2.6.23.13 from kernel.org. After rebuilding the kernel, you have to enable the kernel to map the hardware ID of the device to the correct module (r8169). Here is an archive of the files that I used to build the driver:

rocks-boot-drivers.tar.gz: I added the r8168 directory and modified the subdirs file to build this module for the kernel. It actually does not build anything since there are no entries in the SOURCE variable of the Makefile. Extract this tarball to your Rocks CVS tree ($ROCKS-SRC-ROOT/src/roll/kernel/src/rocks-boot/enterprise/4/images) The following entry was added to drivers/r8168/:

<br />0x10ec 0x8168 "r8169" "RealTek RTL8168B/8111B, RTL8168C/8111C Gigabit Ethernet controller<br />

Where 0×10ec 0×8168 is the hardware ID of my GigE controller.

Then I followed the instructions Creating a Custom Kernel RPM and Adding a Device Driver of the User Guide.

Good luck in building your cluster!

Related Posts Related Websites

Realtek 8111B GE on Rocks 4.3

I am currently building a new Beowulf cluster using Rocks 4.3. It uses the linux kernel version 2.6.9-55EL. After building the master node, it is time to install on the compute nodes. In normal conditions where everything is smooth, the Rocks kickstart system boots the compute nodes from the network via a dhcp-tftp-kickstart combination. But our Rocks cannot load the network driver. Upon identification of the driver, I downloaded the Realtek 8111B (r8168) from the vendor’s site. I followed the instructions on how to add a custom device driver to the kernel in the rocks documentation. It basically creates an initrd.img file where the kernel modules is installed. But the boot sequence does not load the kernel module properly. I had a couple of email exchanges with Greg Bruno, one of Rock’s developers over the mailing list to diagnose the problem. But building a custom kernel module for the current kernel have not solved the missing module.

Upon further investigation, the driver for my NIC was incorporated into the r8169 module of the vanilla kernel. So I downloaded kernel version 2.6.23.13. First the kernel*.rpm packages must be built and installed in the /home/install rocks repository. Next, the rocks-boot package should be rebuilt in order to incorporate the new kernel. But since Centos uses an older version of the kernel, the hardware id of my NIC is not associated to the r8169 kernel module. So I created a dummy device driver in the rocks-boot repository. In the Makefile, I removed the source file to be compiled and simply added in an entry for my driver in the pcimap.

Now my compute nodes was able to grab the kickstart file and install an entire operating system in 10 minutes!

Related Posts Related Websites