arbeit


This project directory created by Joe Kniss, in collaboration with Los Alamos National Lab and the University of Utah.



Arbeit: noun, from German, meaning work

Source documentation generated using doxygen .

This project contains the source needed to build basic Simian volume rendering & visualization applications.

This project is under CVS controll, see "CVS notes" in 3rd party section at the bottom of this file.

General

Coding style:

Not much to say here except respect the coding style of each library if you are hacking on it. For instance, Glift useses the "compositing" style design pattern, all member variables have the form "m_", etc... Whereas, Simianlib uses the "policy/pipeline" style design pattern, all member variables have the form "_". You will have to get a feel for the style of the library by examination.


Tabs:

Do not use them, use three (3) spaces for indentation. If you are using MSVC you need to go to "Tools->options->text editor->c++", check "insert spaces" and set "tab size" and "indent size" to 3. Please do this so that your code looks pretty in MSVC, emacs, vi, etc... ;)



Cmake

Built using CMake
Designed for cross platform development, windows and linux specifically.

It is preferable to select a CMake "bin" directory that is different from the current source directory, for example "Arbeit/bin". This is where CMake will place the generated files and where build object files will reside. In this directory you will find a Arbeit.sln MSVC project, for example, which loads the entire project, or a Makefile which tells "g++" how to build your applications. This level of organization helps keep the source from getting polluted, which is nice for version controll and stuff like that.

Windows

To run cmake on usindows use: cmakesetup.exe. This is a GUI based cmake configure. This program can be found at:
start->programs->cmake->cmakesetp
You need to set:
"Where is the sourece": {path to..}/arbeit
"Where to build binaries": {path to..}/arbeit/bin
Naturally the "bin" directory can be wherever you like it, You might also have multiple "bin" directories for different configurations..
The first time you run cmakesetup it will complain that it can't find the "QT_MAIN_LIBRARY". You will need to check the "Show Advanced Values" box to gain access to this variable. The library will be located in:
{path to qt install}/qt/lib
and the library's name will be something like qt-mt320.lib, for instance.

The only MSVC compiler I am supporting is MSVC.NET 2003 (7.1) or newer. I choose this platform since it is currently the only MS development environment that supports ANSI/ISO C++, ie the standard. Please be aware that some things may not compile correctly without it. Also, much of the future development will encorporate generic programming, see "loki", which definately requires a standard C++ impementation.

Linux

There is a simmilar, command-line, interface for configuring this cmake project, it is called ccmake. You need to run it from the directory you want the object files to be built in, i.e. the bin directory:
cd bin
ccmake ..

Files, Folders, and Projects

If you add a new file: You need to add it to the correct CMakeLists.txt file. Please keep things organized and clean. You also need to add it to the cvs repository, see "CVS notes" in the 3rd party section of this README. Once the file is added and the CMakeLists.txt file is updated, you need to re-run cmake setup to build, platform specifics are below. In fact, any time you make changes to the CMakeLists.txt files, you have to re-run cmake setup. It is a REALY good idea to run cmakesetup or ccmake every time you update from cvs.


The MSVC projects are built around a folder based organization. This requires an extra set of CMake commands for each folder, an example of these commads is documented below. Linux users should still do this to be nice to other MSVC users.

Adding a new folder is simple, just follow these easy steps:

MSVC:
  1. Create the folder in the project, right->add->new folder
  2. Make a new directory in the right place in the system directory tree
  3. Add some source to it, make it compile
  4. Update the CMakeLists for that directory, see below
  5. Run cmakesetup and reload project (MSVC should ask you)
  6. Check that the folder showed up correctly
LINUX: basically the same as MSVC, skip step 1 and use ccmake .. from the commandline.

Updating the CMakeLists.txt file for the new folder:
  1. comment comment comment
  2. set the dir in it's own variable
  3. set the source variable, you should use the dir variable
  4. add source variable to ADD_LIB.. or ADD_EXE
  5. setup the MSVC folder stuff (below), just copy/paste/edit
  6. double check the *_SRC -> *_FLDR, and *DR variables
  7. double check name of folder (last line)

Here is an (over-documented) example of the commands that need to reside in the CMakeLists.txt file in order for a folder to appear in MSVC correctly. It is perhaps simplest to copy this block of commads from an existing CMakeLists.txt file and edit the *_SRC, *_FLDR, and *DR variables. This is only an example...

#############################
# Some sub-folder

# Turn some list of sources into a regular expression
STRING(REGEX REPLACE ";" "|" NOISE_FLDR "${NOISE_SRC}")

# Make sure that the "."s in the string are really ".", and not
# part of the regular expression, ie "any single char".
STRING(REGEX REPLACE "\\." "\\\\." NOISE_FLDR "${NOISE_FLDR}")

