Tuesday, December 21, 2010

Starting R to run Rmpi jobs

I always forget the proper command to start R to run Rmpi jobs. Here it is:

mpirun -np 1 --hostfile [name of hosts file] R --no-save

The thing that always throws me is that I use -np 2 or whatever number of processors. I forget that you need to start one instance of R and then from within that one instance you can access however many processors you have in your hosts file.

Note: You get the same thing by using "orterun" rather than "mpirun" in the above command, but I like mpirun because it is obvious what it is doing.

Monday, October 04, 2010

Slow PDF printing in Linux

I've struggled with slow printing of PDF files in Linux recently. It's only been in recent months though. I do not recall having this problem before.

I finally realized that it was only a problem to print PDF files that are scanned images. The solution was buried in this thread:

http://ubuntuforums.org/archive/index.php/t-1073942.html

I set up a second printer. It is parallel, so (in Gnome) I went to System > Administration > Add

I selected "Other". I needed a Device URI. A google search suggested for parallel printers that parallel:/dev/lp0 might work. I tried it, used "Generic" for the manufacturer, and chose PCL 5e as the driver.

Works great. All PDF images print fast if I remember to choose the Generic printer rather than the HP.

Tuesday, August 03, 2010

Cuda on Slackware 13.1

This was much easier than I expected. Note that I'm running Slackware 13.1 32-bit.

Step 1: Install the latest NVidia driver (256.44 in my case). You can't use the SlackBuild from slackbuilds.org. The latest NVidia packages are quite different from 195.*. I uninstalled the existing driver (that I had earlier installed from slackbuilds.org), downloaded the latest NVidia driver, and installed it according to the instructions.

Step 2: Install the CUDA toolkit for Fedora 12. This amounted to downloading the file and running it. I accepted all the defaults.

Step 3: Install the CUDA SDK. Again, I downloaded the file, ran it, and accepted the defaults.

Step 4: Change the paths according to the CUDA instructions.

Done! This was so much easier than Ubuntu, Mint, Debian, and others. I didn't expect it to work by just downloading a few files and running them. I'm certainly not complaining. I ran make for the examples, they all compiled and ran perfectly.

Wednesday, July 28, 2010

Gretl on Slackware 13.1

I recently built gretl 1.9.1 for Slackware 13.1. I needed to install two packages first, fftw and gdk-pixbuf. Both are available from slackbuilds.org.

LAPACK and BLAS are also necessary. I prefer to use the ACML because it is a lot faster than an unoptimized BLAS. I created symbolic links to make libacml.a appear to be both libblas.a and liblapack.a in /usr/lib:

ln -s /opt/acml4.4.0/gfortran32/lib/libacml.a /usr/local/lib/libblas.a
ln -s /opt/acml4.4.0/gfortran32/lib/libacml.a /usr/local/lib/liblapack.a

Here's the SlackBuild. It built a package and upon installation it runs correctly.
#!/bin/sh
# Heavily based on the Slackware 12.2 SlackBuild
# http://gretl.sourceforge.net/gretl_italiano.html

NAME=gretl
VERSION=1.9.1
ARCH=${ARCH:-i486}
BUILD=1mf
CWD=`pwd`

if ["$TMP" = ""]; then
 TMP=/tmp
fi

PKG=$TMP/package-$NAME

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

mkdir -p $PKG/usr

cd $TMP

tar xvjf $CWD/$NAME-$VERSION.tar.bz2

cd $NAME-$VERSION

CFLAGS="$SLKCFLAGS" \
./configure --prefix=/usr --build=i486-slackware-linux --with-lapack-prefix=/usr

make
make prefix=$PKG/usr install

mkdir -p $PKG/usr/doc/$NAME-$VERSION
cp -a ChangeLog COPYING EXTENDING INSTALL README README.audio README.win32 TODO $PKG/usr/doc/$NAME-$VERSION
mkdir -p $PKG/install
mkdir -p $PKG/usr/share/pixmaps
mkdir -p $PKG/usr/share/applications
cat $CWD/slack-desc > $PKG/install/slack-desc
cp $CWD/gretl.png $PKG/usr/share/pixmaps/gretl.png
cat $CWD/Gretl.desktop > $PKG/usr/share/applications/gretl.desktop
cp $CWD/$NAME.SlackBuild $PKG/usr/doc/$NAME-$VERSION/

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

mv $PKG/usr/share/man $PKG/usr
gzip -9 $PKG/usr/man/*/*
chmod 755 $PKG/usr/bin/*

cd $PKG

chown -R root:root .

requiredbuilder -v -y -s $CWD $PKG

cat $CWD/slack-required > $PKG/install/slack-required
cat $CWD/slack-required > $PKG/usr/doc/$NAME-$VERSION/slack-required

makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
 rm -rf $TMP/$NAME-$VERSION
 rm -rf $PKG
fi
License note: This is a modified version of a SlackBuild downloaded from slacky.eu a long time ago. It is in the public domain, as I understand it, and my modifications are public domain as well.

Monday, January 18, 2010

Simple clamav tutorial

To install clamav on Slackware 13, I used the SlackBuilds.org SlackBuild.

To update the database:

freshclam

To scan all files in directory dir:

cd /dir
clamscan -r -i

This will scan all files in that directory and all subdirectories, and will only print out the names of infected files.

Restart networking in Slackware 13

Couldn't easily find it, so here it is. As root, run

/etc/rc.d/rc.inet1 eth0_restart

You may have to change the "eth0" if your interface goes by a different name.