Archive for the ‘Tutorial’ Category

Infiniband IPoIB & SRP target setup on Ububtu 11.10

Saturday, December 24th, 2011

In a previous blog article, I covered how to get the infiniband fabric up on Ubuntu 10.10 (Maverick Meerkat). This time I’ll cover IPoIB on Ubuntu 11.10 (Oneiric Ocelot), and also add in the information on how to also get the SRP target configured and running. This guide does not require you to rebuild the linux kernel, and works from the stock install of Ubuntu 11.10. So you should be up-and running with an SRP target in about 15 minutes, all going well.
As before, I’m using an Ubuntu box for the disk subsystem, and a Windows 7 as a client (initiator) machine.

Here’s a few acronyms:

SCSI – we should know what this one is (Small Computer Systems Interface)
iSCSI – SCSI protocol over a network.  (Internet SCSI).
SCST – SCSI Target subsystem for linux with target drivers for iSCSI, Fibre Channel, SRP, SAS, FCoE, etc. We’re most interested in the SRP target.
RDMA – Remote Direct Memory Access – fast way of copying chunks of memory from one machine to another.
SRP – SCSI RDMA Protocol – wraps it all up using RDMA over SCSI protocol.

Stage 1 – Setting up IPoIB

This section shows how to get the basic fabric up and running with TCP/IP over Infiniband (IPoIB). Once you’ve done this, you’ll be able to send pings between the machines, ssh from one to the other across the fabric, etc.

For the windows 7 machine, it’s a simple case of installing the OFED drivers from  openfbrics.org. While installing the windows drivers, make sure you select the SRP options, as later in this guide we’ll be setting up the RAID box as a drive on the Windows box using SRP (iSCSI RDMA Protocol). So,  install the OFED driver package.

To enable improved throughput, enable connected mode on the link by updating the “Connected Mode” and “Connected Mode Payload Mtu size” in the properties of the interface. Open up “Device Manager” and find your Infiniband adapter:

Right clock on the adapter and bring up the properties dialog:

 

So, on to the linux box. I started with a fresh install of Ubuntu 11.10.

Firstly Install Ubuntu. Update all the packages to the latest using

sudo apt-get update
sudo apt-get upgrade

Everything below is done as root, this avoids having to type ‘sudo’ before every command, so I just call “sudo bash”.

Note: No need to edit the udev rules any more as per the Ubuntu 10.10 HOWTO, as they are correctly set by the kernel 3.0.0 and newer.

Edit /etc/modules and add the following modules:

ib_sa
ib_cm
ib_umad
ib_addr
ib_uverbs
ib_ipoib
ib_ipath
ib_qib

Next,

apt-get install opensm

This will install the subnet manager and all the relevant dependencies, libibverbs, etc.
Then add the relevant entries for the interface into /etc/network/interfaces file:

auto ib0
iface ib0 inet static
address 192.168.1.1
netmask 255.255.255.0

Then reboot. This will create the relevant infiniband entries in /sys, load the ipoib modules, and bring up the infiniband port with an ip address. You should now have a functioning infiniband port on your Ubuntu machine, and you should be able to ping the remote machine.

The next thing is to enable connected mode for the infiniband connection. I found that this increased the tcp/ip netperf benchmarks from 3gbps tp 7gbps.

root@raid:~# echo connected >`find /sys -name mode | grep ib0`
root@raid:~# echo 65520 >`find /sys -name mtu | grep ib0`

To make this happen when the ib0 interface is brought up, modify the /etc/network/interfaces file as follows:

auto ib0
iface ib0 inet static
address 10.4.12.1
netmask 255.255.255.0
up echo connected >`find /sys -name mode | grep ib0`
up echo 65520 >`find /sys -name mtu | grep ib0`

 

Stage 2 – Setting up SRP Target

The next step, should you wish to take it, is to set up the SRP targets. This is much better option than using samba shares, as it gives you a massive boost in throughput, and uses much less CPU. For example, on my setup using IPoIB and samba shares, I was able to achieve no more than 125MB/sec. Using a ramdisk set up as an SRP target, I was able to achieve 900MB/sec between my two machines.
So, first get a few packages:

apt-get install libmthca1
apt-get install iscsitarget
apt-get install open-iscsi
apt-get install lsscsi
apt-get install scsitools
change /etc/default/iscsitarget to:
ISCSITARGET_ENABLE=true

We now need to get scstadmin. I typically pull the latest version from subversion, so we first need to get svn. apt-get install subversion
There’s a choice to me made now. According to the guide at http://iscsi-scst.sourceforge.net/iscsi-scst-howto.txt , you get a slight performance increase by patching and re-compiling the kernel. That’s a lot of work, so I skipped that step for this guide. I went for the easier option, which is just to run the few commands below. I’m not sure what the difference in performance is, but I can still pull 900MB/sec across the fabric from a ramdisk set up as a an SRP target. And not having to rebuild the kernel makes this a 15 minute procedure rather than a 3 hour one. :)

cd ~
svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
cd scst
make scst scst_install
make iscsi iscsi_install
make scstadm scstadm_install
make srpt srpt_install

N.B.: You’ll need to rebuild these each time Ubuntu upgrades the kernel, as the modules get out of sync. Just re-run the make’s again.

Lets now use scstadmin to create an SRP target:

First we modprobe a couple of kernel modules. That will make the relevant drivers and targets available to scstadmin. We should then be able to see thse drivers/targets with a few scstadmin ‘list’ commands:

modprobe scst_vdisk
modprobe ib_srpt
root@raid:~# scstadmin -list_handler

Collecting current configuration: done.
 Handler
 -------------
 vdisk_fileio
 vdisk_blockio
 vdisk_nullio
 vcdrom

All done.
root@raid:~# scstadmin -list_driver

Collecting current configuration: done.

 Driver
 -------
 ib_srpt

All done.
root@raid:~# scstadmin -list_device

Collecting current configuration: done.

 Handler           Device
 ------------------------
 vdisk_nullio     -
 vdisk_fileio     -
 vdisk_blockio    DISK01
 vcdrom           -

All done.
root@raid:~#
So, if you can see those handlers, targets, and drivers, your good to go with the next step.

Summary:

The following command list is the quick list to use (and modify) if you’ve done this kind of thing before. The detail section below gives a bit of explanation on each of the lines.

scstadmin -disable_target ib_srpt_target_0 -driver ib_srpt
scstadmin -clear_config -force
scstadmin -open_dev DISK01 -handler vdisk_blockio -attributes filename=/dev/sda
scstadmin -set_dev_attr DISK01 -attributes t10_dev_id=0x2346,threads_num=4
scstadmin -add_group HOST01 -driver ib_srpt -target ib_srpt_target_0
scstadmin -add_lun 0 -driver ib_srpt -target ib_srpt_target_0 -group HOST01 -device DISK01 -attributes read_only=0
scstadmin -add_init 0x0002c9020021f9fc0002c902002200bc -driver ib_srpt -target ib_srpt_target_0 -group HOST01
scstadmin -enable_target ib_srpt_target_0 -driver ib_srpt
scstadmin -write_config /etc/scst.conf

Detail:

Clear the current config (only if that’s ok, and you don’t have any other config that you want to keep. I do this because I’m starting with a clean slate).

scstadmin -clear_config -force

Create DISK01, assigning it to a partition (/dev/sdg1, /dev/md0p1, etc., etc.). I’m using a disk partition in this example.

scstadmin -open_dev DISK01 -handler vdisk_blockio -attributes filename=/dev/sdg1

Now set the drive attributes.

scstadmin -set_dev_attr DISK01 -attributes t10_dev_id=0x2345

Now add a group

scstadmin -add_group HOST01 -driver ib_srpt  -target ib_srpt_target_0

Add a LUN to the group, assigning it to DISK01

scstadmin -add_lun 0 -driver ib_srpt -target ib_srpt_target_0 -group HOST01 -device DISK01 -attributes read_only=0

Add an initiator to the group, allowing the initiator to connect to our new target. I got this from watching /var/log/messages while I was disabling and enabling the Infiniband SRP miniport in device manager on the Win7 box. This caused the SRP miniport to attempt to connect to the Ubuntu target, and that attempt is shown in the /var/log/messages file along with the initiator ID.