# Remove subfolder path, saved in the "NDR" variable from the
# filenames. This is nessesary until kitware fixes the bug
# preventing cmake regexps from handling paths
STRING(REGEX REPLACE "${NDR}\\/" "" NOISE_FLDR "${NOISE_FLDR}")

# Create the folder
SOURCE_GROUP(Noise (${NOISE_FLDR})$)
#
#############################

You will see this in the various CMakeLists.txt files without the extra documentation for each step. This only needs to be done once per-folder assuming the files for each folder are collected in individual variables, "NOISE_SRC" in the example above, and the path is saved in another variable, "NDR" in the example.

Adding a project procedes in much the same way. The best thing to do is check out an existing project's CMakeLists.txt file. There are a bunch of things to set: include paths, defines, link paths, and link libraries. Not all are applicable for all project types, for example Libraries dont need to link, so...


Linux

You need to install the nvidia linux driver, this involves hacking the etc/XF86conf file, just follow the instructions for driver installation. Please, please, for your own sake read the docs.

Once installed, type "glxinfo" to see a list of extensions and displays supported by the driver, if this is empty, you have not done it right. Here is a small piece of what I get:

>glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.3
server glx extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_ARB_multisample, GLX_NV_float_buffer
client glx vendor string: NVIDIA Corporation
client glx version string: 1.3
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_SGI_video_sync, GLX_SGIX_swap_group, GLX_SGIX_swap_barrier, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_NV_float_buffer
.... and so on...

