Tuesday, 12 June 2007

Some C tutorials

There are a few tutorials of C programming. They are quite old but still very useful. Not every link has been tested. Since they are old, there might be some links not working.

http://www.faqs.org/faqs/C-faq/learn-c-cpp-today/
ftp://rtfm.mit.edu/pub/usenet/news.answers/C-faq/learn-c-cpp-today

Tuesday, 5 June 2007

Run EGSnrc in Parallel (2)

If there are two hosts are availeble for NQS.

Add .rhosts under home directory of user for hosts identification.

<hostname1> <username1>

<hostname2> <username1>

NFS is needed for Parallel EGSnrc.

There are three batch processing options in BEAMnrc, short 20 min, medium 2 hours, and long 40 days. Here is the configuration for short. Host host1 runs as server and also as processing node. Its configuraion is,

# for short, run limit is 2 because only 2 processors on each host
qmgr create batch short-dest pipeonly run_limit=2 user_limit=2
qmgr set per_process cpu_limit = \( 0:20:0 \) short-dest

# highest priority for short-dest
qmgr set priority = 40 short-dest
########running part of nqs ##########

###### gate of short #######
qmgr create pipe short-in pipeonly run_limit=2 destination=short-dest
qmgr set lb_in short-in
###### end of gate ########

qmgr set scheduler host1

qmgr create pipe short destination=short-scheduler@host1
####### pipe of short #########

####### server side ########
# under Mgr As Server, add two destinations
create pipe short-scheduler run_limit=20 destination=(short-in@host1,short-in@host2)
qmgr set lb_out short-scheduler

For host2, which runs a processing node, it does not need to have the server side configuration. For medium and long, just change the name and parameters.

Run EGSnrc in Parallel (1)

EGSnrc and BEAMnrc could be run in parallel as described in their documentations. One of the options is using NQS, Network Queuing System.

Here is the brief guide about how to install and configure Generic NQS.

First of all download the package.

Follow the instructions to install NQS locally. It is installed as standalone version.

Use nmapmgr to add host node,

> add host node

> add alias name node

> list

> exit

Use root to start NQS, qmgr start nqs

Create batch queues:

> qmgr create batch_queue short
> qmgr create batch_queue medium
> qmgr create batch_queue long

Specify CPU time:

> qmgr set per_process cpu_limit = \( 2:0:0 \) short
> qmgr set per_process cpu_limit = \( 8:0:0 \) medium
> qmgr set per_process cpu_limit = \( 24:0:0 \) long

Set up priority and runlimits:

> qmgr set priority = 40 short
> qmgr set priority = 30 medium
> qmgr set priority = 20 long

> qmgr set run_limit = 5 short
> qmgr set run_limit = 4 medium
> qmgr set run_limit = 2 long

Set up user limit:

> qmgr set user_limit = 2 short
> qmgr set user_limit = 1 medium
> qmgr set user_limit = 1 long

So far the configuration is done. Queues need to be enabled and started.

qmgr enable queue

qmgr start queue

Now we can submit tasks to the system.

qsub -eo -r what -q short something.sh

The tasks will start to run on the processor(s) if there is any available.

If you are running at a dual-processor or dual-core system, you could see the change of the performance.

Monday, 4 June 2007

EGSnrc and BeamNRC Installation

OS: Ubuntu 7.04

Install EGSnrc and BeamNRC:
  1. Install required software via Synaptic Package Manager;
  2. Install QT3.3.3; (Note GUI of EGSnrc was written under QT3, so it is incompatible with QT4) [add QTDIR=/usr/local/qt; MANPATH=$QTDIR/doc/man:$MANPATH; LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH; into /etc/bash.bashrc]
  3. Install EGSnrc and then BeamNRC using the method1 (the easiest method); [add HEN_HOUSE=/usr/local/EGSnrc; EGS_HOME=/usr/local/EGS_HOME; EGS_CONFIG="/usr/local/EGSnrc/specs/i686-pc-linux-gnu-g77.conf"; PATH=${HEN_HOUSE}/bin/i686-pc-linux-gnu-g77:${QTDIR}/bin:${PATH}; export QTDIR HEN_HOUSE EGS_HOME PATH MANPATH LD_LIBRARY_PATH EGS_CONFIG; into /etc/bash.bashrc before installation]
Addition: QT3.3.3 installation
  • Modify configure and find freetype and switch it off;
  • Add qt.conf under /etc/ld.so.conf.d with contents “/usr/local/qt/lib“;
  • Use ldconfig to reload;
After installation of EGSnrc and BEAMnrc, run script /usr/local/EGSnrc/scripts/finalize_egs_foruser and /usr/local/EGSnrc/scripts/finalize_beam_foruser
and add
EGS_HOME=/home/userhome/egsnrc/
EGS_CONFIG=/usr/local/EGSnrc/specs/i686-pc-linux-gnu-g77.conf
export EGS_HOME EGS_CONFIG

export OMEGA_HOME=/usr/local/EGSnrc/omega
. /usr/local/EGSnrc/scripts/egsnrc_bashrc_additions
. /usr/local/EGSnrc/scripts/beamnrc_bashrc_additions
into ~/.bashrc

Now installation is finished.