scstadmin -add_init 0x0002c9020021f9fc0002c902002200bc -driver ib_srpt -target ib_srpt_target_0 -group HOST01

Finally enable the target

scstadmin -enable_target ib_srpt_target_0 -driver ib_srpt

And write the config.

scstadmin -write_config /etc/scst.conf

At this point you should see a new drive appear on the Win7 box, and asking you to format it. If not, you could try disabling and enabling the SRP miniport driver again, and take a look at /var/log/messages to see what’s happening.

Once the new drive appears on the Windows host, you should be able to format it and start using it. If you don’t see it immediately, have a look in “Disk Management”.

I found that the //etc/init.d/scst script was not getting called at boot, so I added a softlink in /etc/rcS.d

cd /etc/rcS.d
ln -s ../init.d/scst S26scst

This is so it will start after scsitools, opensm and open-iscsi. Using the /etc/init.d/scst script also resolved a problem I’ve had for a long time, in that I used to have some modules in /etc/modules, so the SRP miniport would attempt to connect too early in the linux boot sequence, and fail, so that I had to go into the device manager and disable/enable to get it working. Now it pops up perfectly every boot of the linux box, and I  don’t have to go into device manager on the Win7 box any more.

I’d suggest you run a benchmark on it also just to see what kind of speed you’re getting out if it in real-world usage. There’s a very handy (free) benchmarking took available from attotech.com. Oh, and please do drop a comment below if you do get decent speeds. I’m always interested to hear what people are getting. Oh, and also, comment if you find this guide useful!

 

References:

SCST – http://scst.sourceforge.net/

Installing iSCSI-SCST – http://iscsi-scst.sourceforge.net/iscsi-scst-howto.txt

 

Performance Testing.

If you have plenty of memory in your linux machine, you might like to do a test of a ramdisk SRP target over the fabric.

There’s a ramdisk set up by default in Ubuntu at /dev/ram0, but it’s quite small, at 64K. I like to bump it up to 1Gig or 2Gig, as I have 4Gig in my linux box and it does need all that for normal operation. Adding an extra parameter to the kernel line in /boot/grub/grub.cfg does the trick nicely.

ramdisk_size=1024000 for a 1Gig ramdisk at /dev/ram0

ramdisk_size=2048000 for a 2Gig ramdisk at /dev/ram0

so the full line would look like:

linux   /boot/vmlinuz-3.0.0-12-generic root=UUID=39331d95-e9ba-48a5-9dd9-09978e0503c4 ro   quiet splash vt.handoff=7 ramdisk_size=1024000

Then using scstadmin, we add another disk to the script above, but we use vdisk_fileio rather than vdisk_blockio.

scstadmin -open_dev DISK02 -handler vdisk_fileio -attributes filename=/dev/ram0

Then when you open disk manager in windows, you should see a disk requesting a new MBR, which you go ahead and add, then format and run a few benchmarks on it.

 

Workflow Tip – Fast cards & Fast readers

Thursday, May 19th, 2011

Here’s something that might be of interest, and will help speed up some parts of your workflow.

Get a faster memory card, and the means to get the images onto your PC as quick as possible.


I recently ordered a couple of 600x Duracell 8Gb Compact flash cards from 7DayShop.com….
They give a read speed of 90MB/sec. and are only £20.99 for 8Gigs. That’s great value.

Now USB 2.0 can’t go that fast, it can only manage about 45MB/sec if you’re lucky.
But USB 3.0 is getting much more popular, so you could get yourself a USB 3.0 card reader.
This one is about €19 from the UK.

USB 3.0 is rated at 5gbps, or in megabytes about 500MB/sec, More than enough for the fastest CF/SD card, so should be able to max out the 600x Compact Flash card.

If your PC doesnt have a USB 3.0 connection, you can always add one using a USB 3.0 PCIe adapter (about €20).

Or, for a laptop (about €20).