Next you need to copy all of the gl headers to their new home:
cp /usr/share/doc/NVIDIA_GLX-1.0/include/GL/*.h /usr/include/GL
This may have been done by the driver installation, but you should check. NOTE: You might want to save the old headers (gl.h, glx.h ...etc) and use sym links to choose which header is currently being used. It is known that Chromium(TM) only uses the mesa headers, so you might not want to nuke these if you are using other gl packages.


Now you are able to build against the new driver.

First, you will need to build TEEM and GLEW, see 3rd party below.

Now go to the "arbeit" directory. Make a directory called, for instance, "bin".
cd bin
ccmake .. note the 2 'c's, and the ".." indicating start up a dir

At some point you will forget the ".." in the previous command, cmake will barf, this is why.) In this example "bin" is in the arbeit tree, if you chose to build elswhere, the ".." becomes the path to the arbeit tree.

Configure the project how you like, if you have a "complete" linux install, you probably already have Qt. If not, you gotta get, either from redhat or from trolltech.com (the make takes hours!).

Now that cmake has configured stuff, successfully you typed 'c' and 'g' in the cmake setup, you build.

from bin:
make

When building your own application from simian lib, be sure you list the libraries in the right order, cuz it matters in linux. You have to have the most "dependent" libraries first in your CMakelists.txt file. You should have a look at the examples for an illustration of this. Here is an example of the link libraries in the right order:

TARGET_LINK_LIBRARIES(basicSimian
    simianlib
    gliftlib
    commonEtclib
    commonQtlib
    commonGLlib
    gutzlib
    ${GLEW_LIB}
    ${TEEM_LIB}
    ${STDGL_LIBS}
)

The lib lists in "${*}" were defined in the root CMakeLists.txt file in the "arbeit" directory. If you are getting link errors, this is the first place to check, if a lib depends on symbols defined in another lib, the one with the dependency needs to be first in the list.

The executables are located somewhere in the "bin" directory, the structure of this directory should mimic the structure of the root "arbeit" directory. You will find executables in their respective places in the "bin" directory.

Should be it, enjoy.

Parallel - MPI

Some issues with running MPI.
You need LA-MPI (Los Alamos MPI)
You need an RSH server (available via RPM)
Enable RSH server in etc/xinetd.d/rlogin, set "disable = no"
Create a users .rhosts file, add all machines and user name pairs
... ex "inferno.sci.utah.edu kedlund"
Make sure the $DISPLAY varialble is correct, in your .cshrc :
if(! $?DISPLAY ) then
    setenv DISPLAY localhost:0.0;
endif
You might also need to do an "xhost +" on the cluster nodes.

KONG NOTES

Kong is the parallel version of simian.

Options have been added to CMake to support enabling the building of Kong (the parallel volume renderer). When you enable BUILD_KONG in CMake you will then have options to use MPI or GM. MPI will be enabled by default. (NOTE: GM is not yet supported.)

If you are adding support for Kong to a shared source code file you should use #ifdef KONG for code that is parallel specific.


3rd party

This project also requires several 3rd party, open-source, projects:
TEEM : from Gordon Kindlman
GLEW : from Milan Ikits
QT: from Trolltech
CVS: Comes with cygwin (windows) and linux (dev)

These projects must be present to compile, the path to the root project directory can be set as a CMake option. The default assumes you installed them in the root Arbeit directory, but you can put them wherever you like.

Teem notes

Compiling teem is very easy.

cygwin:

you need to set some variables here:
setenv TEEM_ARCH cygwin (tcsh)
export TEEM_ARCH=cygwin (bash)
if you want PNG support:
setenv TEEM_PNG
setenv TEEM_ZLIB (tcsh)
export TEEM_PNG="true"
export TEEM_ZLIB="true" (bash)

then just:
cd src
make

That's it, but if you want png support you have to build it, starting with zlib, then png. But that's easy and the source is included. Teem comes with a PNG viewer caled "pv". Here is an example of using pv to view a projection image of some data:

unu project -i teddy.nrrd -a 0 -m max | unu quantize -b 8 | \ unu save -f png | pv -
That's it, the rest is pretty explanitory.

linux:

pretty much the same as the cygwin build, cept:
setenv TEEM_ARCH linux (tcsh)
....

windows (MSVC):

from a cygwin terminal,
cd src
make project
The windows project files will appear in the teem/win32/make directory

Open it in MSVC and compile, be aware of the nessesary libraries for various build configurations, ie PNG BZIP GZIP etc..., I have included these in the CVS repository, check the lib directory. You will want to have the .dll's in your path or move them to the "windows/system32" directory.

GLEW notes

windows:

Should just work, compile. You need to either have the lib directory containing the glew32.dll in your path or move glew32.dll and glew32d.dll to the "windows/system32" directory. This is cool if you don't have to change glew, but if you do, like getting a new version, you have to be sure to move the new dll to the system directory every time it changes. If you don't your program will crash. Note: you can also have the dll in the same directory as the .exe and it will always work.

linux:

I haven't worked out all the issues here yet. If the glew build ends with an error, check to see if the libGLEW.so built, if it did, you are ok, just move on. If not, well... we have issues. Most likely you got a link error when building "glewinfo" which is extrainious to this project so you can ignore it. I issed a bug with Milan, so maybe this will be fixed by the time you read this.

Qt notes

Ok, the issues below have been resolved, I think, the best thing to do is include QT headers as early as possible. You can often fix problems with misbehaving QT headers by changing the order of the includes. This may not always be possible, however, since glew.h must be included before any other GL files, but likely, glew isn't the deviant. I'm keeping the comments below since it will probably come up again. Try reordering your includes before trying one of the hacks below.


With the new NVidia linux driver I get this error when building:
.... /usr/include/X11/Xmd.h:134: conflicting types for `typedef long int INT32'
/usr/lib/qt-3.1/include/qglobal.h:646: previous declaration as `typedef int INT32'

This is because they both define the same thing to be different types in the "strict" sence. But in reality these are the same types. Trolltech has a compile definition "-DQT_CLEAN_NAMESPACE" that fixes this problem. I have added this define to the "FindQT.cmake" module in the ${QT_DEFINES} cmake variable. If you are using QT in a project or library, be sure you have:
ADD_DEFINITIONS( ${QT_DEFINES} )
in your CMakeLists.txt file.

Another issue I had with qt on linux happens when including the qFileDialoge. I get an error around a symbol called "Unsorted" in some "qDlg.h" file. This is because someone else defined this, so it can't possibly be an enum. There are two ways around this, but my choise is to simply test if the symbol is defined and undefine it right before I include the fileDialoge, or any other file that throws the error.

#ifdef Unsorted
#undef Unsorted
#endif

CVS notes

This project is under CVS controll at the University of Utah. If you don't have an account there and should have this source contact: Joe Kniss, jmk@cs.utah.edu.

Here is how to check it out:
setenv CVS_RSH ssh
setenv CVSROOT {usrname}@{machine}.sci.utah.edu:/usr/sci/projects/chimera/cvsroot

You may want to put these in a .cshrc or .bashrc file so you don't have to do this every time you start a new shell.
Here are some {machines} that work:

rapture
burn
ray

Now you can check it out:

cvs checkout arbeit
cvs checkout arbeit_doc

Always update before you commit, make sure everything compiles without errors or warnings! :

cvs update -d

This just checks your files against the cvs repository and brings in changes from the repository. If there is a "conflict in merge" you have to go into those files and seletct the version of the conflict that is correct, cvs inserts something like:

========>
stuff v1
========
stuff v2
<=======

.. in the code, you need to pick which is correct and delete the other one, or make changes that bring it up to date and working. Delete the "======"'s, they are just there to help you find the conflict in the file. Now compile and make sure your changes work.

Check in your stuff:

cvs commit -m "{something descriptive of what you did}"

Add a new file or directory:
cvs add {a list of new files}
cvs commit -m "{what did you add}"

PLEASE, make sure you don't commit any tmp files, object files, or anything other than source (include headers :).

To remove a file:

cvs delete {list of deleted files}

You have to "really" delete the files before you delete them from cvs.
Well, that's the basics, but you can learn more!
CVS Manual

Send questions, comments, and bug reports to:
jmk