Getting Boost to Compile Correctly with Visual Studio 10 & CUDA on a 64-bit Machine

January 14th, 2011

Sexy title, I know!

Anyways, I’m developing using Visual Studio 10 (not my choice).  I have a project which involves the use of CUDA and Boost. The newest version of CUDA (at the time of this writing) won’t work out of the box with the  vs100 compiler that comes with Visual Studio 10.  CUDA can use nothing newer than the vs90 compiler.  So, I  install visual studio 9 and 10 and select v90 as my compiler for my Visual Studio 10 project.

Yesterday, I needed the Boost C++ libraries and began to install them.

The Boost installation is pretty good.  Its fairly automated which is nice.  You essentially call bootstrap and then bjam; they take care of all the configuring and building of the .libs.  However,  Boost’s scripts see that I have Visual Studio 10 installed and compile everything with the vs100 compiler.  This breaks my project in  Visual   Studio (I get all linking errors related to Boost) as I’m in  Visual Studio 10, but using the v90 compiler because of CUDA.

So, I figured out how to override Boost’s configuration to compile with the vn90 compiler instead of the vc100 compiler.  Here is how I fixed the problem.

 cd to BOOST_ROOT
 boostrap
 "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"    // This invokes the vc90 environment variable set.
 bjam --toolset=msvc-9.0 --build-type=complete architecture=x86 address-model=64  // Makes Boost!

If you don’t run the 3rd line (vsvars64.bat), you will see tons of “cl” errors when running  bjam.  Essentially, Boost tries to call the vc90 compiler (cl.exe), but because the environment is hosed, it cant find it and bombs.

Installing Linux with a Promise ATA-66 Controller mini-HOWTO

December 31st, 2010

This article is a re-post from my old website (personal.psu.edu)

Abstract

A hard drive connected to an Ultra ATA-66 card operates a bit differently then a drive not connected to the card. What we are going to do is retrieve the Input/Output ports that your card uses to exchange information between the card and computer. We then will  then use those to tell linux where to go to talkto your card when we install linux. After that we will adjust lilo.conf to also point linux to the correct place upon booting from the hard drive. Sound confusing? It’s really not.

Read First

Please read everything before you start installing anything. Make sure you make a boot disk too if possible. It will make your life much easier for the booting part below. Also, these instructions worked for me and may not work for you or may mess your system up. Whatever you do, is what you do. I am not responsible in any way for what negative effects result from following these instructions.

Why Red Hat?

I was using it when the problem first occurred. Since then I have switched to Mandrake and am now an official tester. This HOWTO has worked for many other linux distribution other than Red Hat including Mandrake. Your results may vary.

Installing Red Hat 7.0 with a Promise ULTRA ATA-66 controller.

  1. Put your Red Hat 7.0 disc 1 in your CD-ROM drive and boot your computer. Your computer should boot to the CD, if it doesn’t.. make it.
  2. After loading, there will be a screen with some text on it. At the prompt, type linux rescue and hit enter.
  3. Now, all this text will start scrolling on your screen. Eventually you will be left at a text screen with a blue background and a red box asking you what language you want to run in. At this time, press ALT-F2. You will be left at a black screen with a prompt in the left hand corner of the screen.
  4. Type cat /proc/pci
  5. Some stuff will scroll up on the screen again. Look for your controller in all this mess. You can press SHIFT-PgUp or SHIFT-PgDown to scroll through that slop if some of it scrolled up to far to see.
  6. When you have found your card, you will notice that your information is indented. You will see something similar to the following:
    I/O at 0x1410 [0x1411].
    I/O at 0x1404 [0x1405].
    I/O at 0x1408 [0x1409].
    I/O at 0x1400 [0x1401].
  7. That’s your ticket. Write down the vertical column of number WITHOUT the brackets on the them. In this example you would write down 0×1410, 0×1404, 0x.1408, 0×1400.
  8. Now, reboot your system leaving the CD in the drive again for the computer to boot to.
  9. When at the first prompt type:
    linux ide2=0x1410,0x1404 ide3=0x1408,0x1400
    Be sure enter the numbers that your wrote down just previously. You should be smart enough to know how to substitute this.
  10. Your on your way to installing now.

Proper Booting

These instructions will hopefully enable you to boot into Red Hat.

  1. Take out the CD and put the boot diskette you made during your instillation in the floppy drive.
  2. Boot your computer and when at the prompt type linux rescue.
  3. We are now going to need to mount the drives you just installed linux on. Do this by typing the following
    mkdir /mnt/root
    mount /dev/hdxx  /mnt/root //where xx is the drive you of your / partition.
  4. Type vi /mnt/root/etc/lilo.conf //this will boot the text editor vi
  5. Find the section where instructions are to boot to your linux drive. Under that section add the following line: append " ide2=0x1410,0x1404 ide3=0x1408,0x1400" (no quotes) where the number 0xXXXX correspond the number your wrote down and typed in earlier. Notice there is a space right after the first quotation mark. This is intentional.
  6. Save that file.
  7. Type: chroot /mnt/root
  8. Type lilo and the prompt. If you get errors, correct them by editing lilo.conf.
  9. Reboot.

Installing with Mandrake 8.0

Many people have been having trouble getting Mandrake 8.0 to boot after installing. This is a particular strange error due to the fact that when installing, all the hard drives are correctly identified and the install works fine. However, when booting, the system results in a kernel panic. In fact, I was told that it was anaccident that these cards even worked with Mandrake 7.2. With some work, they can be configured correctly to work during booting. In reality, the cards are supported with the kernel that comes with Mandrake 8.0. What happens though, is that the system maps the drives incorrectly. For example, my drive in Mandrake 7.2 is hdh5. This is also where Mandrake 8.0 maps it, but it is incorrect and not in sync with the kernel. Mandrake actually puts it at hdf5. This had to be found by trial-an-error. Here is how to start this process.

  1. Edit your lilo.conf and find which drive your root file system was on.. Ex.. I thought mine was on hdh5, but it really was on hdf5. You will know when you mapped the drive correctly because you will get past the line that says something like ‘Press I for Interactive Setup’ and they you will usually get stopped with a swap file error. Only proceed, once you have achieved this.
  2. Open your /etc/fstab into an editor and wherever it says hdXX, put it what it should be. For example. Mine said hdh5; I edited it to say hdf5.
  3. Save and reboot.

Bibliography

http://www.csie.ntu.edu.tw/~b6506063/hpt366/ (No longer maintained)

http://www.linuxdoc.org/HOWTO/mini/Ultra-DMA-5.html

The Phd

October 22nd, 2010

Some people have been asking me when Im going to get my Phd.  The answer is that I dont know.  I took my new job thinking I would start my Phd within the first year.  Well, its October and that year has come and I havent taken a single class yet.  I know that I only need 5 more classes + dissertation + comps to get it.  But, class has escaped my attention for now.

Why you ask?

Simply put, Im having too much fun.  I love my job exactly the way it is.  I love the people.  I love the challenge.  I love the creative freedom.  I love that I can see a concert at the student center or go look at snowboards on Allen street all while on my lunch break.

Life has been really good.  Recently, Ive had the opportunity to see some pretty amazing stuff and participate in a military exercise out in the middle of no where in Arizona. I know Im on an amazing journey when I get back from lunch and my colleagues joke that while I was gone, I missed the IED going off right up the road from your test site.  I would have never guessed while sitting my calculus class  Id be in a situation like this 8 years later.

Im loving life right now and I want to take it all in right now for only God knows what tomorrow will bring.