The Pretec card reader comes with a pretty short stubby adapter, so if you want to have the card reader on your desk, you’ll also need a cable (about €5).

So, you’ll have the added advantage that your camera will be able to keep going longer for those rapid-fire shots (by writing to the card faster), and you’ll also get your images off your card and onto your PC MUCH quicker, giving you more time to process, etc.

The following is a benchmark of the above setup.

As you can see, this card is really tuned to work with a block size of 64K or greater. The write speeds max out at  is 30MB/sec, but the read speed jumps dramatically to 90MB/sec once the block size hits 64K.

Rgds,
Dave.

DIY Intervalometer for Time-lapse videos

Saturday, May 7th, 2011

(See edit below regarding DSLRBot. A slightly more expensive solution, but quite a bit better…)

Recently I was awe-struck by a Time-lapse video by Terje Sorgjerd I saw which was shot around El Teide on Gran Canaria early in 2011. Looking around on the internet, I saw various solutions for time-lapse, including some very fancy rigs for moving the camera as it’s shooting the images. What I needed was something that could trigger my dSLR camera to take an image at regular intervals over a few minutes up to a few hours. The camera already has a port for a remote switch, so I needed some way to trigger that at regular intervals. There are solutions available as cheap as €50 on e-bay, so I wanted to see if I could do it a lot cheaper than that.

I came up with the idea of using my smartphone’s camera flash to trigger an optical switch, and hook the optical switch into the remote trigger port on the camera. I could then write an app on the phone that would trigger the flash at intervals, thus triggering the dSLR to take an image. I happened to have an optical sensor for triggering flash heads (I use these sometimes for strobist work). This did not work. Maybe it needed a small voltage to operate. Anyway, I headed out to my local Maplin store, and got myself a phototransistor (SFH300-2) at about €2.49. I had a spare shutter release cable lying around that I got off ebay for about €5, so I took the switch off the end and replaced it with the photo-transistor. Nothing else, just the photo transistor directly wired to the shutter release port of the camera.

So, I plugged the phototransistor cable into the camera, and tried taking a picture with the smartphone while holding the phototransistor up to the flash of the phone, and it successfully triggered the dSLR. Yay!

So, the theory worked. One photo-transistor connected to the shutter release port of the dSLR was the hardware side sorted. Now for the software side.

Before investing in a few dozen hours getting the development kit for the iPhone, I took a quick look at any apps already out there for the iPhone that might do the job. Sure enough, there were a couple of apps that do just what I was looking for, and they were free. The one that I settled on was “Canopy Camera Tools” app, that had an intervalometer built in. It would take a picture at pre-defined intervals, and if I set the flash to be always on, this would trigger the dSLR, and I could then throw away the images taken on the iPhone, using the dSLR images for my time-lapse video.

So, with Canopy installed on the iPhone, I duck-taped the phototransistor in place on the back of the iphone, and took my very first time-lapse video.

I set the phone to take 160 images at intervals of 3 seconds. Because the flash duration on the phone would cause several shots to be taken for one shot on the iPhone, I set the dSLR to 2 second timer. Once I’d taken the shots, I loaded them onto my PC, re-sized them down, and used a free application called “PhotoLapse” to stitch them together into a video. The result is here. Very rough, long lens pointing out a dirty window. But you get the idea. :)

Once I proved that it all worked, I made an enclosure that would fit around the top of the iPhone, and hold the photo-transistor in the best position to be triggered by the phone’s flash.

So, I guess I could stretch the truth and say that this is an intervalometer solution for €2.49, but that’s assuming you have a dSLR shutter release cable that you can hack and a smart phone with suitable software. Even then, the shutter release will only cost you about €5. I believe it’s the cheapest solution around for time-lapse videos with a dSLR. :)

Enjoy.

Here’s another slightly longer timelapse test video…

—Edit—
So, I found DSLR bot has a very similar solution, except that it uses a couple of IR-LEDs driven from the audio-out port of the iPhone. I found an old TV remote control and ripped out the two IR-LEDs from it, put them onto a 3.5mm stereo jac plug, and bought the DSLRBot app at €3.99. So, I’m sure you’ve got some old tv remote controls, and a stereo jac plug lying around, that’s all you need. For build instructions, check out the DSLRbot web page.

DIY Double Flash Clamp (under €5)

Saturday, March 5th, 2011

I was browsing around Woodies DIY today, and spotted the following clamps for sale in the bargain basement bin at €2.99 each. The spring was strong, and the plastic seemed like the good quality, hard wearing type. So I purchased a couple with some DIY strobist work in mind…

I noticed that the plastic jaws did not have a lot of grip:

so I super-glued some bits of bicycle inner tube to them:

Next, onto the real reason for the purchase, the double flash mount. This consisted of a simple tube bolted onto one of the handles of the clamp.

The copper tube has a bit of timber jammed into it so the tube would not collapse when brolly/strobe holders are screwed onto it. A simple drill hole in the clamp handle, and a drill hole throuhg the copper pipe, with a 30mm bolt and wingnut to hold them together. All done. The Result:

They’re probably not as strong as the Manfrotto clamps, and would struggle to hold a flash out horizontally, but the have no problem holding two strobes in the position of the image above, and would have no problem hanging from something. Not bad for under a fiver….

 

 

 

Epson R2880 Printer Head Cleaning

Sunday, November 14th, 2010

There’s a very handy feature of the Epson R2880 printer that I only discovered in the last few months, and it’s been great when it comes to cleaning the heads before making an important print, and ensuring all of the nozzles are getting a good ink supply. I put this little blog article together because I was using the printer for about a year before I discovered it (I know, it pays to read the manual), and I thought that it might be worth mentioning just in case anyone out there might find it useful also. It’s probably available in a good few of the Epson printer range.

The printer head is made up of an array of tiny nozzles, split into one array for each colour. In the R2880, there are 8 colours, each colour having an array of about 180 nozzles. That makes a total of 1440 nozzles in the print head! That’s a lot of nozzles, and a lot of chances to get a dodgy print!

Anyway, the auto-check-and-clean function is in the printer dialog screen:

By clicking on the top left icon “Auto Nozzle Check and Cleaning(C)”, the printer will start printing out a check grid, and will then read back what it’s printed to ensure that all nozzles are printing as expected. The following is the resulting output of the auto clean process. (Click on the image to see a bigger version).

Oh, an it’s advisable to insert a good paper for this, such as a glossy paper. It gives better contrast than plain paper, making it easier for the printer to read back the test patterns it’s just printed.

So, in the test page above, the printer prints the first 4 colours. Then it reads back the patern. Becuse there’s a couple of missing blocks in the Light Black array (right side of area marked Pass 1), it runs a clean cycle. Once that clean cycle is complete, it’ll print that pattern again and re-check. If that’s ok, it’ll then print the second 4 colours (Marked as Pass 2). It then sees that Cyan is missing a few blocks in the pattern, so it runs the cleaning cycle again.  For Pass three, you’ll notice that it prints the first 4 colours again, then the second 4 colours. This is because the clean cycle may have affected some nozzles in the 1st 4 colours, to it needs to be sure that these are still working ok. For pass 3, you can see that ALL the Cyan nozzles are now lacking ink. So it cleans again. Finally, on pass 4, everything checks out, and the process completes successfully.

I’ve found that it may take doing this process twice, but it’s usually a lot easier than doing a manual nozzle check and clean repeatedly. Also, I suspect that when it’s charging the nozzles, it may only charge the colour that’s Missing ink rather than all colours, thereby wasting ink, but that’s only a theory.

Canon 540EZ DIY Sync Port

Sunday, November 7th, 2010

After coming away from a workshop with Ciaran Whyte, I decided to have a go at making a tri-flash hotshoe adapter, seeing as we made so much use of one during the day. I happen to have 3 Canon 540EZ strobes which I could use. To make things easier to mount, I wanted to trigger all three strobes with a single radio receiver. To do that, I’d have to modify my strobes to give them a sync port.

Adding sync-ports to the 540EZ strobes

The following images show the steps I went through to make the mod. First I’ll start with a before-and-after shot:

On the strobe on the right you can see the 3.5mm jack socket mounted in the red plastic window. I had to remove some parts of the strobe to make room for the socket, but since I only ever use these in manual mode, they bits I took out are never used. Undoing the 4 small screws at the bottom allows you to remove the hotshoe section of the strobe.

Next images shows the part of the strobe that we’re going to discard to make room for the sync port:

Next, we pop out the red window, drill a 6mm hole in it (I used a special acrylic drill bit I had lying around. Using other bits may crack this piece, be careful.

Next, we solder two wires from the jack socket to the relevant pins on the hotshoe. In the 540EZ, the ground is the blue, and the trigger is the red.

Red window, re-inserted, soldering all done, about to re-assemble:

All back together. You might want to test the connections before putting it all back together.

Testing the new sync port with a 3.5mm jack to 3.5mm jack cable. The Cactus V4′s have a 3.5mm jack socket on the side. Nice feature.

All three 540EZ’s complete, with new 3.5mm jack socket sync port.

The next task was to make up a 4-way 3.5mm jack plug cable, so I could connect all three strobes together to one wireless receiver:

Followed by a few quick test shots:

The 3-flash setup will give you one of two things:

  • Three times the power
  • Or, faster recycling times.

The 4-way cable saves on radio receivers.

The Triple-Flash adapter

I then took the three hotshoe/umbrella adapters I had, and thought about mounting them on the same tripod. The simplest method at hand was two pieces of cylindrical hardwood bolted together into a cross. That way I could put one ‘end’ into the tripod, and put the three hotshoe adapters on the other three ‘ends’. (oh, and I cut the bolt for a neater finish).

Twisting the strobes and adapters into the following configuration, I ended up with a pretty neat setup, all triggered off a single radio receiver.

I put set this up beside a 400W studio head I have at home. To test the power of the tri-flash setup, I set all strobes to max power and adjusted my camera until I got the histogram right. I then put the 400W head at full power, and to my surprise, the histogram was just about the same! (maybe 1/3 stop more). So, with the 3-strobe setup I’ve now got about 400W of portable power. :)

—EDIT—

Extra Circuit to get Cactus V4s to trigger 3 540EZs

I was having problems triggering all three flashes with the single Cactus V4. The refresh times went to hell. One or two flashes, fast recycle time (@ 1/128 power) but with three connected, several seconds.

I recoon the problem was down to poor isolation between the trigger and the three strobes, so I designed and built the following prototype:

Shown in the above (very messy) circuit is a 3V power supply, two 3.5mm jack sockets (one for trigger, one for flash 4-way cable), a 50 ohm resistor, and a small low-voltage transistor. The theory was that when the trigger closed the circuit, 3 volts would be gated into the transistor, causing the output to short circuit, triggering the 3 strobes simultaneously. This triggering would be electrically isolated from the output of the wireless receiver, so it should recover quicker, allowing me to trigger rapidly in succession, which it was not when directly connected. At least that’s the theory. And low-and-behold, the damn thing worked. There was no-one more surprised than myself. I could now trigger all three strobes as fast as my thumb could press the transmitter test button. No delays from the receiver. Wicked. So I then pulled out an old eBay trigger that no linger worked, mounted all the above circuit into a nice neat box, and got some well earned sleep.

Here’s the enclosure showing the batteries, and input and output 3.5mm sockets.

I used the existing power switch as well, so the circuit is completely dead unless I switch it on. I’m wondering if I should integrate the transistor and resistor straight into the drigger? Might be a squeeze, but it’s one less set of batteries to be worried about. Maybe it’s not worth the trouble. Anyway, I was happy to have solved my trigger speed issue.

I’ve also tested this with a set of borrowed Yongnou RF-602 triggers. These do not exhibit the same issue as the Cactus V4′s, in that I can plug the 4-way cable directly into the receiver and it will trigger all three strobes without any  recycle delays. These must have better trigger isolation than the Cactus V4′s. No need for the extra circuit. –Edit– You can add Cactus V5′s to the list that don’t need the extra circuit.

Needs Circuit:

  • Cactus V4

Doesn’t need extra circuit:

  • RF-602
  • Cactus V5